<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
I need to add some temporary storage at my office but am running into issues with nbd-client blocking when accessing the device.  I have very little equiment in that building so I have no real option of upgrading anything.
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Client and server are running the same 2.6.38 kernel and same nbd 3.13.  <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Server config:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
[root@localhost]# cat /etc/nbd-server/config
<div>[generic]</div>
<div><span style="font-family: "Courier New", monospace;"># If you want to run everything as root rather than the nbd user, you</span></div>
<div><span style="font-family: "Courier New", monospace;"># may either say "root" in the two following lines, or remove them</span></div>
<div><span style="font-family: "Courier New", monospace;"># altogether. Do not remove the [generic] section, however.</span></div>
<div><span style="font-family: "Courier New", monospace;">  user = root</span></div>
<div><span style="font-family: "Courier New", monospace;">  group = root</span></div>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace;"># What follows are export definitions. You may create as much of them as</span></div>
<div><span style="font-family: "Courier New", monospace;"># you want, but the section header has to be unique.</span></div>
<div><span style="font-family: "Courier New", monospace;">[nbd001]</span></div>
<div><span style="font-family: "Courier New", monospace;">  exportname = /mnt/nvdata/nbd/nbd001.nbd</span></div>
<div><span style="font-family: "Courier New", monospace;">  readonly = false</span></div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
On the client:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-family: "Courier New", monospace;">[root@localhost]# nbd-client -N "nbd001" 10.1.10.132 /dev/nbd0 -p</span>
<div><span style="font-family: "Courier New", monospace;">Negotiation: ..size = 2048MB</span></div>
<div><span style="font-family: "Courier New", monospace;">bs=1024, sz=2147483648 bytes</span></div>
<div><span style="font-family: "Courier New", monospace;">[root@localhost]# strace -e trace=file dd if=/dev/nbd0 of=/dev/null bs=1024 count=10</span></div>
<div><span style="font-family: "Courier New", monospace;">open("/dev/nbd0", O_RDONLY|O_LARGEFILE  <---- Blocks forever here</span></div>
<div><br>
</div>
<div><br>
</div>
<div>tcpdump shows the occasional packet, but no real stream of data.</div>
<div><br>
</div>
<div>I do this at home all the time with the server running kernel 4.15.0 and nbd 3.16.2.   The client at home is the same 2.6.38 with nbd 3.13.</div>
<div>I've already addressed the issue of max partitions being set to 0 on the clients by hard coding the value in the kernel driver.  The 2.6.38 client is running nbd in the kernel and not a module. 
<br>
</div>
<div><br>
</div>
<div>I have a CentOS 5.2 machine there and tried to run it as a server too.  Same result. 
<br>
</div>
<div><br>
</div>
<div>I've had a lot of success with nbd at home even on a Pi Zero W.  I use it to mimic a Sandisk Cruzer on the OTG, but the "storage chip" of, of that Cruzer,  is really /dev/nbd0.  The Zero W loads a config file from my firewall at boot that tells it what
 nbd image to connect to.  It can be slow at times, but it has eliminated a tack of USB 2.0 sticks I had on my desk.  I can also use dd on my server to create another "stick" instead of running to Wal-Mart when I need one.</div>
<div><br>
</div>
<div><br>
</div>
<br>
</div>
</body>
</html>