A totally proof-of-concept FoundationDB based network block device backend
I wanted to play around with FoundationDB a bit more and building a network block device (NBD) backend seemed like a good fit for that.
Do not use this in production, unless you like data loss, kernel crashes and you don't mind if your house burns down.
If you're interested in a more serious implementation, have a look at https://github.com/spullara/nbd.
fdb-nbd.py
. It will start a local TCP server on port 10809 (default NBD port).nbd
kernel module.nbd-client -N example 127.0.0.1 /dev/nbd0
. This will initialize the network block device /dev/nbd0
and point it to the started python server./dev/nbd0
with any filesystem and mount it.nbd-client -d /dev/nbd0
to disconnect the block device from the serverexample
got selected with the -N
argument of nbd-client
. Have a look at the source code of fdb-nbd.py
to see how this is initialized.nbd-client -l 127.0.0.1
1024
. Each block is stored in its own FoundationDB key ('dev', 'example', 'blocks', block_nr)
. Partial reads or writes of blocks are not supported.sync
and flushing the cache echo 3 > /proc/sys/vm/drop_caches
for maximum effect.nbd-client
. The kernel can be a bit sensitive about this. I've had unkillable processes as a result and a kernel OOPS. You have been warned.