{"id":213,"date":"2010-08-17T18:50:57","date_gmt":"2010-08-17T16:50:57","guid":{"rendered":""},"modified":"2010-08-18T09:30:35","modified_gmt":"2010-08-18T07:30:35","slug":"jak-zamienic-w-kontenerze-dataset-na-lofs","status":"publish","type":"post","link":"https:\/\/drfugazi.eu.org\/en\/jak-zamienic-w-kontenerze-dataset-na-lofs\/","title":{"rendered":"Jak zamieni\u0107 w kontenerze dataset na lofs"},"content":{"rendered":"<p>Poniewa\u017c konfiguruj\u0119 system pocztowy, potrzebuj\u0119 wyeksportowa\u0107 filesystem <b>ZFS<\/b> przez <b>NFS<\/b> do innego noda, gdzie postfix poprzez delivera b\u0119dzie zapisywa\u0142 wiadomo\u015bci do skrzynek. Jak wida\u0107 w <a href=\"http:\/\/www.drfugazi.eu.org\/pl\/solaris-10\/04-kontenery-solaris-zones\/0401-instalacja-kontenera-st1\">tym zapisie sesji<\/a>, skonfigurowa\u0142em ca\u0142\u0105 <b>zpool<\/b>e &#8220;studmail&#8221; jako <b>dataset ZFS<\/b> dla <b>kontenera st1<\/b>. Niestety w prosty spos\u00f3b nie da si\u0119 wsp\u00f3\u0142dzieli\u0107 systemu plik\u00f3w <b>ZFS<\/b> przez <b>NFS<\/b> w kontenerze (non-global):<\/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>Zdecydowa\u0142em si\u0119 wi\u0119c przekonfigurowa\u0107 kontener aby u\u017cywa\u0142 <b>lofs<\/b> zamiast ca\u0142ego <b>dataset<\/b>u, ale najpierw trzeba zmieni\u0107 punkty montowania:<\/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>Teraz mo\u017cna zatrzyma\u0107 i przekonfigurowa\u0107 kontener:<\/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>Usuni\u0119cie datasetu (je\u015bli jest wi\u0119cej ni\u017c jeden, to nale\u017cy poda\u0107 nazw\u0119 tego, kt\u00f3ry chcemy usun\u0105\u0107):<\/p>\n<pre>\r\nzonecfg:st1> remove dataset\r\n<\/pre>\n<p>Dodanie system\u00f3w plik\u00f3w <b>ZFS<\/b> jako <b>lofs<\/b>:<\/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, ale katalogi s\u0105 puste. Dlaczego? Sprawd\u017amy w\u0142a\u015bciwo\u015b\u0107 <b>zoned<\/b> w datasecie:<\/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>Zatem systemy plik\u00f3w s\u0105 zamontowane, ale nie wida\u0107 ich zawarto\u015bci w strefie globalnej. Trzeba to zmieni\u0107:<\/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>Ci\u0105gle pusto (lub nie ma katalogu)? Najprostsze wyj\u015bcie to wyeksportowa\u0107 i zaimportowa\u0107 zpool\u0119:<\/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>My\u015bl\u0119, \u017ce mo\u017cna uruchomi\u0107 kontener:<\/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>Teraz mo\u017cna ju\u017c wyeksportowa\u0107 system plik\u00f3w przez <b>NFS<\/b> ze strefy globalnej:<\/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>UWAGA: W tym przyk\u0142adzie nie bra\u0142em pod uwag\u0119 kwestii bezpiecze\u0144stwa eksportowanego przez NFS zasobu, prosz\u0119 zajrze\u0107 do dokumentacji NFS aby dobra\u0107 odpowiednie opcje!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Poniewa\u017c konfiguruj\u0119 system pocztowy, potrzebuj\u0119 wyeksportowa\u0107 filesystem <b>ZFS<\/b> przez <b>NFS<\/b> do innego noda, gdzie postfix poprzez delivera b\u0119dzie zapisywa\u0142 wiadomo\u015bci do skrzynek. Jak wida\u0107 w <a href=\"http:\/\/www.drfugazi.eu.org\/pl\/solaris-10\/04-kontenery-solaris-zones\/0401-instalacja-kontenera-st1\">tym zapisie sesji<\/a>, skonfigurowa\u0142em ca\u0142\u0105 <b>zpool<\/b>e &#8220;studmail&#8221; jako <b>dataset ZFS<\/b> dla <b>kontenera st1<\/b>. Niestety w prosty spos\u00f3b nie da si\u0119 wsp\u00f3\u0142dzieli\u0107 systemu plik\u00f3w <b>ZFS<\/b> przez <b>NFS<\/b> w kontenerze (non-global):<\/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":[30,9,32],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7M9Tz-3r","jetpack-related-posts":[{"id":212,"url":"https:\/\/drfugazi.eu.org\/en\/how-remove-dataset-solaris-zone-and-mount-it-lofs\/","url_meta":{"origin":213,"position":0},"title":"How to remove dataset from Solaris zone and mount it as lofs","author":"drfugazi","date":"Tuesday August 17th, 2010","format":false,"excerpt":"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 this installation transcript I configured whole zpool \"studmail\" as ZFS dataset for zone st1. Unfortunatelly, you can not simply\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":200,"url":"https:\/\/drfugazi.eu.org\/en\/0401-instalacja-kontenera-st1\/","url_meta":{"origin":213,"position":1},"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":202,"url":"https:\/\/drfugazi.eu.org\/en\/0401-installation-container-st1\/","url_meta":{"origin":213,"position":2},"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":237,"url":"https:\/\/drfugazi.eu.org\/en\/usuwanie-starych-i-tworzenie-nowych-snapshotow-zfs\/","url_meta":{"origin":213,"position":3},"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":345,"url":"https:\/\/drfugazi.eu.org\/en\/usuwanie-starych-i-tworzenie-nowych-snapshotow-zfs\/","url_meta":{"origin":213,"position":4},"title":"Usuwanie starych i tworzenie nowych snapshot\u00f3w ZFS","author":"","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":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":235,"url":"https:\/\/drfugazi.eu.org\/en\/masowe-snapshoty-zfs-2\/","url_meta":{"origin":213,"position":5},"title":"Masowe snapshoty ZFS","author":"drfugazi","date":"Monday January 10th, 2011","format":false,"excerpt":"ZFS to taki fajny filesystem, w kt\u00f3rym szybko mo\u017cna zrobi\u0107 migawk\u0119 (snapshot). Na przyk\u0142ad maj\u0105c ZFS o nazwie tank, robimy snapshot o nazwie snap1: # zfs snapshot tank@snap1 Za\u0142atwione, operacja szybka i bezbolesna. Ale jak w systemie jest kilka zpool i na ka\u017cdej kilka filesystem\u00f3w ZFS to ju\u017c trzeba by\u2026","rel":"","context":"In &quot;Oneliners&quot;","block_context":{"text":"Oneliners","link":"https:\/\/drfugazi.eu.org\/en\/category\/oneliners\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts\/213"}],"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=213"}],"version-history":[{"count":0,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"wp:attachment":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}