GNBD on Debian installation howto


GNBD is some kind of alternative to iSCSI and to a (much) lower extent to sshfs or other filesharing systems (NFS, Samba, etc.).

Unlike iSCSI, there’s no authentication or such, I invite you to read the documentation to learn more about GNBD.

Server ( :

Optional : Create a test filesystem

dd if=/dev/zero of=/home/disk bs=1M count=1000 losetup -f (find the next available loop device) losetup /dev/loop0 /home/disk mkfs.ext3 -j /dev/loop0

Install GNBD on the server and start :

apt-get install gnbd-server /etc/init.d/gnbd-server start or gnbd-server -n

Export the device :

gnbd_export -d /dev/loop0 -e DISK -c

Replace /dev/loop0 by any device on your system you want to share (eg : /dev/sda2). DISK will be the name of the exported device.

List the current exported drives :



Install GNBD on the client ( :

apt-get install gnbd-client redhat-cluster-modules-2.6.26-2-686 (pick the package matching your architecture)

modprobe gnbd

List exports on the server from the client :

gnbd_import -e -n

Create the device for the shared drive on the client :

gnbd_import -i -n

This will result in a new device available under /dev/gnbd/DISK

Mount the device :

mount /dev/gnbd/DISK /mnt/DISK

Done !

Sources :

Linux Magazine France118 and Vincent ;-)

Thanks for reading this post!

If you found an issue in this article, you can create an issue on Github.

If you have a comment or question, please drop me a line below!