Re: Setting up NBD server / client - block nbd4: Other side returned error (22) issue
Hi Simon,
On Thu, Jul 22, 2021 at 01:41:00PM +0100, Simon Fernandez wrote:
> Hi folks,
> I’m trying setup a client that connect to a 500Gb ext4 disk on another
> machine running nbd server.
> Server: raspberry pi 3: uname -r 4.19.66+
> Client: raspberry pi 3: uname -r 5.10.17-v7+
> I’ve followed the
> information here [https://github.com/NetworkBlockDevice/nbd] and a lot of
> other sites but I think I’m doing something wrong on the server setup
> because I get this on the client:
> $ sudo mount /dev/nbd2 /home/pi/Vols/nbd1-recipes/
> mount: /home/pi/Vols/nbd1-recipes: can't read superblock on /dev/nbd2
> Also it appears to be listening on default port - NOT ones specified
> in config file.
> This is how I’ve set up the server & client, it’s probably something
> obvious to more experienced folk.
> == rpi-C3 (192.168.1.14) server setup
> > sudo apt-get update
> > sudo apt-get install nbd-server
> > sudo nano /etc/nbd-server/config
> [generic]
> # If you want to run everything as root rather than the nbd user, you
> # may either say "root" in the two following lines, or remove them
> # altogether. Do not remove the [generic] section, however.
> user = nbd
> group = nbd
> includedir = /etc/nbd-server/conf.d
> allowlist = true
> # What follows are export definitions. You may create as much of them as
> # you want, but the section header has to be unique.
> [images]
> exportname = /home/pi/media/500G_FAITH/images
> port = 510029
The per-export port numbers are no longer supported. You should see a
warning about that in syslog when you start nbd-server.
> [recipes]
> exportname = /home/pi/media/500G_FAITH/recipes
> port = 510030
> [movie]
> exportname = /home/pi/media/500G_FAITH/movies
> port = 510031
> > sudo modprobe nbd # NOT nbd-server!
> > lsmod | grep nbd
> nbd 40960 0
> > sudo service nbd-server force-reload # if already running
> == client side
> > sudo apt-get install nbd-client # done
> > sudo modprobe nbd
> > nbd-client 192.168.1.14 -l
> Negotiation: ..
> images
> recipes
> movie
> > sudo nbd-client 192.168.1.14 -N recipes /dev/nbd2
> Negotiation: ..size = 0MB
> Connected /dev/nbd2
> > sudo nbd-client 192.168.1.14 -N movie /dev/nbd3
> Negotiation: ..size = 0MB
> Connected /dev/nbd3
> > sudo nbd-client 192.168.1.14 -N images /dev/nbd1
> Negotiation: ..size = 0MB
> Connected /dev/nbd1
These all show that the export is 0 bytes large.
Do the paths that you point to in the exportname parameters exist? Are
they files? Are they readable and writable by the "nbd" user? Do they
have a non-zero size?
If the answer to any of these is "no", then that's your problem.
Note that you can also have nbd-server create the exported files on the
fly if you specify a wanted size; see the "filesize" parameter for that.
> > dmesg | tail -n 10
> [ 1417.883364] Buffer I/O error on dev nbd1, logical block 0, async page
> read
> [ 1417.884614] block nbd1: Other side returned error (22)
Error 22 is NBD_EINVAL. It is expected that you receive that, if you
connect a zero-sized NBD device, because all reads with a non-zero
offset will go beyond the end of the device, and that is an invalid
request.
Everything else you try returns that error, for the same reason.
[...]
> I’d be very grateful for any pointers, or other resources that my be of
> help.
Hope that helped,
--
w@uter.{be,co.za}
wouter@{grep.be,fosdem.org,debian.org}
Reply to: