{"id":344,"date":"2023-05-13T21:04:15","date_gmt":"2023-05-13T19:04:15","guid":{"rendered":"https:\/\/rizzus.tech\/?p=344"},"modified":"2023-05-13T21:04:15","modified_gmt":"2023-05-13T19:04:15","slug":"proxmox-back-server-iscsi-automate-setup-for-datastore","status":"publish","type":"post","link":"https:\/\/rizzus.tech\/?p=344","title":{"rendered":"Proxmox Back Server ISCSI Automate Setup For Datastore"},"content":{"rendered":"<p>From the PBS command line, the following commands were used to test the connectivity between the PBS and iSCSI target and to manually setup ZFS.<\/p>\n<pre class=\"wp-block-preformatted\">iscsiadm -m discovery -t st -p \"ip address Iscsi\"\r\niscsiadm -m node --login\r\niscsiadm -m session -o show<\/pre>\n<p>&#8220;target iscsi take in session show&#8221; es. : iqn.2004-04.com.qnap:ts-431&#215;2:iscsi.qnap.3b0505<\/p>\n<p>&#8220;ip address Iscsi&#8221; es. : 192.168.200.24<\/p>\n<p>If successful, then setup the ZFS pool. Determine the disk using\u00a0<strong>fdisk -l<\/strong>. I have determined that<strong> \/dev\/sda<\/strong>\u00a0was the one to use.<\/p>\n<pre class=\"wp-block-preformatted\">zpool create -f \"name of folder you want\" \/dev\/sda\r\nzpool list<\/pre>\n<p>After the ZFS is setup, you should be able to access\u00a0<strong>\/&#8221;folder created&#8221;<\/strong>\u00a0from your system. Make note of the iSCSI connections, you\u2019ll need them later.<\/p>\n<p><strong>Reboot.<\/strong> This will remove the iSCSI and make it easier to setup the iSCSI connections permanently.<\/p>\n<p><strong>After Reboot. <\/strong>Automatically start the iSCSI requires the following two commands and a modification to a config file.<\/p>\n<pre class=\"wp-block-preformatted\">iscsiadm --mode node -T \"target iscsi take in session show\" -p \"ip address Iscsi\" -o update -n node.startup -v automatic\r\niscsiadm --mode node -T \"target iscsi take in session show\" -p \"ip address Iscsi\" -o update -n node.conn[0].startup -v automatic\r\nsed -i '\/^node.startup = \/s\/manual\/automatic\/g' \/etc\/iscsi\/iscsid.conf\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Determine the disk for setup ZFS<\/p>\n<pre class=\"wp-block-preformatted\">systemctl list-units --all --full | grep disk | grep \"ip address Iscsi\"\r\n<\/pre>\n<p>Use the disk information you determined above for create zfs service at Start up<\/p>\n<pre class=\"wp-block-preformatted\">cat &lt;&lt; 'EOF' &gt; \/etc\/systemd\/system\/pbsbks-pool.service\r\n[Unit]\r\nAfter=dev-disk-by\\x2dpath-ip\\x2d\"ip address Iscsi\":3260\\x2discsi\\x2discsi\\x2diqn.2004\\x2d04.com.qnap:ts\\x2d431x2:iscsi.qnap.3b0505\\x2dlun\\x2d0.device\r\n \r\n[Service]\r\nExecStart=\/usr\/sbin\/zpool import backups\r\nExecStartPost=\/usr\/bin\/logger \"started ZFS pool backups\"\r\n \r\n[Install]\r\nWantedBy=dev-disk-by\\x2dpath-ip\\x2d\"ip address Iscsi\":3260\\x2discsi\\x2discsi\\x2diqn.2004\\x2d04.com.qnap:ts\\x2d431x2:iscsi.qnap.3b0505\\x2dlun\\x2d0.device\r\nEOF\r\n<\/pre>\n<p>insert on shell all box in one shot, copy and past from a text file after insert the correct parameters<\/p>\n<p><strong>Start the service<\/strong><\/p>\n<pre class=\"wp-block-preformatted\">systemctl daemon-reload\r\nsystemctl enable pbsbks-pool\r\nsystemctl restart pbsbks-pool\r\n<\/pre>\n<div class=\"wp-block-image\">\n<figure><\/figure>\n<figure><\/figure>\n<figure class=\"aligncenter\"><a class=\"floatbox\" href=\"https:\/\/it.megocollector.com\/wp-content\/uploads\/2021\/04\/sshot-278.jpg\" rev=\"group:4799\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4801\" src=\"https:\/\/it.megocollector.com\/wp-content\/uploads\/2021\/04\/sshot-278.jpg\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" srcset=\"https:\/\/it.megocollector.com\/wp-content\/uploads\/2021\/04\/sshot-278.jpg 602w, https:\/\/it.megocollector.com\/wp-content\/uploads\/2021\/04\/sshot-278-300x115.jpg 300w\" alt=\"\" width=\"602\" height=\"230\" \/><\/a><\/figure>\n<\/div>\n<p>The next time you reboot your system, the iSCSI will connect and the ZFS pool with be imported and the datastore you create will automatically remain without error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From the PBS command line, the following commands were used to test the connectivity between&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/rizzus.tech\/?p=344\">Read the post<span class=\"screen-reader-text\">Proxmox Back Server ISCSI Automate Setup For Datastore<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":345,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,13,4],"tags":[14],"class_list":["post-344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-proxmox","category-qnap","tag-proxmox","excerpt","zoom","full-without-featured","even","excerpt-0"],"_links":{"self":[{"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/posts\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rizzus.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344"}],"version-history":[{"count":1,"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":346,"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/posts\/344\/revisions\/346"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rizzus.tech\/index.php?rest_route=\/wp\/v2\/media\/345"}],"wp:attachment":[{"href":"https:\/\/rizzus.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rizzus.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rizzus.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}