I am looking through the various *fdisk and *parted utilities along with a few others. I am searching for a utility (or collection of utilities) that will list the size, in bytes, of all of the disks and partitions on a machine. Bonus points for any additional information on the drive or partition such as make/model/label/filesystem. It should also be able to report the size of drives with no partition table installed
- plain fdisk
- ✗ No GUID Partition Table support
- ✗ Not in bytes, no flags to allow for it
- sfdisk
- ✗ No GUID Partition Table support
- ✓ Flag to support Megabytes (close)
- parted
- ✓ Does support GPT
- ! Option to control unit only works on one disk at a time
- ✗ Rounds to largest possible unit
- lshw
- ✗ Doesn't show partition info
- ✗ Rounds to highest unit
- ✗ No option to control units
- pvdisplay / pvs
- ✗ Only works on disks that are part of LVM2 array
- ✗ Doesn't show disk info if partition is volume used in array
- ✓ Does have flags to set unit to bytes
parted
has a command to control units used, and it is called ...unit
:From
man parted
:parted
, while an excellent tool for modifying things, is somewhat deficient when it comes to presentation.lsblk
is much better in this regard, it shows the relationship between the disks, partitions and constructs over the disks (such as RAID or LVM volumes).By default, it does not show labels, and outputs most data without needing
sudo
; however labels needsudo
. To show the disk information in bytes, one can use the-b
option: