Adding Log Drives (ZIL) to Zpool
This article details the process of adding a slog or log drive to your zpool. A log drive will log synchronous operations to the disk before it is written to the pool.
The ZFS Intent Log is a logging mechanism where all the of data to be written is stored, then later flushed as a transactional write. It is typically stored on a fast device such as a SSD, for writes smaller than 64kB the ZIL stores the data on the fast device, but for larger sizes the data is not stored in the ZIL, only the pointers to the synced data is stored.
Due to this not all applications can take advantage of of the ZIL. Database applications have the largest benefit of a ZIL (MySQL,PostgreSQL,Oracle) as well as NFS and iSCSI. Typical moving around of data around the file system will not see much of a benefit.
Rules of Thumb:
– ZILs are typically very small. Just 1-2GB of ZIL storage for a server with Gb LAN is overkill. Do not oversize your ZIL excessively.
– ZILs do not commit writes to disk asynchronously and therefore can result in lost writes if the drive fails. Because of this it is recommended you put your ZILs in a mirrored configuration.
An unused SSD to use as Log Drive
The sdX name of the SSD added to the unit (Command Line)
- Go to the ZFS + File Sharing tab, then “Status” of the pool.
- Add a vdev
- Select Virtual Device as “Log”, then select the disk you want to add, then click “Add”
To add a single SSD as a Log Drive run the command:
zpool add pool log sdX
For a multiple drives:
zpool add pool log mirror sdX sdX
In the Status tab of the zpool you should now see the log added.
After adding the Log Drive run this command and confirm it was added to the zpool:
zpool status pool