{"id":301,"date":"2021-03-14T17:18:59","date_gmt":"2021-03-14T17:18:59","guid":{"rendered":"https:\/\/www.aixperts.co.uk\/?p=301"},"modified":"2021-03-14T17:38:51","modified_gmt":"2021-03-14T17:38:51","slug":"ndb-network-block-device-setup","status":"publish","type":"post","link":"https:\/\/www.aixperts.co.uk\/?p=301","title":{"rendered":"NDB &#8211; Network Block Device setup"},"content":{"rendered":"\n<p>I have been trying to setup NBD to present a shared storage device for me to play around with Xen live mobility. NBD is not tricky, but the documentation, both official and Google, is flawed and confusing.<\/p>\n\n\n\n<p>To get a basic device working and mounted, follow the simple guide below.<\/p>\n\n\n\n<p>Setup a basic config file \/etc\/nbd-server\/config <\/p>\n\n\n\n<p><code>[generic]<br>   user = nbd<br>   group = nbd<br>   listenaddr = 2021:85b:2d9:1::101<br>   allowlist = true<\/code><\/p>\n\n\n\n<p><code>[grafana-root]<br>   exportname = \/dev\/rootvg\/nbdlv<\/code><\/p>\n\n\n\n<p><code>allowlist<\/code> is not stricly necessary, but it helps being able to list exported devices from the client end whilst configuring all this. Maybe remove it afterwards&#8230;<\/p>\n\n\n\n<p>The main thing to take note of in the server configuration is the section <em>heading<\/em> which contains the device on the server to export. The section heading is what the client sees and connects to. Furthermore, the nbd-client man page appears to be incorrect, so go by the nbd-client usage text which says:<\/p>\n\n\n\n<p><code>Usage: nbd-client -name|-N name host [port] nbd_device<\/code><\/p>\n\n\n\n<p>so the correct way to connect to the device exported is:<\/p>\n\n\n\n<p><code>nbd-client 2021:85b:2d9:1::101 10809 \/dev\/nbd0 -N grafana-root<\/code><\/p>\n\n\n\n<p>\/dev\/nbd0 is a device on the <em>client<\/em> which you can choose from amongst what you can see with the listing<code> ls \/dev\/nbd*<\/code>.<\/p>\n\n\n\n<p>From the client, you can see what is exported by the command<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><code>nbd-client -l <code>2021:85b:2d9:1::101<\/code><\/code><\/h1>\n\n\n\n<p><code>Negotiation: ..<br>grafana-root<\/code><\/p>\n\n\n\n<p>If you get the error <\/p>\n\n\n\n<p><code>Error: Cannot open NBD: No such file or directory<br>Please ensure the 'nbd' module is loaded.<br>Exiting.<\/code><\/p>\n\n\n\n<p>you need to load the module for nbd-client: <code>modprobe nbd<\/code><\/p>\n\n\n\n<p>If you get the following error<\/p>\n\n\n\n<p><code>Negotiation: ..Error: Unknown error in reply to NBD_OPT_GO; cannot continue<\/code><\/p>\n\n\n\n<p>Is is because you have missed out the -N option with the share name in the command. Despite this option being mandatory, nbd-client doesn&#8217;t enforce it and the man page doesn&#8217;t even mention the option. Poor form. Or maybe it is because you can specify it in nbdtab, I have not looked in to that.<\/p>\n\n\n\n<p>Generally, nbd is badly documented and has some bugs, not great. But once it is up and running, it is ok.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been trying to setup NBD to present a shared storage device for me to play around with Xen live mobility. NBD is not tricky, but the documentation, both official and Google, is flawed and confusing. To get a &hellip; <a href=\"https:\/\/www.aixperts.co.uk\/?p=301\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[81,83,82,84],"class_list":["post-301","post","type-post","status-publish","format-standard","hentry","category-linux","tag-nbd","tag-nbd-client","tag-nbd-server","tag-network-block-device"],"_links":{"self":[{"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=301"}],"version-history":[{"count":4,"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/301\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/301\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aixperts.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}