BLKDISCARD(8) | System Manager's Manual | BLKDISCARD(8) |
blkdiscard
— tool
to discard portions of a device or file
blkdiscard |
[-h ] [-l
length] [-p
chunksize] [-n ]
[-o firstbyte]
[-R ] [-s ]
[-V ] [-v ]
[-z ] file |
fdiscard |
[-f firstbyte]
[-h ] [-l
length] [-m
chunksize] [-n ]
[-R ] [-s ]
[-V ] [-v ]
[-z ] file |
The blkdiscard
program can be used to
discard portions of storage, and works on either device files directly or
upon files inside of a mounted file-system. It provides access to the
fdiscard(2) system call, and
relies upon the backing device to have support in both the
blkdiscard
driver and in the hardware itself.
The fdiscard
interface defaults to the
“no-run” mode and requires the -R
option to perform any actions.
Available options:
-f
firstbyte-h
-l
length-m
chunksize-n
-o
firstbyte-f
flag.-p
chunksize-m
flag.-R
-s
-V
-v
-z
To have a dry-run cleaning of any particular file or device:
# blkdiscard -n -v filename # blkdiscard -n -v /dev/rwd0b
To discard all the blocks on a swap device:
# blkdiscard -v /dev/rwd0b
To discard all but the first 256MiB of a device, using 128MiB increments:
# blkdiscard -v -f 256m -m 128m /dev/rwd0c
To zero out the contents of a file or device:
# blkdiscard -v -z filename # blkdiscard -v -z /dev/device
The blkdiscard
command first appeared
linux-util. This implementation was originally called fdiscard-stuff and has
been converted to be
blkdiscard(8) compatible
and appeared in NetBSD 10.0.
The blkdiscard
command was written by
Matthew R. Green
⟨mrg@eterna23.net⟩.
The secure erase functionality of the -s
option is not yet implemented.
January 13, 2024 | NetBSD 10.99 |