A disk is a storage device in a computer. A disk can be optical, magnetic, or optical. Disk partition is the process of dividing disk memory into two or more separate regions so that each region of memory can be managed separately. A partition table is a data structure that provides basic information about the division of the hard disk into primary partitions.
Linux provides few commands which can be used to create and manipulate such disk partitions.
1. fdisk - fdisk, also known as format disk, is a Linux command used for creating and manipulating the disk partition table. It is used to view, create, resize, remove, copy, and move partitions through the partition table.
The basic syntax of the fdisk command is-
The -l option is used to view all the information about the currently available partitions on the system. This option gives a detailed explanation of all the partitions currently on the hard disk.
To view the information of a certain partition, the path of the partition from the root must be mentioned along with the -l command. For example, to see the partition on disk a, the following syntax is followed-
To see all the commands available to use for a particular partition, the following command is used.
At this point, the m key must be typed to view the list of commands that can be used for this particular partition.
To create a new partition, first, the following command is written.
After this command is executed, the command n is typed to tell the system that a new partition must be created.
After that, one of the following two options must be typed-
i. p - To create a primary partition (only 4 primary partitions can be created using the fdisk command)
ii. e - To create a logical (or extended) partition
After entering these options, the w command is typed to write the changes to the disk and reboot the system.
To delete a partition, the same command is used first as the command used to create a partition.
After this, instead of typing n, the command d is typed.
To view the size of a partition, the -s option of fdisk command is used.
|Usermod command in Linux||4513||1|
|SSH Command In Linux||788||7|
|Introduction to Named Pipes||1058||3|
|Linux KILL Command||2783||5|
|Soft Link and Hard Link In Linux||421||2|
|Vi Editor in Linux||594||6|
|FDisk Command in Linux||541||5|
|How to view the History in Linux||448||2|
|Process Manipulation in Linux||1615||4|
|Export command in Linux||411||1|
|ID command in Linux||413||1|
|Netstat Command in Linux||624||3|
|Chmod Command in Linux||437||1|
|Compressing Files in Linux||355||1|
|Crontab in Linux||477||1|
|File Manipulation in Linux||615||5|
|Curl Command in Linux||505||1|
|Env Command in Linux||398||5|
|LSOF Command in Linux||406||1|
|User Manual in Linux||433||1|
|Whereis command in Linux||437||1|
|4 Lesser Known Commands in Linux||468||6|
|Shell Scripting in Linux||632||4|
|Alias command in Linux||373||1|
|How to Kill a Process using Command Line||471||3|