{"id":5632,"date":"2016-04-06T11:39:08","date_gmt":"2016-04-06T03:39:08","guid":{"rendered":"http:\/\/rmohan.com\/?p=5632"},"modified":"2016-04-06T11:39:08","modified_gmt":"2016-04-06T03:39:08","slug":"zfs-cheat-sheet-solaris-11","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5632","title":{"rendered":"zfs cheat sheet Solaris 11"},"content":{"rendered":"<h3 class=\"post-title entry-title\">zfs cheat sheet Solaris 11<\/h3>\n<div class=\"post-header\"><\/div>\n<div id=\"post-body-3571174941577529057\" class=\"post-body entry-content\">\n<div dir=\"ltr\">\n<div class=\"gmail_default\">The ZFS file system is a file system that fundamentally changes the way file systems are administered, with features and benefits not found in other file systems available today. ZFS is robust, scalable, and easy to administer.ZFS uses the concept of\u00a0storage pools\u00a0to manage physical storage,\u00a0ZFS eliminates volume management altogether. Instead of forcing you to create virtualized volumes, ZFS aggregates devices into a storage pool.File systems are no longer constrained to individual devices, allowing them to share disk space with all file systems in the pool. You no longer need to predetermine the size of a file system, as file systems grow automatically within the disk space allocated to the storage pool. When new storage is added, all file systems within the pool can immediately use the additional disk space without additional work<\/div>\n<div class=\"gmail_default\"><\/div>\n<div class=\"gmail_default\">\n<table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"466\" \/>\n<col width=\"397\" \/><\/colgroup>\n<tbody>\n<tr>\n<td><b>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0zpool commands<\/b><\/td>\n<td><b>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Description<\/b><\/td>\n<\/tr>\n<tr>\n<td>zpool create testpool c0t0d0<\/td>\n<td>Create simple pool named testpool with single disk<br \/>\ncreating default mount point as poolname(\/testpool)<br \/>\n<b> OPTIONAL:<\/b><br \/>\n-n do a dry run on pool creation<br \/>\n-f force creation of the pool<\/td>\n<\/tr>\n<tr>\n<td>zpool create testpool mirror c0t0d0 c0t0d1<\/td>\n<td>Create testpool mirroring c0t0d0 with c0t0d1<br \/>\ncreating default mount point as poolname(\/testpool)<\/td>\n<\/tr>\n<tr>\n<td>zpool create -m \/mypool testpool c0t0d0<\/td>\n<td>Create pool with different mount point than default<\/td>\n<\/tr>\n<tr>\n<td>zpool create testpool raidz c2t1d0 c2t2d0 c2t3d0<\/td>\n<td>Create RAID-Z testpool<\/td>\n<\/tr>\n<tr>\n<td>zpool add testpool raidz c2t4d0 c2t5d0 c2t6d0<\/td>\n<td>Add RAID-Z disks to testpool<\/td>\n<\/tr>\n<tr>\n<td>zpool create testpool raidz1 c2t1d0 c2t2d0 c2t3d0 c2t4d0 c2t5d0 c2t6d0<\/td>\n<td>Create RAIDZ-1 testpool<\/td>\n<\/tr>\n<tr>\n<td>zpool create testpool raidz2 c2t1d0 c2t2d0 c2t3d0 c2t4d0 c2t5d0 c2t6d0<\/td>\n<td>Create RAIDZ-2 testpool<\/td>\n<\/tr>\n<tr>\n<td>zpool add testpool spare c2t6d0<\/td>\n<td>Add spare device to the testpool<\/td>\n<\/tr>\n<tr>\n<td>zpool create testpool mirror c2t1d0 c2t2d0 mirror c2t3d0 c2t4d0<\/td>\n<td>Disk c2t1d0 mirrored with c2t2d0 &amp;<br \/>\nc2t3d0 mirrored with c2t4d0<\/td>\n<\/tr>\n<tr>\n<td>zpool remove testpool c2t6d0<\/td>\n<td>Removes hot spares and cache disks<\/td>\n<\/tr>\n<tr>\n<td>zpool detach testpool c2t4d0<\/td>\n<td>Detach the mirror from the pool<\/td>\n<\/tr>\n<tr>\n<td>zpool clear testpool c2t4d0<\/td>\n<td>Clears specific disk fault<\/td>\n<\/tr>\n<tr>\n<td>zpool replace testpool c3t4d0<\/td>\n<td>Replace disk like disk<\/td>\n<\/tr>\n<tr>\n<td>zpool replace testpool c3t4d0 c3t5d0<\/td>\n<td>Replace one disk with another disk<\/td>\n<\/tr>\n<tr>\n<td>zpool export testpool<\/td>\n<td>Export the pool from the system<\/td>\n<\/tr>\n<tr>\n<td>zpool import testpool<\/td>\n<td>Imports specific pool<\/td>\n<\/tr>\n<tr>\n<td>zpool import -f -D -d \/testpool testpool<\/td>\n<td>Import destroyed testpool<\/td>\n<\/tr>\n<tr>\n<td>zpool import testpool newtestpool<\/td>\n<td>Import a pool originally named testpool under<br \/>\nnew name newtestpool<\/td>\n<\/tr>\n<tr>\n<td>zpool import 88746667466648<\/td>\n<td>Import pool using ID<\/td>\n<\/tr>\n<tr>\n<td>zpool offline testpool c2t4d0<\/td>\n<td>Offline the disk in the pool<br \/>\n<b>Note: zpool offline testpool -t c2t4d0<\/b> will offline temporary<\/td>\n<\/tr>\n<tr>\n<td>zpool upgrade -a<\/td>\n<td>upgrade all pools<\/td>\n<\/tr>\n<tr>\n<td>zpool upgrade testpool<\/td>\n<td>Upgrade specific pool<\/td>\n<\/tr>\n<tr>\n<td>zpool status -x<\/td>\n<td>Health status of all pools<\/td>\n<\/tr>\n<tr>\n<td>zpool status testpool<\/td>\n<td>Status of pool in verbose mode<\/td>\n<\/tr>\n<tr>\n<td>zpool get all testpool<\/td>\n<td>Lists all the properties of the storage pool<\/td>\n<\/tr>\n<tr>\n<td>zpool set autoexpand=on testpool<\/td>\n<td>Set the\u00a0parameter\u00a0value on the storage pool<br \/>\nNote: zpool get all testpool gives you all the properties<br \/>\non which it could be used to set value<\/td>\n<\/tr>\n<tr>\n<td>zpool list<\/td>\n<td>Lists all pools<\/td>\n<\/tr>\n<tr>\n<td>zpool list -o name,size,altroot<\/td>\n<td>show properties of the pool<\/td>\n<\/tr>\n<tr>\n<td>zpool history<\/td>\n<td>Displays history of the pool<br \/>\nNote: Once the pool is removed, history is removed.<\/td>\n<\/tr>\n<tr>\n<td>zpool iostat 2 2<\/td>\n<td>Display ZFS I\/O stastics<\/td>\n<\/tr>\n<tr>\n<td>zpool destroy testpool<\/td>\n<td>Removes the storage pool<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"gmail_default\"><\/div>\n<div class=\"gmail_default\">\n<table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"413\" \/>\n<col width=\"385\" \/><\/colgroup>\n<tbody>\n<tr>\n<td><b>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0zfs commands<\/b><\/td>\n<td><b>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Description<\/b><\/td>\n<\/tr>\n<tr>\n<td>zfs list<\/td>\n<td>Lists the ZFS file system&#8217;s<br \/>\nzfs list -t filesystem<br \/>\nzfs list -t snapshot<br \/>\nzfs list -t volume<\/td>\n<\/tr>\n<tr>\n<td>zfs create testpool\/filesystem1<\/td>\n<td>Creates ZFS filesystem on testpool storage<\/td>\n<\/tr>\n<tr>\n<td>zfs create -o mountpoint=\/filesystem1 testpool\/filesystem1<\/td>\n<td>Different mountpoint created after ZFS creation<\/td>\n<\/tr>\n<tr>\n<td>zfs rename testpool\/filesystem1 testpool\/filesystem2<\/td>\n<td>Renames the ZFS filesystem<\/td>\n<\/tr>\n<tr>\n<td>zfs unmount testpool<\/td>\n<td>unmount the storagepool<\/td>\n<\/tr>\n<tr>\n<td>zfs mount testpool<\/td>\n<td>mounts the storagepool<\/td>\n<\/tr>\n<tr>\n<td><b>NFS exports in ZFS<\/b><\/td>\n<td><b>zfs share testpool<\/b> &#8211; shares the file system for export<br \/>\n<b>zfs set share.nfs=on testpool<\/b> &#8211; make the share\u00a0persistent<br \/>\nacross reboot<br \/>\n<b>svcs -a nfs\/server<\/b> &#8211; NFS server should be online<br \/>\n<b>cat \/etc\/dfs\/dfstab<\/b> &#8211; Exported entry in the file<br \/>\n<b>showmount -e<\/b> &#8211; storage pool has been exported<\/td>\n<\/tr>\n<tr>\n<td>zfs unshare testpool<\/td>\n<td>Remove NFS exports<\/td>\n<\/tr>\n<tr>\n<td>zfs destroy -r testpool<\/td>\n<td>Destroy storage pool and all datasets under it<\/td>\n<\/tr>\n<tr>\n<td>zfs set quota=1G testpool\/filesystem1<\/td>\n<td>set quota of 1GB on the filesystem1<\/td>\n<\/tr>\n<tr>\n<td>zfs set reservations=1G testpool\/filesystem1<\/td>\n<td>set reservation of 1GB on the filesystem1<\/td>\n<\/tr>\n<tr>\n<td>zfs set mountpoint=legacy testpool\/filesystem1<\/td>\n<td>Disable ZFS auto mounting and enable<br \/>\nthrough \/etc\/vsftab<\/td>\n<\/tr>\n<tr>\n<td>zfs unmount testpool\/filesystem1<\/td>\n<td>unmounts ZFS filesystem1 in testpool<\/td>\n<\/tr>\n<tr>\n<td>zfs mount testpool\/filesystem1<\/td>\n<td>mounts ZFS filestystem1 in testpool<\/td>\n<\/tr>\n<tr>\n<td>zfs mount -a<\/td>\n<td>mounts all the ZFS filesystems<\/td>\n<\/tr>\n<tr>\n<td>zfs snapshot testpool\/filesystem1@friday<\/td>\n<td>Creates a snapshot of the filesystem1<\/td>\n<\/tr>\n<tr>\n<td>zfs hold keep testpool\/filesystem1@friday<\/td>\n<td>Holds existing snapshot &amp; attempts to destroy using zfs destroy will fail<\/td>\n<\/tr>\n<tr>\n<td>zfs rename testpool\/filesystem1@friday FRIDAY<\/td>\n<td>Rename the snapshots<br \/>\n<b>Note:<\/b> snapshots must exists in the same pools<\/td>\n<\/tr>\n<tr>\n<td>zfs diff testpool\/filesystem1@friday testpool\/filesystem1@friday1<\/td>\n<td>Identify\u00a0the difference between two snapshots<\/td>\n<\/tr>\n<tr>\n<td>zfs holds testpool\/filesystem1@friday<\/td>\n<td>Displays the list of snapshots help<\/td>\n<\/tr>\n<tr>\n<td>zfs rollback -r testpool\/fileystem1@friday<\/td>\n<td>Roll back yesterday snapshot recursively<\/td>\n<\/tr>\n<tr>\n<td>zfs destroy testpool\/fileystem1@thursday<\/td>\n<td>Destroy snapshot created yesterday<\/td>\n<\/tr>\n<tr>\n<td>zfs clone testpool\/filesystem1@friday testpool\/clones\/friday<\/td>\n<td>Clone was created on the same snapshot<br \/>\n<b>Note:<\/b> Cannot create clone of a filesystem in a pool that is\u00a0different from where original snapshot resides.<\/td>\n<\/tr>\n<tr>\n<td>zfs destroy testpool\/clones\/Friday<\/td>\n<td>Destroy the clone<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>zfs cheat sheet Solaris 11 The ZFS file system is a file system that fundamentally changes the way file systems are administered, with features and benefits not found in other file systems available today. ZFS is robust, scalable, and easy to administer.ZFS uses the concept of storage pools to manage physical storage, ZFS eliminates volume [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5632"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5632"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5632\/revisions"}],"predecessor-version":[{"id":5633,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5632\/revisions\/5633"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}