editorial improvements
[rrq/nbd-mount-helper.git] / README.adoc
1 = nbd-mount-helper
2 :wiki: https://en.wikipedia.org/wiki/Network_block_device
3
4 This project includes mount helpers for `nbd` and `nbdfuse` entries in
5 `/etc/fstab`. The helpers are `bash` scripts that should be installed
6 in `/sbin` to be ued by `mount` to handle the virtual filesystem types
7 `nbd` or `nbdfuse`. (Or installed in `/usr/sbin` for some versions of
8 `mount`)
9
10 == Description
11
12 Quoting                 
13 Wikipedia about
14 link:https://en.wikipedia.org/wiki/Network_block_device[Network Block Device]
15
16 [quote]
17
18 On Linux, network block device (NBD) is a network protocol that can be
19 used to forward a block device (typically a hard disk or partition)
20 from one machine to a second machine. As an example, a local machine
21 can access a hard disk drive that is attached to another computer.
22
23 To do so, a remote machine, say `nbdhost.example.com` is set up as
24 `NBD server` with one or more export names, say including `part000`,
25 that on the server side maps to a partition image or file.
26
27 With a mount helper the client side would include an entry in its
28 `/etc/fstab` for instance like the following:
29 ----
30 nbd://nbdhost.example.com/part000 /nbd/1 nbd noauto,noatime 0 2
31 ----
32 That would declare a mounting of that exported NBD partition onto the
33 (already existsing) pathname `/mnt/1` on the local machine. With the
34 __type__ field of the `fstab` entry being `nbd`, the mount program
35 will use `/sbin/mount.nbd` as helper for handling that entry.
36
37 The helper script `/sbin/mount.nbd` provided here uses the
38 `nbd-client` program to handle the service connection and provide that
39 as a device node such as `/dev/nbd0`. Ths script mounts that device
40 node on `/mnt/1` and spawn a monitor daemon to terminate the service
41 connection upon unmounting. This script needs `inotify`, `nbd-client`
42 and the `nbd` kernel module or built-in to function.
43
44 The helper script `/sbin/mount.nbdfuse` provided here is similar but
45 will rely on `nbdfuse` for service connection and presents that on a
46 `/run` directory (named by a mangling of the remote URL). For this
47 case the `fstab` entry would then have `nbdfuse` as __type__
48 indicator. The helper script mounts the `nbdfuse` "partition" on
49 `/mnt/1` and spawn a monitor daemon to terminate the service
50 connection upon unmounting. This script needs `inotify`, `nbdfuse` and
51 the `fuse` and `loop` kernel modules or built-in to function.