{"id":1671,"date":"2025-07-14T14:23:59","date_gmt":"2025-07-14T12:23:59","guid":{"rendered":"https:\/\/www.shukko.com\/x3\/?p=1671"},"modified":"2025-07-14T14:23:59","modified_gmt":"2025-07-14T12:23:59","slug":"zfs-command-line-reference-cheat-sheet","status":"publish","type":"post","link":"https:\/\/www.shukko.com\/x3\/2025\/07\/14\/zfs-command-line-reference-cheat-sheet\/","title":{"rendered":"ZFS command line reference Cheat Sheet"},"content":{"rendered":"\n<p>NOT: Hatalar var Dikkatli OL!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Pool Related Commands\n# zpool create datapool c0t0d0  - Create a basic pool named datapool\n# zpool create -f datapool c0t0d0 - Force the creation of a pool\n# zpool create -m \/data datapool c0t0d0 - Create a pool with a different mount point than the default.\n# zpool create datapool raidz c3t0d0 c3t1d0 c3t2d0 - Create RAID-Z vdev pool\n# zpool add datapool raidz c4t0d0 c4t1d0 c4t2d0 - Add RAID-Z vdev to pool datapool\n# zpool create datapool raidz1 c0t0d0 c0t1d0 c0t2d0 c0t3d0 c0t4d0 c0t5d0 - Create RAID-Z1 pool\n# zpool create datapool raidz2 c0t0d0 c0t1d0 c0t2d0 c0t3d0 c0t4d0 c0t5d0 - Create RAID-Z2 pool\n# zpool create datapool mirror c0t0d0 c0t5d0 Mirror c0t0d0 to c0t5d0\n# zpool create datapool mirror c0t0d0 c0t5d0 mirror c0t2d0 c0t4d0 - disk c0t0d0 is mirrored with c0t5d0 and disk c0t2d0 is mirrored withc0t4d0\n# zpool add datapool mirror c3t0d0 c3t1d0 - Add new mirrored vdev to datapool\n# zpool add datapool spare c1t3d0 - Add spare device c1t3d0 to the datapool\n# zpool create -n geekpool c1t3d0 - Do a dry run on pool creation\n\nShow file system info\n# zfs list - List all ZFS file system\n# zfs get all datapool - List all properties of a ZFS file system\n\nMount\/Umount Related Commands\n# zfs set mountp oin t=\/data datapool\/fs1 - Set the mount-point of file system fs1 to \/data\n# zfs mount datapool \/fs1 - Mount fs1 file system\n# zfs umount datapool \/fs1 - Umount ZFS file system fs1\n# zfs mount -a - Mount all ZFS file systems\n# zfs umount -a - Umount all ZFS file systems\n\nImport\/Export Commands\n# zpool import - List pools available for import\n# zpool import -a - Imports all pools found in the search directories\n# zpool import -d - To search for pools with block devices not located in \/dev\/dsk\n# zpool import -d \/zfs datapool - Search for a pool with block devices created in \/zfs\n# zpool import oldpool newpool - Import a pool originally named oldpool under new name newpool\n# zpool import 3987837483 - Import pool using pool ID\n# zpool export datapool - Deport a ZFS pool named datapool\n# zpool export -f datapool - Force the unmount and deport of a ZFS pool\n\nClone Commands\n# zfs clone datapool\/ fs1 @10 jan2014 \/clone s\/fs1 - Clone an existing snapshot\n# zfs destroy datapool\/ fs1 @10 jan2014 - Destroy clone\n\nShow Pool Information\n# zpool status -x Show pool status\n# zpool status -v datapool - Show individual pool status in verbose mode\n# zpool list - Show all the pools\n# zpool list -o name,size - Show particular properties of all the pools (here, name and size)\n# zpool list -Ho name - Show all pools without headers and columns\n\nFile-system\/Volume related commands\n# zfs create datapool \/fs1 - Create file-system fs1 under datapool\n# zfs create -V 1gb datapool\/ vol01 - Create 1 GB volume (Block device) in datapool\n# zfs destroy -r datapool - destroy datapool and all datasets under it\n# zfs destroy -fr datapool \/data - destroy file-system or volume (data) and all related snapshots\n\nSet ZFS file system properties\n# zfs set quota=1G datapool \/fs1 - Set quota of 1 GB on filesystem fs1\n# zfs set reserv ati on=1G datapool \/fs1 - Set Reservation of 1 GB on filesystem fs1\n# zfs set mountpoint=legacy datapool\/ fs1 - Disable ZFS auto mounting and enable mounting through \/etc\/vfstab.\n# zfs set sharen fs=on datapool \/fs1 - Share fs1 as NFS\n# zfs set compression=on datapool \/fs1 - Enable compression on fs1\nzfs set record size=&#91; size] pool\/data set \/name - \nSet Dataset Record Size (Size should be a value like 16k, 128k, or 1M etc.)\nzfs get recordsize pool\/data set \/name - Get Dataset Record Size\n\nZFS I\/O performance\n# zpool iostat 2 - Display ZFS I\/O Statistics every 2 seconds\n# zpool iostat -v 2 - Display detailed ZFS I\/O statistics every 2 seconds\n\nZFS maintenance commands\n# zpool scrub datapool - Run scrub on all file systems under data pool\n# zpool offline -t datapool c0t0d0 - Temporarily offline a disk (until next reboot)\n# zpool online - Online a disk to clear error count\n# zpool clear - Clear error count without a need to the disk\n\nSnapshot Commands\n# zfs snapshot datapool\/ fs1 @12 jan2014 - Create a snapshot named 12jan2014 of the fs1 filesystem\n# zfs list -t snapshot - List snapshots\n# zfs rollback -r datapool\/ fs1 @10 jan2014 - Roll back to 10jan2014 - (recursively destroy intermediate snapshots)\n# zfs rollback -rf datapool\/ fs1 @10 jan2014 - Roll back must and force unmount and remount\n# zfs destroy datapool\/ fs1 @10 jan2014 - Destroy snapshot created earlier\n# zfs send datapool\/ fs1 @oc t2013 > \/geekpool \/fs1\/oct2013.bak - Take a backup of ZFS snapshot locally\n# zfs receive anotherpool\/fs1 &lt; \/geekpool \/fs1\/oct2 013.bak - Restore from the snapshot backup backup taken\n# zfs send datapool\/ fs1 @oct2013 | zfs receive anotherpool\/fs1 - Combine the send and receive operation\n# zfs send datapool\/ fs1 @oct2013 | ssh node02 \"zfs receive testpool\/ testfs \" - Send the snapshot to a remote system node02<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>NOT: Hatalar var Dikkatli OL!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1671","post","type-post","status-publish","format-standard","hentry","category-kategerisiz"],"_links":{"self":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/comments?post=1671"}],"version-history":[{"count":1,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1671\/revisions"}],"predecessor-version":[{"id":1672,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1671\/revisions\/1672"}],"wp:attachment":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/media?parent=1671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/categories?post=1671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/tags?post=1671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}