GNBD on Debian installation howto

categories:

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 ;-)




Thanks for reading this post!


Did you find an issue in this article?

- click on the following Github link
- log into Github with your account
- click on the line number containing the error
- click on the "..." button
- choose "Reference in new issue"
- add a title and your comment
- click "Submit new issue"

Your feedback is much appreciated! šŸ¤œšŸ¼šŸ¤›šŸ¼

You can also drop me a line below!