How To List All Partitions Of A Disk In Linux
Operating systems use storage or disks to save data persistently. Disks are used with partitions to manage them easily. Generally operating system and data partitions are placed separately. Home directory of the linux is separeted because a problem in the home directory like fulling do no effect to the general system. Modern Linux system use a lot of partitions. And here is the question How can I list partitions exists in my linux system.
List Partitions With fdisk
fdisk is number one tool used by system administrators to manage disk. fidks provides creating, deleting, listing of partitions.
Disk /dev/vda: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000aebb
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 16777215 8387584 83 Linux
- There is a lot of information from system administrator persfective.
- /dec/vda is disk to list partitions
- /dev/vda1 is the partition of the disk
List Partitions with /proc/partitions
We can get more simpler list by using kernel provided information like below
major minor #blocks name
253 8388608 vda
253 1 8387584 vda1
- /proc/partitions provides information about partitions in a simple manner
- vda1 is a partition
List Partitions with parted
Parted is popular probram espacially creating, deleting partitions and file systems. We can use parted to list partitions too.
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 8590MB 8589MB primary xfs boot
List Partitions with blkid
blkid is espacially usefull to get uniq identifiers of partitions but an be used too list partitions
/dev/vda1: UUID="f13d84b4-c756-4d89-9d5e-6b534397aa14" TYPE="xfs"
List Partitions with lsblk
lsblk is generally used to get mount points of the partitions but also used to list parititions.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253: 8G disk
└─vda1 253:1 8G part /