{
    "content": [
        {
            "type": "text",
            "text": "# blockdev(8) (man)\n\n## TLDR\n\n> Manage, query, and manipulate block devices.\n\n- Print a report for all devices:\n  `sudo blockdev --report`\n- Print a report for a specific device:\n  `sudo blockdev --report {{/dev/sdXY}}`\n- Get the size of a device in 512-byte sectors:\n  `sudo blockdev --getsz {{/dev/sdXY}}`\n- Set read-only:\n  `sudo blockdev --setro {{/dev/sdXY}}`\n- Set read-write:\n  `sudo blockdev --setrw {{/dev/sdXY}}`\n- Flush buffers:\n  `sudo blockdev --flushbufs {{/dev/sdXY}}`\n- Get the physical block size:\n  `sudo blockdev --getpbsz {{/dev/sdXY}}`\n- Set the read-ahead value to 128 sectors:\n  `sudo blockdev --setra 128 {{/dev/sdXY}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** blockdev - call block device ioctls from the command line\n\n**Synopsis:** blockdev [-q] [-v] command [command...] device [device...]\nblockdev --report [device...]\nblockdev -h|-V\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -q | — | — | Be quiet. |\n| -v | — | — | Be verbose. |\n| — | --report | — | Print a report for the specified device. It is possible to give multiple devices. If none is given, all devices which ap |\n| -h | --help | — | Display help text and exit. |\n| -V | --version | — | Print version and exit. |\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (6 lines)\n- **DESCRIPTION** (2 lines)\n- **OPTIONS** (1 lines) — 5 subsections\n  - -q (2 lines)\n  - -v (2 lines)\n  - --report (4 lines)\n  - -h --help (2 lines)\n  - -V --version (2 lines)\n- **COMMANDS** (2 lines) — 18 subsections\n  - --flushbufs (2 lines)\n  - --getalignoff (2 lines)\n  - --getbsz (4 lines)\n  - --getdiscardzeroes (2 lines)\n  - --getfra (2 lines)\n  - --getiomin (2 lines)\n  - --getioopt (2 lines)\n  - --getmaxsect (2 lines)\n  - --getpbsz (2 lines)\n  - --getra (2 lines)\n  - --getro (2 lines)\n  - --getsize64 (2 lines)\n  - --getsize (2 lines)\n  - --getss (2 lines)\n  - --getsz (2 lines)\n  - --rereadpt (13 lines)\n  - --setro (4 lines)\n  - --setrw (2 lines)\n- **AUTHORS** (2 lines)\n- **REPORTING BUGS** (2 lines)\n- **AVAILABILITY** (6 lines)\n\n## Full Content\n\n### NAME\n\nblockdev - call block device ioctls from the command line\n\n### SYNOPSIS\n\nblockdev [-q] [-v] command [command...] device [device...]\n\nblockdev --report [device...]\n\nblockdev -h|-V\n\n### DESCRIPTION\n\nThe utility blockdev allows one to call block device ioctls from the command line.\n\n### OPTIONS\n\n#### -q\n\nBe quiet.\n\n#### -v\n\nBe verbose.\n\n#### --report\n\nPrint 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\n#### -h --help\n\nDisplay help text and exit.\n\n#### -V --version\n\nPrint version and exit.\n\n### COMMANDS\n\nIt is possible to give multiple devices and multiple commands.\n\n#### --flushbufs\n\nFlush buffers.\n\n#### --getalignoff\n\nGet alignment offset.\n\n#### --getbsz\n\nPrint 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\n#### --getdiscardzeroes\n\nGet discard zeroes support status.\n\n#### --getfra\n\nGet filesystem readahead in 512-byte sectors.\n\n#### --getiomin\n\nGet minimum I/O size.\n\n#### --getioopt\n\nGet optimal I/O size.\n\n#### --getmaxsect\n\nGet max sectors per request.\n\n#### --getpbsz\n\nGet physical block (sector) size.\n\n#### --getra\n\nPrint readahead (in 512-byte sectors).\n\n#### --getro\n\nGet read-only. Print 1 if the device is read-only, 0 otherwise.\n\n#### --getsize64\n\nPrint device size in bytes.\n\n#### --getsize\n\nPrint device size (32-bit!) in sectors. Deprecated in favor of the --getsz option.\n\n#### --getss\n\nPrint logical sector size in bytes - usually 512.\n\n#### --getsz\n\nGet size in 512-byte sectors.\n\n#### --rereadpt\n\nReread 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\n#### --setro\n\nSet 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\n#### --setrw\n\nSet read-write.\n\n### AUTHORS\n\nblockdev was written by Andries E. Brouwer and rewritten by Karel Zak.\n\n### REPORTING BUGS\n\nFor bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n\n### AVAILABILITY\n\nThe 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)\n\n"
        }
    ],
    "structuredContent": {
        "command": "blockdev",
        "section": "8",
        "mode": "man",
        "summary": "blockdev - call block device ioctls from the command line",
        "synopsis": "blockdev [-q] [-v] command [command...] device [device...]\nblockdev --report [device...]\nblockdev -h|-V",
        "tldr_summary": "Manage, query, and manipulate block devices.",
        "tldr_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}}"
            }
        ],
        "tldr_source": "official",
        "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": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-q",
                        "lines": 2,
                        "flag": "-q"
                    },
                    {
                        "name": "-v",
                        "lines": 2,
                        "flag": "-v"
                    },
                    {
                        "name": "--report",
                        "lines": 4,
                        "long": "--report"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "COMMANDS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "--flushbufs",
                        "lines": 2,
                        "long": "--flushbufs"
                    },
                    {
                        "name": "--getalignoff",
                        "lines": 2,
                        "long": "--getalignoff"
                    },
                    {
                        "name": "--getbsz",
                        "lines": 4,
                        "long": "--getbsz"
                    },
                    {
                        "name": "--getdiscardzeroes",
                        "lines": 2,
                        "long": "--getdiscardzeroes"
                    },
                    {
                        "name": "--getfra",
                        "lines": 2,
                        "long": "--getfra"
                    },
                    {
                        "name": "--getiomin",
                        "lines": 2,
                        "long": "--getiomin"
                    },
                    {
                        "name": "--getioopt",
                        "lines": 2,
                        "long": "--getioopt"
                    },
                    {
                        "name": "--getmaxsect",
                        "lines": 2,
                        "long": "--getmaxsect"
                    },
                    {
                        "name": "--getpbsz",
                        "lines": 2,
                        "long": "--getpbsz"
                    },
                    {
                        "name": "--getra",
                        "lines": 2,
                        "long": "--getra"
                    },
                    {
                        "name": "--getro",
                        "lines": 2,
                        "long": "--getro"
                    },
                    {
                        "name": "--getsize64",
                        "lines": 2,
                        "long": "--getsize64"
                    },
                    {
                        "name": "--getsize",
                        "lines": 2,
                        "long": "--getsize"
                    },
                    {
                        "name": "--getss",
                        "lines": 2,
                        "long": "--getss"
                    },
                    {
                        "name": "--getsz",
                        "lines": 2,
                        "long": "--getsz"
                    },
                    {
                        "name": "--rereadpt",
                        "lines": 13,
                        "long": "--rereadpt"
                    },
                    {
                        "name": "--setro",
                        "lines": 4,
                        "long": "--setro"
                    },
                    {
                        "name": "--setrw",
                        "lines": 2,
                        "long": "--setrw"
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 6,
                "subsections": []
            }
        ]
    }
}