ZFS Command Line Cheat Sheet
ZFS Command Line Cheat Sheet
# zpool create -m /data datapool c0t0d0 Create a pool with a different mount point than the default.
# zpool create datapool raidz c3t0d0 c3t1d0 c3t2d0 Create RAID-Z vdev pool
# zpool add datapool raidz c4t0d0 c4t1d0 c4t2d0 Add RAID-Z vdev to pool datapool
# zpool create datapool raidz1 c0t0d0 c0t1d0 c0t2d0 c0t3d0 Create RAID-Z1 pool
c0t4d0 c0t5d0
# zpool create datapool raidz2 c0t0d0 c0t1d0 c0t2d0 c0t3d0 Create RAID-Z2 pool
c0t4d0 c0t5d0
# zpool create datapool mirror c0t0d0 c0t5d0 mirror c0t2d0 disk c0t0d0 is mirrored with c0t5d0 and disk c0t2d0 is
c0t4d0 mirrored withc0t4d0
# zpool add datapool mirror c3t0d0 c3t1d0 Add new mirrored vdev to datapool
# zpool add datapool spare c1t3d0 Add spare device c1t3d0 to the datapool
# zfs get all datapool List all properties of a ZFS file system
# zfs set mountpoint=/data datapool/fs1 Set the mount-point of file system fs1 to /data
Import/Export Commands
# zpool import -d To search for pools with block devices not located in /dev/dsk
# zpool import -d /zfs datapool Search for a pool with block devices created in /zfs
# zpool import oldpool newpool Import a pool originally named oldpool under new name newpool
# zpool export -f datapool Force the unmount and deport of a ZFS pool
By tim (The IceMan Blog) Published 16th July, 2019. Sponsored by Readable.com
cheatography.com/the- Last updated 5th August, 2019. Measure your website readability!
iceman-blog/ Page 1 of 3. https://readable.com
blog.rabin.io/
ZFS command line reference Cheat Sheet
by tim (The IceMan Blog) via cheatography.com/1411/cs/20047/
Clone Commands
# zpool list -o name,size Show particular properties of all the pools (here, name and size)
# zpool list -Ho name Show all pools without headers and columns
# zfs destroy -fr datapool/data destroy file-system or volume (data) and all related snapshots
# zfs set mountpoint=legacy datapool/fs1 Disable ZFS auto mounting and enable mounting through /etc/vfstab.
zfs set recordsize=[size] pool/dataset/name Set Dataset Record Size (Size should be a value like 16k, 128k, or 1M etc.)
# zpool scrub datapool Run scrub on all file systems under data pool
# zpool offline -t datapool c0t0d0 Temporarily offline a disk (until next reboot)
By tim (The IceMan Blog) Published 16th July, 2019. Sponsored by Readable.com
cheatography.com/the- Last updated 5th August, 2019. Measure your website readability!
iceman-blog/ Page 2 of 3. https://readable.com
blog.rabin.io/
ZFS command line reference Cheat Sheet
by tim (The IceMan Blog) via cheatography.com/1411/cs/20047/
Snapshot Commands
# zfs send datapool/fs1@oct2013 > /geekpool/fs1/oct2013.bak Take a backup of ZFS snapshot locally
# zfs receive anotherpool/fs1 < /geekpool/fs1/oct2013.bak Restore from the snapshot backup backup taken
# zfs send datapool/fs1@oct2013 | zfs receive anotherpool/fs1 Combine the send and receive operation
# zfs send datapool/fs1@oct2013 | ssh node02 "zfs receive Send the snapshot to a remote system node02
testpool/testfs"
By tim (The IceMan Blog) Published 16th July, 2019. Sponsored by Readable.com
cheatography.com/the- Last updated 5th August, 2019. Measure your website readability!
iceman-blog/ Page 3 of 3. https://readable.com
blog.rabin.io/