nbdsh(1) LIBNBD nbdsh(1) (NAME) nbdsh - (NBD) (SYNOPSIS) $ nbdsh Welcome to nbdsh, the shell for interacting with Network Block Device (NBD) servers. The `nbd' module has already been imported and there is an open NBD handle called `h'. nbd> h.connect_command(["nbdkit", "-s", "memory", "1G"]) nbd> h.get_size() 1073741824 nbd> buf = b"hello, world" nbd> h.pwrite(buf, 0) nbd> exit() (DESCRIPTION) nbdsh Python (NBD) . (API) libnbd : help(nbd) libnbd Python libnbd-python(3) . (EXAMPLES) libnbd sh/examples https://gitlab.com/nbdkit/libnbd/tree/master/sh/examples . NBD -u NBD URI . -c Python . (export) NBD : $ nbdsh -u nbd://localhost -c 'print(h.get_size())' 1073741824 (hexdump) NBD -c - Python nbdsh : nbdsh -c - <<'EOF' from subprocess import * h.connect_uri("nbd://localhost") bootsect = h.pread(512, 0) p = Popen("hexdump -C", shell=True, stdin=PIPE) p.stdin.write(bootsect) EOF nbddump(1) hexdump NBD . ( 0x400) 01010101 10101010. ( !) $ nbdkit memory 4096 $ nbdsh -u nbd://localhost -c 'h.pwrite(b"\x55\xAA" * 1024, 0x400)' $ nbddump nbd://localhost 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0400: 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa |U.U.U.U.U.U.U.U.| 0c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| $ killall nbdkit -c Python bytearray ( ) nbd_pwrite(3) . . nbdkit nbdkit(1) nbdkit-memory-plugin(1) . (OPTIONS) -h --help . --base-allocation (meta context) "base:allocation" nbd_block_status_64(3) . "h.set_meta_context(nbd.CONTEXT_BASE_ALLOCATION)" "--uri" ( "-c" ). -c 'COMMAND ...' --command 'COMMAND ...' . . -c - --command - . -n "h" . --opt-mode (option mode) (option negotiation) export . "h.set_opt_mode(True)" "--uri" ( "-c" ). -u URI --uri URI URI NBD. "h.connect_uri(URI)" . "-c" "h.add_meta_context("NAME")" . "--opt-mode" "--base-allocation" . -v --verbose libnbd. "LIBNBD_DEBUG=1" . -V --version . (SEE ALSO) libnbd(3), libnbd-python(3), libnbd-security(3), nbdcopy(1), nbddiscard(1), nbddump(1), nbdfuse(1), nbdinfo(1), nbdublk(1), nbdzero(1), qemu-img(1), nbdkit(1). (AUTHORS) Richard W.M. Jones (COPYRIGHT) Copyright Red Hat (LICENSE) (GNU Lesser General Public License) ( ) / . . . : Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA libnbd-1.24.3 2026-07-16 nbdsh(1)