Home > Operation and Maintenance > CentOS > Detailed explanation of disk partitioning and mounting of Centos7

Detailed explanation of disk partitioning and mounting of Centos7

藏色散人
Release: 2020-12-31 14:55:48
forward
4964 people have browsed it

The following tutorial column will give you a detailed explanation of Centos7 disk partitioning and mounting. I hope it will be helpful to friends in need!

Recently, the existing system hard disk is not enough. It is necessary to add hard disk operations to the existing system. The original environment is centos7

Detailed explanation of disk partitioning and mounting of Centos71. Check the overall disk situation :sudo fdisk -l

##/dev/sda This disk is partitioned into two areas:

In this information, you can check which disk has not been partitioned: the /dev/sdb disk in the picture has 500G, and it has not been operated on yet:

2. Hard disk partition

You need to install parted before executing this command: (sudo yum install parted)

In the information in the first step, we already know that the hard disk has not been installed Partitioning, hard disk partitioning is to operate these hard disks that are not partitioned.

The hard disk without partitions of this machine is called

/dev/sdb. If there are multiple hard disks, yours may be called another name, such as: / dev/sda

Then the operation command is:

1) sudo parted /dev/sdb

//Special reminder to make sure when executing 2)/ dev/sdb is a blank disk, otherwise your stuff will be gone.

2) Delete all partitions of the current hard disk: (parted) mklabel gpt

3) You can check the partition status: (parted) print

4) Split the disk:

(parted) mkpart primary ext4 0% 50%

(parted) mkpart secode ext4 50% 80%

5) Exit: (parted ) quit

3. Format partition

Mine is divided into two areas: /dev/sdb1 and /dev/sdb2 (sdb1 and sdb2 This name is generated by the system and cannot be modified)

sudo mkfs.ext4 /dev/sdb1

sudo mkfs.ext4 /dev/sdb2

4,

hang Upload the hard disk to a system folder

Create two folders:

sudo mkdir -p /picture1

sudo mkdir -p /picture2

Persist the information:

sudo vim /etc/fstab

Add the following line to the last line in /etc/fstab and use mount -a only The temporary partition will become invalid after restarting and needs to be persisted as follows:

/dev/sdb1 /picture1 ext4 defaults 0 0

/dev/sdb2 /picture2 ext4 defaults 0 0

Final execution: sudo mount –a

Use df -hl to check the specific disk situation.

The above is the detailed content of Detailed explanation of disk partitioning and mounting of Centos7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template