Posted in Debian/Ubuntu Howto Linux
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 (server.example.org) :
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 :
gnbd_export
Client
Install GNBD on the client (client.example.org) :
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 server.example.org -n
Create the device for the shared drive on the client :
gnbd_import -i server.example.org -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 France n° 118 and Vincent
Comments
Sébastien Wains
Haven’t tried that yet unfortunately. If you find out, please let me know
Leave Comment
Please consider visiting the partners below if you enjoyed this article :If this post saved you time and money, please consider checking my Amazon wishlist.







Errorcode408
Hi,
nice Articles you got here!
Do you know if GNDB can be used to get Live Migration working with XEN/VMware which needs shared storage?
Greetings,
Errorcode408