Faster network sharing than NFS

Q I've been using NFS between two boxes but have noticed that it's not the fastest transport in the world. Is there anything else you can recommend?

A Indeed, there's a great project that has developed something called the Network Block Device ( It's something that has been compiled into the kernel for some time now and essentially presents a remote filesystem as a local device. The only downside is that you can only have it mounted read/write by one machine. Assuming that this wouldn't cause you any problems, I'd suggest you give Network Block Device a go - it's much faster than NFS and is really straightforward to configure. First of all, because NBD uses a file rather than a directory as its device you need to create a file to the size you require. To create a 1GB NBD you can do the following on the server:

Dd if=/dev/zero of=/mnt/nbd-drive bs=1gb count=1

This will create a 1GB file as /mnt/remote. Next up you need to tell the NBD server to start up, listen to a certain port and use the file we just created. In this example we are using port 1077:

nbd-server 1077 /mnt/ndb-drive

Once this is done, ensure the nbd-client module is loaded on the client machine:

modprobe nbd.o
nbd=client 1077 /dev/nd0

Obviously you need to replace the IP given here with that of your server. You can use any filesystem you want to with NBD - because this is the first time we have accessed it, we'll format it ext2:

mke2fs /dev/nd0

And finally we can mount it:

mount -text2 /dev/nd0 /mnt/nbd-drive

If your server has multiple network cards you can start NBD on multiple ports to provide extra capacity or resilience:

nbd-server 1077 1078 1079 1080 /mnt/ndb-drive

And then on the client you can specify multiple IPs and ports:

nbd-client 1077 1078 1079 1080 /dev/nda

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar