Linux Fdisk Partitioning: Complete Step-by-Step Guide
The general steps of partitioning a disk using the fdisk tool in Linux are as follows:
- Open the terminal and enter the command sudo fdisk -l to list all disks and partitions in the system, identify the name of the disk you want to partition (such as /dev/sda).
- Type the command “sudo fdisk /dev/sda” (replace /dev/sda with the name of the disk you want to partition) to launch the fdisk tool.
- Type ‘m’ at the fdisk command prompt to view the help information and learn about the available commands.
- Enter ‘n’ to create a new partition.
- Select the type of partition (primary partition, extended partition, logical partition).
- Enter the starting sector and ending sector (or partition size).
- Enter ‘w’ to save the partition table changes and exit fdisk.
- Finally, use the command sudo mkfs -t ext4 /dev/sda1 (replacing /dev/sda1 with the name of the newly created partition) to format the new partition.
The above are simple partitioning steps. Actual steps may vary, and it is recommended to carefully read the help information of the fdisk tool or refer to other resources while performing the operation.