{"id":241,"date":"2015-05-11T12:39:14","date_gmt":"2015-05-11T12:39:14","guid":{"rendered":"https:\/\/edulab.unitn.it\/tecnici\/?p=241"},"modified":"2019-01-10T13:24:02","modified_gmt":"2019-01-10T13:24:02","slug":"proxmox-container-and-nfs","status":"publish","type":"post","link":"https:\/\/edulab.unitn.it\/tecnici\/proxmox-container-and-nfs\/","title":{"rendered":"Proxmox container and NFS"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Procedura valida per Proxmox 3.x.<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">NFS Client<\/h4>\n\n\n\n<p>Comandi per montare un share nfs in un container proxmox<\/p>\n\n\n\n<p>Accedi al server Proxmxo<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vzctl stop CTID\nvzctl set CTID --features \"nfs:on\" --save\nvzctl start CTID\nvzctl exec CTID cat \/proc\/filesystems # verifica che ci siano le righe \"nodev nfs\" e \"nodev nfs4\"\n<\/pre>\n\n\n\n<p>Accedi al Container (via ssh o da proxmox)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ssh [ip container] oppure vzctl enter CTID \napt-get install nfs-common\nnano \/etc\/fstab\n   aggiungi la righa [server]:[export] [mountpoint] nfs rw,noatime,vers=3 0 0\nmount -a\nexit<\/pre>\n\n\n\n<p><strong>Nota:<\/strong> Se al reboot il container non fa il mount in automatico del export nfs metti un mount -a in rc.local<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">NFS server<\/h4>\n\n\n\n<p>Comandi per esportare un share nfs in un container proxmox<\/p>\n\n\n\n<p>Accedi al server Proxmox<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vzctl stop CTID\nvzctl set CTID --features \"nfsd:on\" --save\nvzctl start CTID\nvzctl exec CTID cat \/proc\/filesystems # verifica che ci siano le righe \"nodev nfsd\"<\/pre>\n\n\n\n<p>Accedi al Container (via ssh o da proxmox) e installa e configure l&#8217;export come sempre<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Per Proxmox 4:<\/h3>\n\n\n\n<p>Con l&#8217;aggiornamento a Proxmox 4.x per montare uno share nfs in un lxc puoi seguire due strade:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>creare un profilo separato dai default e aggiungerlo alle macchine che hanno necessit\u00e0 del mount NFS ( per dettagli vedi <a href=\"https:\/\/forum.proxmox.com\/threads\/advice-for-file-sharing-between-containers.25704\/#post-129006\">qui<\/a>)<\/li><li>permettere a tutte le lxc di montare share nfs<\/li><\/ol>\n\n\n\n<p>Nella mia installazione ho scelto di seguire la seconda opzione andando amodificare il file&nbsp;\/etc\/apparmor.d\/lxc\/lxc-default-cgns:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Do not load this file. Rather, load \/etc\/apparmor.d\/lxc-containers, which\n# will source all profiles under \/etc\/apparmor.d\/lxc\n\nprofile lxc-container-default-cgns flags=(attach_disconnected,mediate_deleted) {\n #include &lt;abstractions\/lxc\/container-base&gt;\n\n # the container may never be allowed to mount devpts. If it does, it\n # will remount the host's devpts. We could allow it to do it with\n # the newinstance option (but, right now, we don't).\n deny mount fstype=devpts,\n mount fstype=cgroup -&gt; \/sys\/fs\/cgroup\/**,\n mount fstype=nfs*,\n}<\/pre>\n\n\n\n<p>Aggiungendo la riga mount fstype=nfs* e ricaricando la configurazione<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service apparmor reload<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Proxmox 5.xx<\/h2>\n\n\n\n<p>Le procedure sopra descritte non funzionano pi\u00f9.<\/p>\n\n\n\n<p>Monta la share NFS nella macchina host e poi agganciala al container seguendo le istruzioni descritte qui: <a href=\"https:\/\/edulab.unitn.it\/tecnici\/mount-disco-fisico-in-proxmox-container\/\">https:\/\/edulab.unitn.it\/tecnici\/mount-disco-fisico-in-proxmox-container\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Procedura valida per Proxmox 3.x. NFS Client Comandi per montare un share nfs in un container proxmox Accedi al server Proxmxo vzctl stop CTID vzctl set CTID &#8211;features &#8220;nfs:on&#8221; &#8211;save [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,9],"tags":[],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-how-to","category-linux"],"_links":{"self":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":7,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":832,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts\/241\/revisions\/832"}],"wp:attachment":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/media?parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/categories?post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/tags?post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}