Flashcache on Proxmox

Flashcache is a kernel module released by Facebook engineer back in April 2010 to speed up database I/O on a standard rotational drive with the speed of SSD. Since it works by caching filesystem blocks, so it can speed anything on the slow rotational disk.
We’ve already use RAID10 with SAS disk on all of our hosting servers, but still I/O bottleneck often happens.

Modern filesystems like ZFS have solved this problem by allowing for ‘hybrid’ systems. These use the traditional harddisks for persistent storage, and use SSD drives in front of them to cache the read and write queries. This way you get the best of both worlds. Nearly SSD performance and the storage size of a traditional drive.

At Dot Enterprise Co.,Ltd. (Miami)  we use Proxmox to power our VPS offers, which uses LVM and EXT4 for it’s filesystem which doesn’t have a ‘SSD caching’ method built into it. Facebook seems to have had a similar issue, so they created FlashCache. Flashcache is a kernel module that allows you to add a block caching partition in front of any other partition of your system, resulting in an amazing speedup of your system.

Updating your system

Get your system up to date and make sure you’ve got the latest Kernel.

echo -e "deb http://download.proxmox.com/debian wheezy pve-no-subscription" >> /etc/apt/sources.list;
apt-get update
apt-get dist-upgrade
apt-get install dkms build-essential git

Kernel Headers

You will now need to install the Kernel Headers for your Kernel so that you can compile the module. Make sure you install the correct version of the headers. These need to be the same as the Kernel you’re running.

uname -a # to get your kernel version
apt-get install pve-headers-(same as version above);

Get FlashCache

Now that we’ve got the Kernel tools, we can get FlashCache and build it.

git clone git://github.com/facebook/flashcache.git;
cd flashcache/;
make -f Makefile.dkms boot_conf;
make && make install;

Load FlashCache

Next we need to load FlashCache into our running Kernel and make sure it’s loaded upon boot.

modprobe flashcache
echo flashcache >> /etc/modules


Creating the FlashCache partition

Editing /etc/fstab

The init.d file

Enabling the init.d file.

Now we need to make the file executable and make sure it’s run on boot.

chmod +x /etc/init.d/flashcache;
update-rc.d flashcache defaults;

Give it a spin

Right, that should do it. Reboot your machine and see if it comes back.


If all went well, your drive should be mounted with FlashCache in between.

#check by df-h

You can also see the statistics of FlashCache by running:

cat /proc/flashcache/(storagename)/flashcache_stats

That’s it!

Your Proxmox system should now have it’s VMs on the FlashCache drive.

If you have any questions or feedback, just leave them below.