nbdfuse(1)
π nbdfuse(1) β LIBNBD, but make it make sense π
Okay bestie, this is nbdfuse(1) from LIBNBD. Itβs giving βmount a Network Block Device in the local filesystem,β and honestly? Iconic. No cap. Periodt. π
β¨ NAME β¨
nbdfuse β mount a network block device in the local filesystem.
π¦ SYNOPSIS π¦
There are so many ways to run this thing, and yes, you need all of them β vibe check passed:
nbdfuse [-C N|--connections N] [-d] [--keepalive]
[-o FUSE-OPTION] [-P PIDFILE]
[-r] [-s] [-v|--verbose]
MOUNTPOINT[/FILENAME] URI
nbdfuse MOUNTPOINT[/FILENAME] [ CMD [ARGS ...] ]
nbdfuse MOUNTPOINT[/FILENAME] --command CMD [ARGS ...]
nbdfuse MOUNTPOINT[/FILENAME] --fd N
nbdfuse MOUNTPOINT[/FILENAME] --tcp HOST PORT
nbdfuse MOUNTPOINT[/FILENAME] --unix SOCKET
nbdfuse MOUNTPOINT[/FILENAME] --vsock CID PORT
To unmount:
fusermount3 -u -z MOUNTPOINT
Other options:
nbdfuse --help
nbdfuse --fuse-help
nbdfuse -V|--version
π¦ DESCRIPTION π¦
So nbdfuse mounts a Network Block Device (NBD) in the local filesystem. The NBD virtual file gets mounted at MOUNTPOINT/FILENAME β and if you donβt give it a FILENAME, it defaults to MOUNTPOINT/nbd. Reads and writes to that virtual file are turned into reads and writes to the NBD device. Slay.
Since nbdfuse β₯ 1.6 you can also create a βnakedβ mountpoint by mounting over any regular file called MOUNTPOINT β the existing contents of the file do not matter.
The NBD server itself can be local or remote. You can specify the server as an NBD URI (like nbd://localhost), or as an NBD server running as a subprocess of nbdfuse (using [ ... ]), or in various other ways (see βMODESβ). Options, options, options.
Use fusermount3 -u -z MOUNTPOINT to unmount the filesystem after you have used it.
π EXAMPLES π
πΈ Present a remote NBD server as a local file
If there is a remote NBD server running on example.com at the default NBD port number (10809) then you can turn it into a local file by doing:
$ mkdir dir
$ nbdfuse dir nbd://example.com &
$ ls -l dir/
total 0
-rw-rw-rw-. 1 nbd nbd 1073741824 Jan 1 10:10 nbd
The file is called dir/nbd and you can read and write to it as if it is a normal file. Note that writes to the file will write to the remote NBD server. After using it, unmount it:
$ fusermount3 -u -z dir
$ rmdir dir
π Use nbdkit to create a file backed by a temporary RAM disk
Using [ ... ] you can run an NBD server as a subprocess. In this example nbdkit(1) is used to create a temporary file backed by a RAM disk:
$ mkdir dir
$ nbdfuse dir/ramdisk [ nbdkit --exit-with-parent memory 1G ] &
$ ls -l dir/
total 0
-rw-rw-rw-. 1 nbd nbd 1073741824 Jan 1 10:10 ramdisk
$ dd if=/dev/urandom bs=1M count=100 of=mp/ramdisk conv=notrunc,nocreat
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 2.08319 s, 50.3 MB/s
When you have finished with the RAM disk, you can unmount it as below which will cause nbdkit to exit and the RAM disk contents to be discarded:
$ fusermount3 -u -z dir
$ rmdir dir
π¦ Use qemu-nbd to read and modify a qcow2 file
You can use qemu-nbd(8) as a subprocess to open any file format which qemu understands:
$ mkdir dir
$ nbdfuse dir/file.raw [ qemu-nbd -f qcow2 file.qcow2 ] &
$ ls -l dir/
total 0
-rw-rw-rw-. 1 nbd nbd 1073741824 Jan 1 10:10 file.raw
File dir/file.raw is in raw format, backed by file.qcow2. Any changes made to dir/file.raw are reflected into the qcow2 file. To unmount the file do:
$ fusermount3 -u -z dir
$ rmdir dir
π Use nbdkit to create a local file from a file on a web server
nbdkit(1) is able to both access and transparently uncompress remote disk images on web servers, so you can convert them into virtual files:
$ mkdir dir
$ nbdfuse dir/disk.iso \
[ nbdkit --exit-with-parent \
curl --filter=xz \
http://builder.libguestfs.org/fedora-30.xz ] &
$ ls -l dir/
total 0
-rw-rw-rw-. 1 nbd nbd 6442450944 Jan 1 10:10 disk.iso
$ file dir/disk.iso
dir/disk.iso: DOS/MBR boot sector
$ qemu-system-x86_64 -m 4G \
-drive file=dir/disk.iso,format=raw,if=virtio,snapshot=on
$ fusermount3 -u -z dir
In this example we have used the virtual file to boot qemu, but qemu can much more efficiently access NBD servers directly so in the real world that would be the preferred method. Noted, bestie. Fr fr.
π OPTIONS π
--helpβ Display brief command line help and exit.-C N,--connections Nβ If multi-conn is used, useNconnections to the server. The default is4.
Multi-conn is enabled by default when possible. Modes which run a subprocess, such as --command are not able to use multi-conn. Mode --fd also cannot use multi-conn. Also the server must advertise multi-conn (use nbdinfo(1) to query what the server supports).
See βTHREAD MODELβ below.
-C 1,--connections 1β Disable multi-conn. Only use a single connection to the NBD server. See βTHREAD MODELβ below.--fuse-helpβ Display FUSE options and exit. See-obelow.--keepaliveβ Set the keepalive (SO_KEEPALIVE) flag on the connection. Seenbd_set_keepalive(3)andsocket(7).-o FUSE-OPTIONβ Pass extra options to FUSE. To get a list of all the extra options supported by FUSE, use--fuse-help.
Some potentially useful FUSE options:
-o allow_otherβ Allow other users to see the filesystem. This option has no effect unless you enable it globally in/etc/fuse.conf.-o kernel_cacheβ Allow the kernel to cache files (reduces the number of reads that have to go through thelibnbd(3)API). This is generally a good idea if you can afford the extra memory usage.-o uid=N,-o gid=Nβ Use these options to map UIDs and GIDs.
-P PIDFILE,--pidfile PIDFILEβ Whennbdfuseis ready to serve, write thenbdfuseprocess ID (PID) toPIDFILE. This can be used in scripts to wait untilnbdfuseis ready.
β οΈ Not me telling you this, but: you mustnβt try to killnbdfuse. Usefusermount3 -u -zto unmount the mountpoint which will causenbdfuseto exit cleanly.
-r,--readonlyβ Access the network block device read-only. The virtual file will have read-only permissions, and any writes will return errors.
If the remote NBD server is read-only then this flag is added automatically. (Check is_read_only: field in the output of nbdinfo(1)).
-sβ Use single-threaded FUSE operations. See βTHREAD MODELβ below.-v,--verbose,-dβ Enable verbose messages to stderr. This enableslibnbddebugging and other messages. The-doption is an alias, used for compatibility with other FUSE programs.-V,--versionβ Display the package name and version and exit.
π MODES π
Modes are used to select the NBD server. Possible modes are:
nbdfuse MOUNTPOINT URIβ This mode uses an NBD URI (seenbd_connect_uri(3)andhttps://github.com/NetworkBlockDevice/nbd/blob/master/doc/uri.md). For example this specifies a TLS-encrypted connection toexample.comport10809, with export namedisk:
nbdfuse dir nbds://example.com/disk
nbdfuse MOUNTPOINT [ CMD [ARGS ...] ]β Run an NBD server as a subprocess. In this mode an NBD server can be run directly from the command line withnbdfusecommunicating with the server over a socket. This requires that the NBD server supports systemd socket activation. See βEXAMPLESβ above andnbd_connect_systemd_socket_activation(3).nbdfuse MOUNTPOINT --command CMD [ARGS ...]β Select command mode. In this mode an NBD server can be run directly from the command line withnbdfusecommunicating with the server over the serverβs stdin/stdout. Normally you would use this withnbdkit -s. Seenbd_connect_command(3).nbdfuse MOUNTPOINT --fd Nβ Select file descriptor mode. In this mode a connected socket is passed tonbdfuse.nbdfuseconnects to the socket on the numbered file descriptor. See alsonbd_connect_socket(3).nbdfuse MOUNTPOINT --tcp HOST PORTβ Select TCP mode. Connect to an NBD server on a host and port over an unencrypted TCP socket. See alsonbd_connect_tcp(3).nbdfuse MOUNTPOINT --unix SOCKETβ Select Unix mode. Connect to an NBD server on a Unix domain socket. See alsonbd_connect_unix(3).nbdfuse MOUNTPOINT --vsock CID PORTβ Select vsock mode. Connect to an NBD server on aAF_VSOCKsocket. See alsonbd_connect_vsock(3).
π₯ THREAD MODEL π₯
This section describes how the current version of nbdfuse works. Previous versions worked differently in the past, and future versions may work differently in the future.
nbdfuse is always multithreaded.
nbdfuse will try to open multiple network connections to the NBD server if possible (called βmulti-connβ). This usually improves performance. Some things which disable multi-conn are:
- using
[ CMD ... ]or--commandor--fdmodes - using
-C 1 - the NBD server does not advertise multi-conn (check using
nbdinfo(1))
You can control how many connections are made using the -C flag.
The way that nbdfuse runs one thread per connection to service NBD commands β these are called βoperation threadsβ. In addition, FUSE itself creates multiple threads to deal with requests coming from the fuse.ko kernel module. The number of threads that FUSE can create is described in the FUSE documentation, but with many parallel accesses to the virtual file there may be many more FUSE threads created than operation threads, and this should lead to good performance. FUSE requests (like read, write or trim) are multiplexed on to the operation threads (= connections) at random. Each operation thread can handle multiple requests in parallel.
Using the -s flag makes FUSE run only a single thread, but there may still be multiple operation threads.
πΈ NOTES πΈ
π Loop mounting
It is tempting (and possible) to loop mount the file. However this will be very slow and may sometimes deadlock. Better alternatives are to use nbd-client(8) or qemu-nbd(8), or more securely libguestfs(3), guestfish(1) or guestmount(1) which can all access NBD servers.
π«Ά As a way to access NBD servers
You can use this to access NBD servers, but ngl it is usually better (and definitely much faster) to use libnbd(3) directly instead. To access NBD servers from the command line, look at nbdsh(1). To copy to and from an NBD server use nbdcopy(1). Iykyk.
π COMPARISON TO OTHER TOOLS π
so if youβre wondering how this whole thing stacks up against the other NBD girlies, hereβs the tea ββ¨
β¨ Compared to nbd-client β¨
This program is similar in concept to nbd-client(8) β you know, the one that turns NBD into /dev/nbdX device nodes β except for these iconic differences:
nbd-clientis faster because it uses a special kernel module πnbd-clientrequires root, butnbdfusecan be used by any user π«Ά- nbdfuse virtual files can be mounted anywhere in the filesystem π
- nbdfuse uses
libnbdto talk to the NBD server π₯ - nbdfuse requires FUSE support in the kernel β οΈ
πΈ Compared to qemu-nbd πΈ
qemu-nbd(8) can also attach itself to /dev/nbdX device nodes. The differences from nbdfuse are similar to the list above β same energy, same comparison vibe β¨
π SEE ALSO π
like, go read these too, bestie β theyβre all part of the lore π
libnbd(3),nbdcopy(1),nbddiscard(1),nbddump(1),nbdinfo(1),nbdsh(1),nbdublk(1),nbdzero(1),fusermount3(1),mount.fuse3(8),nbd_connect_uri(3),nbd_connect_command(3),nbd_connect_socket(3),nbd_connect_systemd_socket_activation(3),nbd_connect_tcp(3),nbd_connect_unix(3),nbd_connect_vsock(3),libguestfs(3),guestfish(1),guestmount(1),nbdkit(1),nbdkit-loop(1),qemu-nbd(8),nbd-client(8).
π AUTHORS π
Richard W.M. Jones β yes, thatβs the author, periodt π
π COPYRIGHT π
Copyright Red Hat
π LICENSE π
okay legal bestie, hereβs the full license text β no cuts, no skipping, we keep every word π«Ά
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
and thatβs the whole page, bestie π this iconic manual page is from libnbd-1.25.8, dated 2026-10-13, and yes β itβs nbdfuse(1). slay β¨π
π¦ where this page comes from
- centos-stream 10: nbdfuse 1.25.8-1.el10 Β· LGPL-2.0-or-later AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms