lsblk
lsblk
- Run
lsblk
to get a list of all storage devices and their partitions - To get all disks and partitions, with helpful information to identify drives besides their
sdX
IDs, use grep or sed to search for "disk" and "part"lsblk -o NAME,UUID,PARTUUID,TYPE,PATH,SERIAL | grep 'disk\|part'
lsblk -o NAME,UUID,PARTUUID,TYPE,PATH,SERIAL | sed -n '1p;/disk\|part/p'
List of options for -o
After 30 seconds of searching for a complete list of variables you can pick from, I gave up and asked ChatGPT to create the list below, so keep that in mind if something doesn't work.
Generally Useful
- NAME: Device name.
- KNAME: Internal kernel device name.
- PATH: Path to the device node.
- MAJ:MIN: Major and minor device number.
- FSAVAIL: Filesystem size available.
- FSSIZE: Filesystem size.
- FSTYPE: Filesystem type.
- FSUSED: Filesystem size used.
- FSUSE%: Filesystem use percentage.
- FSVER: Filesystem version.
- UUID: Filesystem UUID.
- PARTFLAGS: Partition flags.
- PARTLABEL: Partition label.
- PARTTYPE: Partition type code or UUID.
- PARTUUID: Partition UUID.
- PKNAME: Internal parent kernel device name.
- PTTYPE: Partition table type.
- PTUUID: Partition table identifier (usually UUID).
- LABEL: Filesystem label.
- SIZE: Size of the device.
- STATE: State of the device.
- OWNER: Owner of the device.
- GROUP: Group name.
- MODE: Device node permissions.
- TYPE: Device type (e.g., disk, partition).
- MOUNTPOINT: Where the device is mounted.
- MOUNTPOINTS: All locations where device is mounted.
Specialty Items
- ALIGNMENT: Alignment offset.
- DISC-ALN: Discard alignment offset.
- DAX: DAX-capable device.
- DISC-GRAN: Discard granularity.
- DISC-MAX: Discard max bytes.
- DISC-ZERO: Discard zeroes data.
- HCTL: Stands for Host:Channel:Target
- for SCSI.
- HOTPLUG: Removable or hotplug device status.
- LOG-SEC: Logical sector size.
- MIN-IO: Minimum I/O size.
- MODEL: Device identifier.
- OPT-IO: Optimal I/O size.
- RA: Read-ahead of the device.
- RAND: Adds randomness.
- REV: Device revision.
- RM: Removable device.
- RO: Read-only status.
- ROTA: Rotational device (1 if rotational).
- RQ-SIZE: Request queue size.
- SCHED: I/O scheduler name.
- SERIAL: Disk serial number.
- START: Partition start offset.
- SUBSYSTEMS: Chain of subsystems.
- TRAN: Device transport type.
- VENDOR: Device vendor.
- WSAME: Write same max bytes.
- WWN: Unique storage identifier.
- ZONED: Zoned device type.
- ZONE-SZ: Zone size.
- ZONE-WGRAN: Zone write granularity.
- ZONE-APP: Zone append max bytes.
- ZONE-NR: Number of zones.
- ZONE-OMAX: Maximum number of open zones.
- ZONE-AMAX: Maximum number of active zones.