Detailed explanation of Linux disk partition (parted)

1. What is a partition

Partitioning is to divide a hard disk drive into several logical drives, which can treat contiguous blocks of the hard disk as an independent disk.

 

2. Why should there be multiple partitions?

◇ Prevent data loss: If the system has only one partition, if this partition is damaged, the user will lose all the data.

◇ Increase the efficiency of disk space usage: you can format partitions with different block sizes. If there are a lot of 1K files and the disk partition block size is 4K, then 3K of space will be wasted every time a file is stored. At this time, we need to take the average of these file sizes to divide the block size.

◇ Avoid system hangs when data surges to the limit: Separating user data from system data can prevent user data from filling up the entire hard drive and causing system hangs.

 

3. Partitions of Linux disks over 2TB

Execute the fdisk -l command to display the hard disk devices of the current system. It shows that the sdc has no partition information and the size is 8001GB.

Use the parted command to partition sdb.

[root@g11-64-1 ~]# parted /dev/sdc

Input: mklabel gpt means start partition

Input: mkpart primary 0KB 800GB select the starting and ending position of the partition

Type: print to view the partition

Input: quit to exit

 

Then use the fdisk -l command to view the partition status.

After partitioning, you need to format the partition.

Mount the newly created partition /dev/sdc1 to /mnt/sdc1.

 

Fourth, set the new hard disk to automatically mount at boot

Add the mount information of the new hard disk in /etc/fstab. Add the following content:

In this way, after each boot, the system will automatically mount /dev/sdc1 to /mnt/sdc1.

 

 

Guess you like

Origin blog.csdn.net/wxt_hillwill/article/details/110878800