fdisk command line utility is used to view and manage hard disks and partitions on Linux systems.
- Commonly used fdisk commands.
n – Create partition p – print partition table d – delete a partition q – exit without saving the changes w – write the changes and exit.
- Display disk cylinders | View all existing disk partitions | command to list the partitions | View all Disk Partitions in Linux | List Partitions
fdisk -l
- View partitions of a specific hard disk (for example, vda)
fdisk -l /dev/vda
- To get more information detailed and size readable by human of a specific hard disk.
partx -s /dev/vda
- Delete a hard disk partition
If you would like to combine several partitions (for example, /dev/vda2 and /dev/vda3) into a single disk partition, you have to first delete all those individual partitions, as shown below.fdisk /dev/vda
Then
Command (m for help): p
Then
Command (m for help): d
Then
Partition number (1-5): 3
Then
Command (m for help): d
Then
Partition number (1-5): 2
Then
Command (m for help): w
- Create a new disk partition
fdisk /dev/sda
Command (m for help): n
Leave a Reply