- by x32x01 ||
In this post we are taking a look at some commands that can be used to check up the partitions on your system.
The commands would check what partitions there are on each disk and other details like the total size, used up space and file system etc.
Commands like fdisk, sfdisk and cfdisk are general partitioning tools that can not only display the partition information, but also modify them.
1. fdisk
Fdisk is the most commonly used command to check the partitions on a disk. The fdisk command can display the partitions and details like file system type. However it does not report the size of each partitions.
Each device is reported separately with details about size, seconds, id and individual partitions.
2. sfdisk
Sfdisk is another utility with a purpose similar to fdisk, but with more features. It can display the size of each partition in MB.
3. cfdisk
Cfdisk is a linux partition editor with an interactive user interface based on ncurses. It can be used to list out the existing partitions as well as create or modify them.
Here is an example of how to use cfdisk to list the partitions.
Cfdisk works with one partition at a time. So if you need to see the details of a particular disk, then pass the device name to cfdisk.
4. parted
Parted is yet another command line utility to list out partitions and modify them if needed.
Here is an example that lists out the partition details.
5. df
Df is not a partitioning utility, but prints out details about only mounted file systems. The list generated by df even includes file systems that are not real disk partitions.
Here is a simple example
Only the file systems that start with a /dev are actual devices or partitions.
Use grep to filter out real hard disk partitions/file systems.
To display only real disk partitions along with partition type, use df like this
Note that df shows only the mounted file systems or partitions and not all.
6. pydf
Improved version of df, written in python. Prints out all the hard disk partitions in a easy to read manner.
Again, pydf is limited to showing only the mounted file systems.
7. lsblk
Lists out all the storage blocks, which includes disk partitions and optical drives. Details include the total size of the partition/block and the mount point if any.
Does not report the used/free disk space on the partitions.
If there is no MOUNTPOINT, then it means that the file system is not yet mounted. For cd/dvd this means that there is no disk.
Lsblk is capbale of displaying more information about each device like the label and model. Check out the man page for more information
Display UUID and Model of device
The "-o" option can be used to specify the columns to display. The following example shows the UUID and model name column along with other columns.
The above output has all the necessary information about all the storage devices present on the system or connected via usb. You can see the device name, size, mount point, uuid, model name etc.
This is the best command to see all information about storage devices together in one place.
8. blkid
Prints the block device (partitions and storage media) attributes like uuid and file system type. Does not report the space on the partitions.
9. hwinfo
The hwinfo is a general purpose hardware information tool and can be used to print out the disk and partition list.
The output however does not print details about each partition like the above commands.
10. Inxi
Inxi is a very useful command line program that can display information about various hardware components present on the system. To display information about the disk drives and storage devices use the "-D" option with inxi.
The "-x" option prints extra available information.
The output from inxi does not contains details like UUID and mount directory.
The commands would check what partitions there are on each disk and other details like the total size, used up space and file system etc.
Commands like fdisk, sfdisk and cfdisk are general partitioning tools that can not only display the partition information, but also modify them.
1. fdisk
Fdisk is the most commonly used command to check the partitions on a disk. The fdisk command can display the partitions and details like file system type. However it does not report the size of each partitions.
Each device is reported separately with details about size, seconds, id and individual partitions.
2. sfdisk
Sfdisk is another utility with a purpose similar to fdisk, but with more features. It can display the size of each partition in MB.
3. cfdisk
Cfdisk is a linux partition editor with an interactive user interface based on ncurses. It can be used to list out the existing partitions as well as create or modify them.
Here is an example of how to use cfdisk to list the partitions.
4. parted
Parted is yet another command line utility to list out partitions and modify them if needed.
Here is an example that lists out the partition details.
5. df
Df is not a partitioning utility, but prints out details about only mounted file systems. The list generated by df even includes file systems that are not real disk partitions.
Here is a simple example
Only the file systems that start with a /dev are actual devices or partitions.
Use grep to filter out real hard disk partitions/file systems.
To display only real disk partitions along with partition type, use df like this
Note that df shows only the mounted file systems or partitions and not all.
6. pydf
Improved version of df, written in python. Prints out all the hard disk partitions in a easy to read manner.
Again, pydf is limited to showing only the mounted file systems.
7. lsblk
Lists out all the storage blocks, which includes disk partitions and optical drives. Details include the total size of the partition/block and the mount point if any.
Does not report the used/free disk space on the partitions.
If there is no MOUNTPOINT, then it means that the file system is not yet mounted. For cd/dvd this means that there is no disk.
Lsblk is capbale of displaying more information about each device like the label and model. Check out the man page for more information
Display UUID and Model of device
The "-o" option can be used to specify the columns to display. The following example shows the UUID and model name column along with other columns.
The above output has all the necessary information about all the storage devices present on the system or connected via usb. You can see the device name, size, mount point, uuid, model name etc.
This is the best command to see all information about storage devices together in one place.
8. blkid
Prints the block device (partitions and storage media) attributes like uuid and file system type. Does not report the space on the partitions.
9. hwinfo
The hwinfo is a general purpose hardware information tool and can be used to print out the disk and partition list.
The output however does not print details about each partition like the above commands.
10. Inxi
Inxi is a very useful command line program that can display information about various hardware components present on the system. To display information about the disk drives and storage devices use the "-D" option with inxi.
The "-x" option prints extra available information.
The output from inxi does not contains details like UUID and mount directory.