Our tool nbdfuse lets you mount an NBD block device as a file, using Linux FUSE. For example you could create a directory with a single file in it (called
nbd) which contains the contents of the NBD export:
$ mkdir /var/tmp/test $ nbdfuse /var/tmp/test --command nbdkit -s memory 1G & $ ls -l /var/tmp/test/ total 0 -rw-rw-rw-. 1 rjones rjones 1073741824 Nov 4 13:25 nbd $ fusermount -u /var/tmp/test
This is cool, but wouldn’t it be nice to get rid of the directory and create the file anywhere? Recently Max Reitz found out you can mount a FUSE filesystem over a regular file.
It works! (After a few adjustments to the nbdfuse code)
$ touch /var/tmp/disk.img $ nbdfuse /var/tmp/disk.img --command nbdkit -s memory 1G & $ ls -l /var/tmp/disk.img -rw-rw-rw-. 1 rjones rjones 1073741824 Nov 4 13:29 /var/tmp/disk.img $ fusermount -u /var/tmp/disk.img