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 separated 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. fdisk provides creating, deleting, listing of partitions. We need to use
sudo in order to get root privileges.
$ sudo fdisk -l
- There is a lot of information from system administrator perspective.
- /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
$ cat /proc/partitions
- /proc/partitions provides information about partitions in a simple manner
- vda1 is a partition
List Partitions with parted
Parted is popular application especially creating, deleting partitions and file systems. We can use parted to list partitions too. We will also use
-l option in order to list partitions.
$ parted -l
Disk information like Model, Sector Size and Partition Table type is also provided.
List Partitions with blkid
blkid is a command which will list block information with the related ID or UUID. This will also print partitions too. We need to provide
sudo command too.
List Partitions with lsblk
lsblk is generally used to get mount points of the partitions but also used to list partitions. This command will list partitions and disk in a tree form.
As we can see that
fedora-swap are partitions created in the
sda. There is also information like partition and disk size, type and mount point.