date: 2009-06-30 20:42:40+00:00

GNBD on Debian installation howto

categories: - Debian/Ubuntu - Howto - Linux

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 France118 and Vincent ;-)