How to partition a disk in Linux?
In Linux, you can use the command line tool fdisk or the graphical interface tool GParted to partition disks.
The steps to partition a disk using fdisk are as follows:
- Open the terminal and log in with root privileges.
- List all disk partitions.
- Partition the device /dev/sdX using fdisk.
- Press the m key in the fdisk command line interface to view the available list of commands.
- Use the “n” command to create a new partition, selecting the partition type (primary or extended) and partition size.
- Use the ‘t’ command to set the file system type for the partition.
- Save the partition table and exit by using the w command.
The steps for partitioning a disk with GParted are as follows:
- Open the GParted application.
- Select the disk you want to partition in the top right corner of the GParted interface.
- Choose “Partition” in the menu bar, then select “New” to create a new partition.
- Configure the size of partitions, file system type, and other parameters.
- Click the “Apply” button to apply the partition operation.
Whether using fdisk or GParted for partitioning, it is important to be careful in order to avoid accidental data loss. It is recommended to backup important data before performing any partitioning operations.