How to list disks, partitions and filesystems in Linux?
There are many tools for that, for example fdisk -l
or parted -l
, but probably the most handy is lsblk
(aka list block devices):
Example
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 500M 0 part /boot
└─sda3 8:3 0 237.8G 0 part
├─fedora-root 253:0 0 50G 0 lvm /
├─fedora-swap 253:1 0 2G 0 lvm [SWAP]
└─fedora-home 253:2 0 185.9G 0 lvm
It has many additional options, for example to show filesystems, labels, etc. As always man lsblk
is your friend.
Another way to quickly see the filesystems is the command df. On my machine (Finnish localization) it shows like this:
ptakala@athlon:/mnt$ df
Tiedostojärjestelmä 1K-lohkot Käyt Vapaana Käy% Liitospiste
/dev/root 38317204 19601752 16762352 54% /
devtmpfs 4063816 0 4063816 0% /dev
tmpfs 4097592 81988 4015604 3% /dev/shm
tmpfs 4097592 10120 4087472 1% /run
tmpfs 5120 8 5112 1% /run/lock
tmpfs 4097592 0 4097592 0% /sys/fs/cgroup
/dev/sda9 535267140 287403688 220666804 57% /work
/dev/sda7 288239836 201635356 71956016 74% /home
tmpfs 819520 4 819516 1% /run/user/113
tmpfs 819520 8 819512 1% /run/user/1000
/dev/sda1 39070048 37083304 1986744 95% /mnt/sda1
/dev/sda10 22662140 14032580 8629560 62% /mnt/sda10
/dev/sda5 29280176 20578032 8702144 71% /mnt/sda5
It won't show the file system type, but usually that is non-essential, and you see by one eyedrop everything needed.
human readable sizes:
ptakala@athlon:/mnt$ df -h
Tiedostojärjestelmä Koko Käyt Vapaa Käy% Liitospiste
/dev/root 37G 19G 16G 54% /
devtmpfs 3,9G 0 3,9G 0% /dev
tmpfs 4,0G 89M 3,9G 3% /dev/shm
tmpfs 4,0G 9,9M 3,9G 1% /run
tmpfs 5,0M 8,0K 5,0M 1% /run/lock
tmpfs 4,0G 0 4,0G 0% /sys/fs/cgroup
/dev/sda9 511G 275G 211G 57% /work
/dev/sda7 275G 193G 69G 74% /home
tmpfs 801M 4,0K 801M 1% /run/user/113
tmpfs 801M 8,0K 801M 1% /run/user/1000
/dev/sda1 38G 36G 1,9G 95% /mnt/sda1
/dev/sda10 22G 14G 8,3G 62% /mnt/sda10
/dev/sda5 28G 20G 8,3G 71% /mnt/sda5
The other answers don't show the UUID which is useful to use as reference in boot scripts and configs like /etc/hdparm
. so here:
$ sudo lsblk --output NAME,FSTYPE,LABEL,UUID,MODE
NAME FSTYPE LABEL UUID MODE
sda brw-rw----
├─sda1 ntfs WinHyperX 2D6BFC4E0CDCFAD8 brw-rw----
├─sda2 ext4 HyperX ef761208-bab3-4a26-87d2-ed21a7f5a1bb brw-rw----
└─sda3 swap 74259007-a80b-4866-b059-0bdbe6331040 brw-rw----
sdb brw-rw----
└─sdb1 ext4 4TB 91e32977-0656-45b8-bcf5-14acce39d9c2 brw-rw----
sr0 brw-rw----
mmcblk0 brw-rw----
└─mmcblk0p1 exfat 9C33-6BBC brw-rw----
Other available columns: (see lsblk --help
)
NAME device name
KNAME internal kernel device name
MAJ:MIN major:minor device number
FSTYPE filesystem type
MOUNTPOINT where the device is mounted
LABEL filesystem LABEL
UUID filesystem UUID
RO read-only device
RM removable device
MODEL device identifier
SIZE size of the device
STATE state of the device
OWNER user name
GROUP group name
MODE device node permissions
ALIGNMENT alignment offset
MIN-IO minimum I/O size
OPT-IO optimal I/O size
PHY-SEC physical sector size
LOG-SEC logical sector size
ROTA rotational device
SCHED I/O scheduler name
RQ-SIZE request queue size
TYPE device type
DISC-ALN discard alignment offset
DISC-GRAN discard granularity
DISC-MAX discard max bytes
DISC-ZERO discard zeroes data