{"id":212,"date":"2010-08-17T14:39:10","date_gmt":"2010-08-17T12:39:10","guid":{"rendered":""},"modified":"2010-08-18T09:29:42","modified_gmt":"2010-08-18T07:29:42","slug":"how-remove-dataset-solaris-zone-and-mount-it-lofs","status":"publish","type":"post","link":"https:\/\/drfugazi.eu.org\/en\/how-remove-dataset-solaris-zone-and-mount-it-lofs\/","title":{"rendered":"How to remove dataset from Solaris zone and mount it as lofs"},"content":{"rendered":"<p>Because of building mail system I need to export ZFS filesystem via NFS to other node, where postfix with deliver will save messages to mail boxes. As you can see in <a href=\"\/en\/solaris-10\/04-containers-solaris-zones\/0401-installation-container-st1\">this installation transcript<\/a> I configured whole <b>zpool<\/b> &#8220;studmail&#8221; as <b>ZFS dataset<\/b> for <b>zone st1<\/b>. Unfortunatelly, you can not simply share <b>ZFS<\/b> via <b>NFS<\/b> in non-global zone:<\/p>\n<pre>\r\nroot@st1:~# zfs list\r\nNAME                         USED  AVAIL  REFER  MOUNTPOINT\r\nstudmail                     301M  1.78T  28.0K  none\r\nstudmail\/etc                4.52M  1.78T  4.19M  \/data\/etc\r\nstudmail\/studmail            480K  1.78T   417K  \/data\/studmail\r\nstudmail\/var                 296M  1.78T   294M  \/data\/var\r\n\r\nroot@st1:~# zfs set sharenfs=rw=@192.168.X.X\/32,anon=0 studmail\/studmail\r\ncannot set property for 'studmail\/studmail': 'sharenfs' cannot be set in a non-global zone\r\n<\/pre>\n<p><!--break--><\/p>\n<p>So I decided to reconfigure zone to use lofs and not dataset, but at first I must to change mountpoints:<\/p>\n<pre>\r\nroot@st1:~# zfs set mountpoint=\/data\/etc\/st1 studmail\/etc\r\nroot@st1:~# zfs set mountpoint=\/data\/var\/st1 studmail\/var\r\nroot@st1:~# zfs list\r\nNAME                         USED  AVAIL  REFER  MOUNTPOINT\r\nstudmail                     301M  1.78T  28.0K  none\r\nstudmail\/etc                4.52M  1.78T  4.19M  \/data\/etc\/st1\r\nstudmail\/studmail            480K  1.78T   417K  \/data\/studmail\r\nstudmail\/var                 296M  1.78T   294M  \/data\/var\/st1\r\n<\/pre>\n<p>Now we can halt and reconfigure zone:<\/p>\n<pre>\r\nroot@st1:~# halt\r\n\r\n[Connection to zone 'st1' pts\/2 closed]\r\nroot@feniks:~# zonecfg -z st1\r\nzonecfg:st1> info\r\nzonename: st1\r\nzonepath: \/zones\/st1\r\nbrand: native\r\nautoboot: true\r\n...\r\ndataset:\r\n\tname: studmail\r\n<\/pre>\n<p>Removing dataset (if you have more than one, you need to put name in command):<\/p>\n<pre>\r\nzonecfg:st1> remove dataset\r\n<\/pre>\n<p>Adding ZFS filesystems as lofs:<\/p>\n<pre>\r\nzonecfg:st1> add fs\r\nzonecfg:st1:fs> set dir=\/data\/etc\r\nzonecfg:st1:fs> set special=\/data\/etc\/st1\r\nzonecfg:st1:fs> end\r\ntype not specified\r\nzonecfg:st1:fs> set type=lofs\r\nzonecfg:st1:fs> end\r\nzonecfg:st1> add fs\r\nzonecfg:st1:fs> set dir=\/data\/var\r\nzonecfg:st1:fs> set special=\/data\/var\/st1\r\nzonecfg:st1:fs> set type=lofs\r\nzonecfg:st1:fs> end\r\nzonecfg:st1> add fs\r\nzonecfg:st1:fs> set dir=\/data\/studmail\r\nzonecfg:st1:fs> set special=\/data\/studmail\r\nzonecfg:st1:fs> set type=lofs\r\nzonecfg:st1:fs> end\r\nzonecfg:st1> verify\r\nzonecfg:st1> commit\r\nzonecfg:st1> exit\r\n<\/pre>\n<p>OK, but now the directories are empty. Why? Let&#8217;s check <b>zoned<\/b> property in dataset:<\/p>\n<pre>\r\nroot@feniks:~# zfs get -r zoned studmail\r\nNAME                        PROPERTY  VALUE  SOURCE\r\nstudmail                    zoned     on     local\r\nstudmail\/etc                zoned     on     inherited from studmail\r\nstudmail\/studmail           zoned     on     inherited from studmail\r\nstudmail\/var                zoned     on     inherited from studmail\r\n<\/pre>\n<p>So, filesystems are mounted, but you do not see its content into a global zone. We need to change this:<\/p>\n<pre>\r\nroot@feniks:~# zfs set zoned=off studmail\r\nroot@feniks:~# zfs get -r zoned studmail\r\nNAME                        PROPERTY  VALUE  SOURCE\r\nstudmail                    zoned     off    local\r\nstudmail\/etc                zoned     off    inherited from studmail\r\n...\r\nroot@feniks:~# ls -laF \/data\/etc\/st1\r\ntotal 4\r\ndrwxr-xr-x  2 root root  2 Aug 10 13:30 .\/\r\ndrwxr-xr-x 27 root root 28 Aug 13 10:26 ..\/\r\n<\/pre>\n<p>Still empty (or no directory)? The simpliest way is to <b>export<\/b> and <b>import zpool<\/b>:<\/p>\n<pre>\r\nroot@feniks:~# zpool export studmail\r\nroot@feniks:~# zpool import studmail \r\nroot@feniks:~# zfs list -r studmail\r\nNAME                         USED  AVAIL  REFER  MOUNTPOINT\r\nstudmail                     301M  1.78T  28.0K  none\r\nstudmail\/etc                4.52M  1.78T  4.19M  \/data\/etc\/st1\r\nstudmail\/studmail            480K  1.78T   417K  \/data\/studmail\r\nstudmail\/var                 296M  1.78T   294M  \/data\/var\/st1\r\nroot@feniks:~# ls -laF \/data\/etc\/st1 \r\ntotal 638\r\ndrwxr-xr-x 10 root root     13 Jul 21 14:03 .\/\r\ndrwxr-xr-x 27 root root     28 Aug 13 10:26 ..\/\r\ndrwxr-xr-x  7 root root     11 Jan 15  2010 apache\/\r\ndrwxr-xr-x  2 root root     13 Apr 12 13:23 certs\/\r\ndrwxr-xr-x  3 root root      6 Aug 17 08:40 dovecot\/\r\ndrwxr-xr-x  2   27 root      4 Apr 26 13:22 gnarwl\/\r\n...\r\n<\/pre>\n<p>I think, we can boot zone:<\/p>\n<pre>\r\nroot@feniks:~# zoneadm -z st1 boot\r\nroot@feniks:~# zoneadm -z st1 list -v\r\n  ID NAME             STATUS     PATH                           BRAND    IP    \r\n  14 st1              running    \/zones\/st1                     native   shared\r\n<\/pre>\n<p>Now we can export share via <b>NFS<\/b> from global zone:<\/p>\n<pre>\r\nroot@feniks:~# zfs set sharenfs=rw=@192.168.X.X\/32,anon=0 studmail\/studmail\r\nroot@feniks:~# share\r\n-               \/data\/studmail   anon=0,sec=sys,rw=192.168.X.X\/32   \"\" \r\n<\/pre>\n<p>WARNING: I do not care about security in this example, please see NFS documentation for options!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because of building mail system I need to export ZFS filesystem via NFS to other node, where postfix with deliver will save messages to mail boxes. As you can see in <a href=\"\/en\/solaris-10\/04-containers-solaris-zones\/0401-installation-container-st1\">this installation transcript<\/a> I configured whole <b>zpool<\/b> &#8220;studmail&#8221; as <b>ZFS dataset<\/b> for <b>zone st1<\/b>. Unfortunatelly, you can not simply share <b>ZFS<\/b> via <b>NFS<\/b> in non-global zone:<\/p>\n<pre>\r\nroot@st1:~# zfs list\r\nNAME                         USED  AVAIL  REFER  MOUNTPOINT\r\nstudmail                     301M  1.78T  28.0K  none\r\nstudmail\/etc                4.52M  1.78T  4.19M  \/data\/etc\r\nstudmail\/studmail            480K  1.78T   417K  \/data\/studmail\r\nstudmail\/var                 296M  1.78T   294M  \/data\/var\r\n\r\nroot@st1:~# zfs set sharenfs=rw=@192.168.X.X\/32,anon=0 studmail\/studmail\r\ncannot set property for 'studmail\/studmail': 'sharenfs' cannot be set in a non-global zone\r\n<\/pre>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[],"tags":[10,28],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7M9Tz-3q","jetpack-related-posts":[{"id":213,"url":"https:\/\/drfugazi.eu.org\/en\/jak-zamienic-w-kontenerze-dataset-na-lofs\/","url_meta":{"origin":212,"position":0},"title":"Jak zamieni\u0107 w kontenerze dataset na lofs","author":"drfugazi","date":"Tuesday August 17th, 2010","format":false,"excerpt":"Poniewa\u017c konfiguruj\u0119 system pocztowy, potrzebuj\u0119 wyeksportowa\u0107 filesystem ZFS przez NFS do innego noda, gdzie postfix poprzez delivera b\u0119dzie zapisywa\u0142 wiadomo\u015bci do skrzynek. Jak wida\u0107 w tym zapisie sesji, skonfigurowa\u0142em ca\u0142\u0105 zpoole \"studmail\" jako dataset ZFS dla kontenera st1. Niestety w prosty spos\u00f3b nie da si\u0119 wsp\u00f3\u0142dzieli\u0107 systemu plik\u00f3w ZFS przez\u2026","rel":"","context":"In \"Kontenery\"","block_context":{"text":"Kontenery","link":"https:\/\/drfugazi.eu.org\/en\/tag\/kontenery\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":202,"url":"https:\/\/drfugazi.eu.org\/en\/0401-installation-container-st1\/","url_meta":{"origin":212,"position":1},"title":"04.01 Installation of container st1","author":"drfugazi","date":"Thursday August 12th, 2010","format":false,"excerpt":"Creation of container named st1, without resource control, with inherited standard directories and additionally inherited \/usr\/local dir (read only mode). Configured two network Quad Fast Ethernet cards: qfe4 and qfe5 in shared mode. Added ZFS pool (zpool) named studmail.","rel":"","context":"In \"Solaris\"","block_context":{"text":"Solaris","link":"https:\/\/drfugazi.eu.org\/en\/tag\/solaris\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":200,"url":"https:\/\/drfugazi.eu.org\/en\/0401-instalacja-kontenera-st1\/","url_meta":{"origin":212,"position":2},"title":"04.01 Instalacja kontenera st1","author":"drfugazi","date":"Thursday August 12th, 2010","format":false,"excerpt":"Tworzenie kontenera o nazwie st1, bez kontroli zasob\u00f3w, z dziedziczonymi katalogami standardowymi i dodatkowo z dziedziczonym \/usr\/local (w trybie tylko do odczytu). Skonfigurowane dwie karty sieciowe: qfe4 i qfe5 w trybie wsp\u00f3\u0142dzielonym oraz dodana pula ZFS (zpool) o nazwie studmail.","rel":"","context":"In \"Kontenery\"","block_context":{"text":"Kontenery","link":"https:\/\/drfugazi.eu.org\/en\/tag\/kontenery\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":282,"url":"https:\/\/drfugazi.eu.org\/en\/przygotowanie-kontenera\/","url_meta":{"origin":212,"position":3},"title":"(Polski) Przygotowanie kontenera dla OpenDJ","author":"drfugazi","date":"Friday July  8th, 2011","format":false,"excerpt":"Przygotowanie kontenera (Solaris zone) dla serwera us\u0142ug katalogowych OpenDJ Uruchamiam format aby system wykry\u0142 dyski i pokaza\u0142 ich WWN: # format Searching for disks...done c4t600A0B80002ACF5A000015954E16BDE3d0: configured with capacity of 15.00GB c4t600A0B80002ACF5A000015974E16BE5Fd0: configured with capacity of 15.00GB c4t600A0B80002ACF5A000015994E16BEDBd0: configured with capacity of 15.00GB Tworz\u0119 zpool\u0119 raidz o nazwie zldapdj1, na kt\u00f3rej\u2026","rel":"","context":"In &quot;LDAP&quot;","block_context":{"text":"LDAP","link":"https:\/\/drfugazi.eu.org\/en\/category\/ldap\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":237,"url":"https:\/\/drfugazi.eu.org\/en\/usuwanie-starych-i-tworzenie-nowych-snapshotow-zfs\/","url_meta":{"origin":212,"position":4},"title":"Usuwanie starych i tworzenie nowych snapshot\u00f3w ZFS","author":"drfugazi","date":"Tuesday February  1st, 2011","format":false,"excerpt":"Niedawno pisa\u0142em o masowym tworzeniu snapshot\u00f3w ZFS. Tam robi\u0142em to rekursywnie dla ca\u0142ej puli u\u017cywaj\u0105c zpool list -H i przekierowuj\u0105c wyj\u015bcie do zfs snapshot -r. Tym razem zrobimy to inaczej. Je\u015bli mamy stare snapshoty to mo\u017cemy je wy\u015bwietli\u0107 poleceniem: # zfs list -t snapshot NAME USED AVAIL REFER MOUNTPOINT dappserv@20101130\u2026","rel":"","context":"In \"Solaris\"","block_context":{"text":"Solaris","link":"https:\/\/drfugazi.eu.org\/en\/tag\/solaris\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":568,"url":"https:\/\/drfugazi.eu.org\/en\/solaris-10-release-and-solaris-cluster-3-x-upgrade-patching\/","url_meta":{"origin":212,"position":5},"title":"Solaris 10 Release and Solaris Cluster 3.x upgrade + patching","author":"drfugazi","date":"Saturday February 20th, 2016","format":false,"excerpt":"On the day of writing, the newest version of Solaris 10 is u11 (1\/13) and Cluster (for Solaris 10) is 3.3u2. Cluster 3.2 is still supported by Oracle, but patches are no longer released. Update 11 for Solaris 10 is probably last Release of Solaris 10 and has some new\u2026","rel":"","context":"In &quot;Solaris&quot;","block_context":{"text":"Solaris","link":"https:\/\/drfugazi.eu.org\/en\/category\/solaris\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts\/212"}],"collection":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":0,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"wp:attachment":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}