{"id":192,"date":"2010-03-14T22:01:27","date_gmt":"2010-03-14T14:01:27","guid":{"rendered":"http:\/\/www.sysadmindayph.com\/blog\/?p=192"},"modified":"2010-03-14T22:01:27","modified_gmt":"2010-03-14T14:01:27","slug":"zfs-cheat-sheet-including-zpool-quotas-and-reservations","status":"publish","type":"post","link":"http:\/\/www.sysadmindayph.com\/blog\/zfs-cheat-sheet-including-zpool-quotas-and-reservations\/","title":{"rendered":"ZFS Cheat Sheet Including Zpool, Quotas and Reservations"},"content":{"rendered":"<p>Sorry for the long title post. I just want to easily distinguish this post from my other ZFS post. The reason? For this week, I&#8217;ll be working on a server with ZFS filesystem and looks like the SAs for the servers is not yet familiar with the filesystem. I am the newest member of the UNIX team and there&#8217;s this request to grow a filesystem that is directly mounted from a disk slice.. Told the guy that we may need to modify the disk geometry and we may have to repartition the disk.. Then I noticed that there is a 140G disk under ZFS partition. I will convince the user to use that spare disk for his project.<\/p>\n<p>And here are the cheat sheet for ZFS\/zpool that is related to this week&#8217;s project.<\/p>\n<p><!--more--><\/p>\n<p>The whole exaple uses virtual devices.. that is chucks of files that represents disk.. of course if you have physical disk available, you may use those.<\/p>\n<p>Here&#8217;s how to create &#8220;virtual devices\u201d or vdevs as described in the zpool documentation. These can also be real disk slices if you have them available.<\/p>\n<p><code>$ su<br \/>\nPassword:<br \/>\n# cd \/<br \/>\n# mkfile 100m disk1 disk2 disk3 disk5<br \/>\n# mkfile 50m disk4<br \/>\n# ls -l disk*<br \/>\n-rw------T 1 root root 104857600 Sep 11 12:15 disk1<br \/>\n-rw------T 1 root root 104857600 Sep 11 12:15 disk2<br \/>\n-rw------T 1 root root 104857600 Sep 11 12:15 disk3<br \/>\n-rw------T 1 root root 52428800 Sep 11 12:15 disk4<br \/>\n-rw------T 1 root root 104857600 Sep 11 12:15 disk5<br \/>\n<\/code><\/p>\n<p>Here&#8217;s how to create a storage pool and check the size and usage.<\/p>\n<p><code># zpool create myzfs \/disk1 \/disk2<br \/>\n# zpool list<br \/>\nNAME SIZE USED AVAIL CAP HEALTH ALTROOT<br \/>\nmyzfs 191M 94K 191M 0% ONLINE -<\/code><\/p>\n<p>When you created a disk pool, you can create a ZFS Filesystem which also in turn,<\/p>\n<p>Create a second file system. Note that both file system show 159M available because no quotas are set. Each \u201ccould\u201d grow to fill the pool.<\/p>\n<p># zfs create myzfs\/colin2<br \/>\n# zfs list<br \/>\nNAME           USED  AVAIL  REFER  MOUNTPOINT<br \/>\nmyzfs          172K   159M    21K  \/myzfs<br \/>\nmyzfs\/colin     18K   159M    18K  \/myzfs\/colin<br \/>\nmyzfs\/colin2    18K   159M    18K  \/myzfs\/colin2<\/p>\n<p>Reserve a specified amount of space for a file system ensuring that other users don\u2019t take up all the space. <\/p>\n<p># zfs set reservation=20m myzfs\/colin<br \/>\n# zfs list -o reservation<br \/>\nRESERV<br \/>\n  none<br \/>\n   20M<br \/>\n  none<\/p>\n<p>Set and view quotas <\/p>\n<p># zfs set quota=20m myzfs\/colin2<br \/>\n# zfs list -o quota myzfs\/colin myzfs\/colin2<br \/>\nQUOTA<br \/>\n none<br \/>\n  20M<\/p>\n<p>Destroy a filesystem<\/p>\n<p># zfs destroy myzfs\/colin2<br \/>\n# zfs list<br \/>\nNAME               USED  AVAIL  REFER  MOUNTPOINT<br \/>\nmyzfs             20.1M   139M    22K  \/myzfs<br \/>\nmyzfs\/colin         18K   159M    18K  \/myzfs\/colin<br \/>\nmyzfs\/colin@test      0      &#8211;    18K  &#8211;<br \/>\nmyzfs\/colin3          0   139M    18K  \/myzfs\/colin3<\/p>\n<p>That&#8217;s what I need for now.. will continue addiction ZFS cheat sheet if needed.. Pardon me, but my primary use of this blog site is for my use \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sorry for the long title post. I just want to easily distinguish this post from my other ZFS post. The reason? For this week, I&#8217;ll be working on a server with ZFS filesystem and looks &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91],"tags":[387,322,220],"class_list":["post-192","post","type-post","status-publish","format-standard","hentry","category-zfs","tag-zfs","tag-zfs-filesystem","tag-zpool"],"_links":{"self":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts\/192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/comments?post=192"}],"version-history":[{"count":1,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts\/192\/revisions"}],"predecessor-version":[{"id":193,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts\/192\/revisions\/193"}],"wp:attachment":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/media?parent=192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/categories?post=192"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/tags?post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}