4 Answers
4

I think you might be able to accomplish what you want using network block devices (NBD). Looking at the wikipedia page on the subject there is mention of a tool called nbd. It's comprised of a client and server component.

Example

In this scenario I'm setting up a CDROM on my Fedora 19 laptop (server) and I'm sharing it out to an Ubuntu 12.10 system (client).

One alternative to nbd (if you're interested) is using iSCSI. tgtd can be configured to have a /dev device as its backing storage for a particular iSCSI IQN.

You're probably on a RHEL system so you just need to install scsi-target-utils and then configure/start tgtd on the source system. Configuration of tgtd can get involved but Red Hat provides plenty of different examples for the various scenarios.

The iSCSI LUN's will then present to the system as regular block devices. On RHEL, you can check the transport a particular device is coming over you can just do an ls -l /dev/disk/by-path | grep iscsi to see what storage is coming over iSCSI. The path will also list the IQN of the target you logged into above.

I would, but I don't really have an Ubuntu system handy to ensure the package names are the same or if the configuration examples I referenced are upstream or just something Red Hat does. The configuration itself should be the same, though.
–
BratchleyMar 12 '14 at 16:54

Although this solution works, it is presented only as a method to show that TMWTDI.

For this setup we need a unix inspired system to host the block device, and a system with a loop back block device for the system to view it. Linux will work for both.

Next we need a dumb network file system (it must not make optimizations of the data storage), like samba or webdav. Specifically NFS, and AFS will not work.

Place the block device in a folder that is exported. (man mknod will help.) disable block device checking if applicable. mount the exported filesystem on the client computer, create a loop device using the imported file as it's backing store and mount as normal. (losetup or mount -o loop)

How and why it works, and why the performance sucks: One of the core ideas behind unix is that everything is a file, so devices are files only they are a little special (that is why they are called special files). There are several types of special files that mknod can produce, but we are only going to look at block devices. block devices exist in the file system like any other file and like any other file they have owners, permissions, inodes and names; but they have two differences: they do not store their data in the filesystem, and they have extra capabilities so they can be mounted. If the file server is dumb enough not to pay attention to these differences, you can ignore them and export them as regular files. Next the loop device takes an ordinary file (local or remote) and adds the special properties and capabilities so that you can mount regular files as if they are block devices. The big drawback is performance.