In the past I used to test with RAM-disks, provided by /dev/ram*
. Gluster uses extended attributes on the filesystem, that makes is not possible to use tmpfs
. While thinking about improving some of the GlusterFS regression tests, I noticed that Fedora 20 (and possibly earlier versions too) does not provide the /dev/ram*
devices anymore. I could not find the needed kernel module quickly, so I decided to look into the newer zram
module.
Getting zram
working seems to be pretty simple. By default one /dev/zram0
is made available after loading the module. But, if needed, the module offers a parameter num_devices
to create more devices. After loading the module with modprobe zram
, you can do the following to create your high-performance volatile storage:
# SIZE_2GB=$(expr 1024 \* 1024 \* 1024 \* 2)
# echo ${SIZE_2GB} > /sys/class/block/zram0/disksize
# mkfs -t xfs /dev/zram0
# mkdir /bricks/fast
# mount /dev/zram0 /bricks/fast
With this mountpoint it is now possible to create a Gluster volume:
# gluster volume create fast ${HOSTNAME}:/bricks/fast/data
# gluster volume start fast
Once done with testing, stop and delete the Gluster volume, and free the zram
like this:
# umount /bricks/fast
# echo 1 > /sys/class/block/zram0/reset
Of course, unloading the module with rmmod zram
would free the resources too.
It is getting more important for Gluster to be prepared for very fast disks. Hardware like Fusion-io Flash drives and in future Persistent Memory/NVM will get more available in storage clouds, and of course we would like to see Gluster staying part of that!