{
    "mode": "man",
    "parameter": "blockdev",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/blockdev/8/json",
    "generated": "2026-06-02T22:31:32Z",
    "synopsis": "blockdev [-q] [-v] command [command...] device [device...]\nblockdev --report [device...]\nblockdev -h|-V",
    "sections": {
        "NAME": {
            "content": "blockdev - call block device ioctls from the command line\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "blockdev [-q] [-v] command [command...] device [device...]\n\nblockdev --report [device...]\n\nblockdev -h|-V\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The utility blockdev allows one to call block device ioctls from the command line.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-q",
                    "content": "Be quiet.\n",
                    "flag": "-q"
                },
                {
                    "name": "-v",
                    "content": "Be verbose.\n",
                    "flag": "-v"
                },
                {
                    "name": "--report",
                    "content": "Print a report for the specified device. It is possible to give multiple devices. If none\nis given, all devices which appear in /proc/partitions are shown. Note that the partition\nStartSec is in 512-byte sectors.\n",
                    "long": "--report"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-V --version",
                    "content": "Print version and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "COMMANDS": {
            "content": "It is possible to give multiple devices and multiple commands.\n",
            "subsections": [
                {
                    "name": "--flushbufs",
                    "content": "Flush buffers.\n",
                    "long": "--flushbufs"
                },
                {
                    "name": "--getalignoff",
                    "content": "Get alignment offset.\n",
                    "long": "--getalignoff"
                },
                {
                    "name": "--getbsz",
                    "content": "Print the blocksize in bytes. This size does not describe device topology. It’s the size\nused internally by the kernel and it may be modified (for example) by filesystem driver\non mount.\n",
                    "long": "--getbsz"
                },
                {
                    "name": "--getdiscardzeroes",
                    "content": "Get discard zeroes support status.\n",
                    "long": "--getdiscardzeroes"
                },
                {
                    "name": "--getfra",
                    "content": "Get filesystem readahead in 512-byte sectors.\n",
                    "long": "--getfra"
                },
                {
                    "name": "--getiomin",
                    "content": "Get minimum I/O size.\n",
                    "long": "--getiomin"
                },
                {
                    "name": "--getioopt",
                    "content": "Get optimal I/O size.\n",
                    "long": "--getioopt"
                },
                {
                    "name": "--getmaxsect",
                    "content": "Get max sectors per request.\n",
                    "long": "--getmaxsect"
                },
                {
                    "name": "--getpbsz",
                    "content": "Get physical block (sector) size.\n",
                    "long": "--getpbsz"
                },
                {
                    "name": "--getra",
                    "content": "Print readahead (in 512-byte sectors).\n",
                    "long": "--getra"
                },
                {
                    "name": "--getro",
                    "content": "Get read-only. Print 1 if the device is read-only, 0 otherwise.\n",
                    "long": "--getro"
                },
                {
                    "name": "--getsize64",
                    "content": "Print device size in bytes.\n",
                    "long": "--getsize64"
                },
                {
                    "name": "--getsize",
                    "content": "Print device size (32-bit!) in sectors. Deprecated in favor of the --getsz option.\n",
                    "long": "--getsize"
                },
                {
                    "name": "--getss",
                    "content": "Print logical sector size in bytes - usually 512.\n",
                    "long": "--getss"
                },
                {
                    "name": "--getsz",
                    "content": "Get size in 512-byte sectors.\n",
                    "long": "--getsz"
                },
                {
                    "name": "--rereadpt",
                    "content": "Reread partition table\n\n--setbsz bytes\nSet blocksize. Note that the block size is specific to the current file descriptor\nopening the block device, so the change of block size only persists for as long as\nblockdev has the device open, and is lost once blockdev exits.\n\n--setfra sectors\nSet filesystem readahead (same as --setra on 2.6 kernels).\n\n--setra sectors\nSet readahead (in 512-byte sectors).\n",
                    "long": "--rereadpt"
                },
                {
                    "name": "--setro",
                    "content": "Set read-only. The currently active access to the device may not be affected by the\nchange. For example, a filesystem already mounted in read-write mode will not be\naffected. The change applies after remount.\n",
                    "long": "--setro"
                },
                {
                    "name": "--setrw",
                    "content": "Set read-write.\n",
                    "long": "--setrw"
                }
            ]
        },
        "AUTHORS": {
            "content": "blockdev was written by Andries E. Brouwer and rewritten by Karel Zak.\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 blockdev 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                                  BLOCKDEV(8)",
            "subsections": []
        }
    },
    "summary": "blockdev - call block device ioctls from the command line",
    "flags": [
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": "Be quiet."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "Be verbose."
        },
        {
            "flag": "",
            "long": "--report",
            "arg": null,
            "description": "Print a report for the specified device. It is possible to give multiple devices. If none is given, all devices which appear in /proc/partitions are shown. Note that the partition StartSec is in 512-byte sectors."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print version and exit."
        }
    ],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Manage, query, and manipulate block devices.",
        "examples": [
            {
                "description": "Print a report for all devices",
                "command": "sudo blockdev --report"
            },
            {
                "description": "Print a report for a specific device",
                "command": "sudo blockdev --report {{/dev/sdXY}}"
            },
            {
                "description": "Get the size of a device in 512-byte sectors",
                "command": "sudo blockdev --getsz {{/dev/sdXY}}"
            },
            {
                "description": "Set read-only",
                "command": "sudo blockdev --setro {{/dev/sdXY}}"
            },
            {
                "description": "Set read-write",
                "command": "sudo blockdev --setrw {{/dev/sdXY}}"
            },
            {
                "description": "Flush buffers",
                "command": "sudo blockdev --flushbufs {{/dev/sdXY}}"
            },
            {
                "description": "Get the physical block size",
                "command": "sudo blockdev --getpbsz {{/dev/sdXY}}"
            },
            {
                "description": "Set the read-ahead value to 128 sectors",
                "command": "sudo blockdev --setra 128 {{/dev/sdXY}}"
            }
        ]
    }
}