nbddiscard(1)

πŸ’– nbddiscard(1) β€” the LIBNBD one, bestie πŸ’–

okay so real talk, this is the nbddiscard page from the libnbd crew, and it also covers its twin nbdzero (they're literally the same program wearing different hats, iykyk). Buckle up πŸŽ€


✨ NAME ✨

nbddiscard, nbdzero β€” discard or zero all data on a Network Block Device


πŸ¦‹ SYNOPSIS πŸ¦‹

 nbddiscard [-c|--check] [-z|--zero] [--fast-zero]
            [-q|--quiet] [-v|--verbose] [-y|--yes]
            [-o|--offset OFFSET] [-l|--length LENGTH] NBD-URI

 nbddiscard -V|--version

 nbddiscard -h|--help

 nbdzero [-c|--check] [--fast-zero]
         [-q|--quiet] [-v|--verbose] [-y|--yes]
         [-o|--offset OFFSET] [-l|--length LENGTH] NBD-URI

 nbdzero -V|--version

 nbdzero -h|--help

(spot the difference: nbdzero doesn't take -z, because zeroing is its whole thing πŸ’…)


🌸 DESCRIPTION 🌸

So nbddiscard discards all the data on a Network Block Device (NBD) endpoint. If the server supports it, this frees up the backing storage and makes the device completely sparse β€” like, hollowed out, ghost mode πŸ‘». For example, if an NBD server is running locally on port 10809 you could do:

 $ nbddiscard nbd://localhost
 PERMANENTLY ERASE everything on nbd://localhost bytes 0 - 1073741823
 (y/N)? y

nbdzero is the same thing, except the data gets replaced by allocated, zeroed blocks instead of just vanishing into the void.

⚠️ bestie. ALL data in the discarded or zeroed region is PERMANENTLY ERASED. Not "moved to trash", not "recoverable later", gone. πŸ™ˆ

For information about NBD URIs, see nbd_connect_uri(3).


πŸ’… OPTIONS πŸ’…

  • -c, --check β€” Rather than modify the disk, merely check whether it is already sparse, or with -z that it already reads as zero. Like a vibe check for your disk πŸ” no changes, just gossip.
  • --fast-zero β€” Attempt fast zero (see nbd_can_fast_zero(3)), which implies --zero.

Not all servers support the fast zero flag, but those that do promise that an attempted fast zero operation will either complete more quickly than explicitly writing zeroes to the image, or that it will immediately fail because the operation is not inherently faster. So it's either speeding or it's honest β€” no in-between 🏎️

  • -h, --help β€” Display brief command line help and exit. Your little escape hatch 🫢
  • -l LENGTH, --length LENGTH β€” Instead of discarding to the end of the disk, discard only length bytes. You can use the normal suffixes like "K", "M" etc. Portion control, but for erasure πŸ“
  • -o OFFSET, --offset OFFSET β€” Instead of starting from the beginning of the disk, start at the given offset. You can use the normal suffixes like "K", "M" etc. Pick your starting line ✨
  • -q, --quiet β€” Quiet mode, do not print any warnings. Shhh 🀫
  • -v, --verbose β€” Enable verbose libnbd messages. This has the same effect as setting the environment variable LIBNBD_DEBUG=1. Everything, out loud, all at once πŸ’€
  • -V, --version β€” Display the package name and version and exit.
  • -y, --yes β€” Assume yes to all questions. This will proceed straight to erasing your data. Use this in scripts to avoid interactivity.
πŸ‘‘ fr fr: this is the "skip the safety net" flag. Great in scripts, absolutely feral at a keyboard. Use it on purpose.
  • -z, --zero β€” Zero, instead of discarding. nbdzero is just nbddiscard with -z. Same icon, different setting πŸ’«

🌈 SEE ALSO 🌈

libnbd(3), libnbd-python(3), nbd_connect_uri(3), nbdcopy(1), nbddump(1), nbdfuse(1), nbdinfo(1), nbdsh(1), nbdublk(1), blkdiscard(8), qemu-img(1).

(the whole friend group, go say hi 🫢)


πŸŽ€ AUTHORS πŸŽ€

Richard W.M. Jones


Copyright Red Hat


🧚 LICENSE 🧚

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 one's from libnbd-1.24.4, dated 2026-10-13, and it's giving "erase responsibly" energy. mwah 😘

πŸ“¦ where this page comes from