ZFS: Adding an SSD as a cache drive

ZFS uses any free RAM to cache accessed files, speeding up access times; this cache is called the ARC. RAM is read at gigabytes per second, so it is an extremely fast cache. It is possible to add a secondary cache – the L2ARC (level 2 ARC) in the form of solid state drives. SSDs may only be able to sustain about half of a single gigabyte per second but this is still vastly more than any spinning disk is able to achieve, and the IOPS (in/out operations per second) are also typically much, much higher than standard hard drives.

 

If you find that you want more high-speed caching and adding more RAM isn’t feasible from an equipment or cost perspective a L2ARC drive may well be a good solution. To add one, insert the SSD to the system and run the following:

 

zpool add [pool] cache [drive]

e.g.:

 

zpool add kepler cache ata-M4-CT064M4SSD2_000000001148032355BE

 

zpool status now shows:

 

        NAME                                            STATE     READ WRITE CKSUM
kepler                                          ONLINE     0     0     0
raidz2-0                                      ONLINE     0     0     0
ata-WDC_WD20EARX-00PASB0_WD-WMAZA7352713    ONLINE       0     0     0
ata-WDC_WD20EARX-00PASB0_WD-WCAZAA637401  ONLINE       0     0     0
ata-WDC_WD20EARS-00MVWB0_WD-WCAZAC389999  ONLINE       0     0     0
ata-WDC_WD20EFRX-68AX9N0_WD-WMC300005397    ONLINE       0     0     0
ata-WDC_WD20EARX-00MMMB0_WD-WCAWZ0842074    ONLINE       0     0     0
ata-WDC_WD20EARX-00PASB0_WD-WMAZA7482193    ONLINE       0     0     0
cache
ata-M4-CT064M4SSD2_000000001148032155BE       ONLINE       0     0     0

You can see that the cache drive has been added to the bottom of the pool listing.

 

The way the ARC works is beyond the scope of this post – suffice to say for the moment that simply adding a L2ARC is not necessarily going to improve performance in every situation, so do some research before spending money on a good SSD. Check back for a more detailed investigation into how ARC and L2ARC work in November!