Support >
  About independent server >
  Linux partition creation process
Linux partition creation process
Time : 2025-02-21 14:40:27
Edit : Jtti

How is space allocation managed in Linux? The term "partition" supports data organization. Linux creates partitions for the purpose of managing computers. In this article, we share how to create partitions with the fdisk and parted commands to help you understand formatting and installing partitions!

The system has more disks, as a user should distinguish them to facilitate management, first list all available disks to correctly identify:

sudo fdisk -l

Once the correct disk has been identified, you can start the fdisk command on it:

sudo fdisk /dev/sdb

View existing partitions:

p

The disk was partitioned in Linux. To do this, run the following command:

n

Next you specify the newly created partition and give it a number. This is important for creating a unique identity. The common range for primary partitions is 1 to 4. Therefore, we will enter the number "1" in the command line interface.

one

The last step in partition creation has to do with size. You need to enter a specific number into the CLI in order to create a partition of a specific size. For example, you can enter +20G on the CLI. After you press the Enter key, you get a 20 GB partition. The above changes are temporary until you write them with the following command:

W

Your Linux partition is ready to use!

parted is another tool for managing Linux disk partitions that offers more advanced options than fdisk. You can refer to the following command to create a partition! List available disks:

sudo parted -l

After determining the correct disk, launch the disk parted command and replace /dev/sdb with your actual disk identifier. This step is also similar to the fdisk step.

sudo parted /dev/sdb

View existing partitions and available space:

Print

To create a new partition:

Mkpart

Specify the new partition type and file system:

mkpart primary ext2 1MiB 20GiB

Verify and apply the changes

print

After the partition is created, the next step is formatting, which ensures that the file system is deployed correctly on the disk and facilitates data organization. List all partitions first:

sudo fdisk -l

Select the correct partition and format the partition. For example, the partition to be formatted is /dev/sdb1. For ext4 file systems: command:

sudo mkfs.ext4 /dev/sdb1

xfs file system commands:

sudo mkfs.xfs /dev/sdb1

ntfs file system command:

sudo mkfs.ntfs /dev/sdb1

Verification format:

sudo blkid

or

lsblk -f

To mount partitions, list all partitions first:

sudo fdisk -l

Create a mount point:

sudo mkdir /mnt/my_partition

To mount a partition:

sudo mount /dev/sdb1 /mnt/my_partition

Verify installation:

df -h

Access partition:

cd /mnt/my_partition

Uninstall partition:

 

JTTI-Selina
JTTI-COCO
JTTI-Ellis
JTTI-Defl
JTTI-Eom
Title
Email Address
Type
Sales Issues
Sales Issues
System Problems
After-sales problems
Complaints and Suggestions
Marketing Cooperation
Information
Code
Submit