Invalidating cache due to ioctl
One of the nice things about dm-cache is that it doesn’t require you to create a new block device to store your file system on.
Instead dm-cache sits on top of your existing file system or you create a new file system.
Ubuntu upstart script to setup the device-mapper devices every time at boot and cleanly shutdown the device-mapper devices the moment the volume is unmounted using inotify: Install these files as root under /etc/init. I have backed up my old files and then copied them to my ssd-cached file system.
I create symlinks from my more important file systems to this test file system. Later I’ll use dm-cache to cache my entire /home file system and won’t need symlinks. Things like file browsing (thumbnails and what not) are stored on the ssd-cached file system and are much snappier then before.
If you don’t have backups and you’re playing with this new technology, you’re crazy. The Linux v3.9 kernel added support for the dm-cache support, so you’ll need to get at least version Linux v3.9 kernel to get this to work. You can download that form the Ubuntu kernel ppa site.
The goal is to significantly speed up throughput and latency to frequently accessed files.Create a partition on your SSD device for use later in this tutorial with dm-linear.