blockdev
Quick Reference
Command Name:
blockdev
Category:
disk management
Platform:
linux
Basic Usage:
Common Use Cases
Syntax
blockdev [options] [commands] device
Options
Option | Description |
---|---|
--report | Print a report for specified (or all) devices |
--getsz | Get size in 512-byte sectors |
--getsize | Get size in 512-byte sectors (same as --getsz) |
--getsize64 | Get size in bytes |
--getro | Get read-only status (1 if read-only, 0 if read-write) |
--setro | Set read-only |
--setrw | Set read-write |
--getbsz | Get block size in bytes |
--setbsz BYTES | Set block size in bytes |
--getss | Get logical sector size in bytes |
--getpbsz | Get physical block (sector) size in bytes |
--getioopt | Get optimal I/O size in bytes |
--getra | Get readahead in 512-byte sectors |
--setra SECTORS | Set readahead |
--flushbufs | Flush buffers |
--rereadpt | Reread partition table |
--getdiscardzeroes | Get discard zeroes support status |
-V, --version | Display version information and exit |
-h, --help | Display help information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the blockdev
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Get the size of a block device in bytes blockdev --getsize64 /dev/sda