# info > BLOCKDEV

---
type: CommandReference
command: blockdev
mode: man
section: 8
source: man-pages
---

## Quick Reference

- `blockdev --getsz /dev/sda` — get size in 512-byte sectors
- `blockdev --getsize64 /dev/sda` — get device size in bytes
- `blockdev --getra /dev/sda` — get readahead in 512-byte sectors
- `blockdev --setra 256 /dev/sda` — set readahead
- `blockdev --getbsz /dev/sda` — get blocksize
- `blockdev --flushbufs /dev/sda` — flush buffers
- `blockdev --getro /dev/sda` — check if read-only
- `blockdev --report` — print report for all devices

## Name

blockdev — call block device ioctls from the command line

## Synopsis

blockdev [-q] [-v] command [command...] device [device...]
blockdev --report [device...]
blockdev -h|-V
## Options

### General Options

- `-q` — be quiet
- `-v` — be verbose
- `--report` — print a report for the specified device(s). If none given, all devices from /proc/partitions are shown. Note: partition StartSec is in 512-byte sectors.
- `-h, --help` — display help text and exit
- `-V, --version` — print version and exit

### Commands

Multiple devices and multiple commands may be given.

- `--flushbufs` — flush buffers
- `--getalignoff` — get alignment offset
- `--getbsz` — print the blocksize in bytes. This size does not describe device topology; it's the size used internally by the kernel and may be modified by filesystem driver on mount.
- `--getdiscardzeroes` — get discard zeroes support status
- `--getfra` — get filesystem readahead in 512-byte sectors
- `--getiomin` — get minimum I/O size
- `--getioopt` — get optimal I/O size
- `--getmaxsect` — get max sectors per request
- `--getpbsz` — get physical block (sector) size
- `--getra` — print readahead (in 512-byte sectors)
- `--getro` — get read-only. Print 1 if read-only, 0 otherwise.
- `--getsize64` — print device size in bytes
- `--getsize` — print device size (32-bit) in sectors. Deprecated; use `--getsz`.
- `--getss` — print logical sector size in bytes (usually 512)
- `--getsz` — get size in 512-byte sectors
- `--rereadpt` — reread partition table
- `--setbsz bytes` — set blocksize. Note: block size is specific to the file descriptor opening the device; change persists only while blockdev holds the device open.
- `--setfra sectors` — set filesystem readahead (same as `--setra` on 2.6 kernels)
- `--setra sectors` — set readahead (in 512-byte sectors)
- `--setro` — set read-only. Currently active access (e.g., mounted filesystem) may not be affected; change applies after remount.
- `--setrw` — set read-write