Update Red Hat Copyright Notices
[nbdkit.git] / docs / nbdkit-client.pod
blobabc5d71aa9a0fe97701d7cf0e043d5cb43503f92
1 =head1 NAME
3 nbdkit-client - how to mount NBD filesystems on a client machine
5 =head1 DESCRIPTION
7 For NBD exports that contain filesystems there are several approaches
8 to mounting them on a client machine.
10 To ensure the nbd kernel module is loaded you may need to do:
12  # echo nbd > /etc/modules-load.d/nbd.conf
14 This will not take effect until you reboot, so also do:
16  # modprobe nbd
18 =head2 Easy mounting at boot time
20 For simple setups the following method is the easiest way to get an
21 NBD filesystem to mount at boot.  Create or edit F</etc/rc.local> or
22 F</etc/rc.d/rc.local>:
24  #!/bin/sh -
25  nm-online
26  modprobe nbd
27  nbd-client server /dev/nbd0
28  mount /dev/nbd0 /mnt
30 =head2 Mounting using systemd mount points
32 You can use systemd mount points to mount NBD filesystems at boot
33 and/or on demand.
35 Set up an L<nbdtab(5)> mapping.  If F</etc/nbdtab> doesn't exist, then
36 create it first.  Add this line:
38  nbd0 server / bs=512,persist
40 As a workaround for
41 L<https://github.com/NetworkBlockDevice/nbd/issues/91> you must
42 currently modify the F<nbd@.service> file:
44  # cp /usr/lib/systemd/system/nbd@.service /etc/systemd/system/
45  # vi /etc/systemd/system/nbd@.service
47 and edit or create these settings in the C<[Service]> section:
49  [Service]
50  Type=oneshot
51  RemainAfterExit=yes
52  ExecStart=/usr/sbin/nbd-client %i
53  ExecStop=/usr/sbin/nbd-client -d /dev/%i
55 Finally create a systemd mount file called
56 F</etc/systemd/system/mnt.mount>:
58  [Unit]
59  Requires=nbd@nbd0.service
60  [Mount]
61  What=/dev/nbd0
62  Where=/mnt
63  Type=ext4
65 You can either reboot now or do:
67  # systemctl start mnt.mount
69 Other systemd services which need this mount point can depend on this
70 mount unit.
72 =head1 SEE ALSO
74 L<nbdkit(1)>,
75 L<nbdkit-loop(1)>,
76 L<nbdkit-service(1)>,
77 L<nbd-client(8)>,
78 L<nbdtab(5)>,
79 L<systemd(1)>,
80 L<systemd.mount(5)>.
82 =head1 AUTHORS
84 Richard W.M. Jones
86 =head1 COPYRIGHT
88 Copyright Red Hat