# ZFS intent logs and cache



## atwinix (Dec 23, 2010)

Greetings All,

I have installed FreeBSD on ZFS using RAIDZ2.  I have recently acquired an SSD (/dev/gpt/disk6) drive which I want to use for caching and for the intent logs.

My current configuration is:


```
# zpool status
  pool: zroot
 state: ONLINE
config:

        NAME           STATE     READ WRITE CKSUM
        zroot          ONLINE       0     0     0
          raidz2       ONLINE       0     0     0
            gpt/disk0  ONLINE       0     0     0
            gpt/disk1  ONLINE       0     0     0
            gpt/disk2  ONLINE       0     0     0
            gpt/disk3  ONLINE       0     0     0
            gpt/disk4  ONLINE       0     0     0
            gpt/disk5  ONLINE       0     0     0

errors: No known data errors
```

Does anyone know if I can use the SSD drive for both caching and intent logs as in:


```
zpool add zroot log /dev/gpt/disk6 
zpool add zroot cache /dev/gpt/disk6
```

Is it also possible to move a mountpoint such as zroot/var/log to the new drive.  Disks 0 to 5 are "green drives" and I want them to spin down when not in use by moving frequently accessed directories to the SSD.

Thanks all for your help and advice,

atwinix


----------



## phoenix (Dec 23, 2010)

Yes, you can share a single physical disk between L2ARC (cache) and SLOG (log).  However, you have to partition the disk into two, and use separate partitions for the L2ARC and the SLOG.

*HOWEVER*, unless you are running ZFSv19 or newer, you *MUST* use two separate devices, combined into a mirror, for the SLOG.  Prior to ZFSv19 you could not remove a SLOG device, so if the device died, your pool becomes unimportable (inaccessible), in effect, causing complete data loss in the pool (there are ways to access the data, but they aren't simple).

You'd be better off just using the SSD as an L2ARC device.  Unless you are doing a lot of NFS traffic, or lots of sync writes from multiple processes, you probably won't benefit from a SLOG.


----------



## atwinix (Dec 23, 2010)

Thanks for your comments Phoenix.  It really enlightens me.

I am actually doing a lot of NFS.  I have six computers accessing the server to pxe-boot and to mount their filesystems via NFS.

I think I am using ZFS version 15.  In that case, I will just partition the SSD for cache and intent logs.

Cheers,

atwinix


----------



## phoenix (Dec 29, 2010)

If you only have a single SSD, don't use it for the log.  You need 2 separate physical devices, in order to create a mirrored log device.


----------

