{
    "mode": "man",
    "parameter": "BLKDISCARD",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/BLKDISCARD/8/json",
    "generated": "2026-06-16T11:38:01Z",
    "synopsis": "blkdiscard [options] [-o offset] [-l length] device",
    "sections": {
        "NAME": {
            "content": "blkdiscard - discard sectors on a device\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "blkdiscard [options] [-o offset] [-l length] device\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "blkdiscard is used to discard device sectors. This is useful for solid-state drivers (SSDs)\nand thinly-provisioned storage. Unlike fstrim(8), this command is used directly on the block\ndevice.\n\nBy default, blkdiscard will discard all blocks on the device. Options may be used to modify\nthis behavior based on range or size, as explained below.\n\nThe device argument is the pathname of the block device.\n",
            "subsections": [
                {
                    "name": "WARNING: All data in the discarded region on the device will be lost!",
                    "content": ""
                }
            ]
        },
        "OPTIONS": {
            "content": "The offset and length arguments may be followed by the multiplicative suffixes KiB (=1024),\nMiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the \"iB\" is optional, e.g.,\n\"K\" has the same meaning as \"KiB\") or the suffixes KB (=1000), MB (=1000*1000), and so on for\nGB, TB, PB, EB, ZB and YB.\n",
            "subsections": [
                {
                    "name": "-f --force",
                    "content": "Disable all checking. Since v2.36 the block device is open in exclusive mode (OEXCL) by\ndefault to avoid collision with mounted filesystem or another kernel subsystem. The\n--force option disables the exclusive access mode.\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "-o --offset",
                    "content": "Byte offset into the device from which to start discarding. The provided value must be\naligned to the device sector size. The default value is zero.\n",
                    "flag": "-o",
                    "long": "--offset"
                },
                {
                    "name": "-l --length",
                    "content": "The number of bytes to discard (counting from the starting point). The provided value\nmust be aligned to the device sector size. If the specified value extends past the end of\nthe device, blkdiscard will stop at the device size boundary. The default value extends\nto the end of the device.\n",
                    "flag": "-l",
                    "long": "--length"
                },
                {
                    "name": "-p --step",
                    "content": "The number of bytes to discard within one iteration. The default is to discard all by one\nioctl call.\n",
                    "flag": "-p",
                    "long": "--step"
                },
                {
                    "name": "-s --secure",
                    "content": "Perform a secure discard. A secure discard is the same as a regular discard except that\nall copies of the discarded blocks that were possibly created by garbage collection must\nalso be erased. This requires support from the device.\n",
                    "flag": "-s",
                    "long": "--secure"
                },
                {
                    "name": "-z --zeroout",
                    "content": "Zero-fill rather than discard.\n",
                    "flag": "-z",
                    "long": "--zeroout"
                },
                {
                    "name": "-v --verbose",
                    "content": "Display the aligned values of offset and length. If the --step option is specified, it\nprints the discard progress every second.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "AUTHORS": {
            "content": "Lukas Czerner <lczerner@redhat.com>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "fstrim(8)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The blkdiscard command is part of the util-linux package which can be downloaded from Linux\nKernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                                BLKDISCARD(8)",
            "subsections": []
        }
    },
    "summary": "blkdiscard - discard sectors on a device",
    "flags": [
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "Disable all checking. Since v2.36 the block device is open in exclusive mode (OEXCL) by default to avoid collision with mounted filesystem or another kernel subsystem. The --force option disables the exclusive access mode."
        },
        {
            "flag": "-o",
            "long": "--offset",
            "arg": null,
            "description": "Byte offset into the device from which to start discarding. The provided value must be aligned to the device sector size. The default value is zero."
        },
        {
            "flag": "-l",
            "long": "--length",
            "arg": null,
            "description": "The number of bytes to discard (counting from the starting point). The provided value must be aligned to the device sector size. If the specified value extends past the end of the device, blkdiscard will stop at the device size boundary. The default value extends to the end of the device."
        },
        {
            "flag": "-p",
            "long": "--step",
            "arg": null,
            "description": "The number of bytes to discard within one iteration. The default is to discard all by one ioctl call."
        },
        {
            "flag": "-s",
            "long": "--secure",
            "arg": null,
            "description": "Perform a secure discard. A secure discard is the same as a regular discard except that all copies of the discarded blocks that were possibly created by garbage collection must also be erased. This requires support from the device."
        },
        {
            "flag": "-z",
            "long": "--zeroout",
            "arg": null,
            "description": "Zero-fill rather than discard."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "Display the aligned values of offset and length. If the --step option is specified, it prints the discard progress every second."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "fstrim",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fstrim/8/json"
        }
    ]
}