Training four Linux disk partition management


Insert picture description here

1. Add a new SCSL hard disk to the virtual machine with a capacity of 2G

(1) Open and edit the virtual machine settings in the virtual machine

Insert picture description here
(2) Click Add
Insert picture description here
(3), click Hard Disk, and keep pressing Next to edit the maximum disk size as 2GB
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

2. After starting the system, use the lsblk command with the -p option to view the type of the current disk and partition table to determine the partition management tool (fdisk, or gdisk)

(1) Enter the command lsblk -p to view the partition status
Insert picture description here

3. Use the parted command to view the disk partition table type (MBR, or GPT), according to

(1) Enter the command parted /dev/sdb p
Insert picture description here
(2) Here the partition table type shows unknown , because the new hard disk has not been partitioned yet, so the management tool is used casually, here we use the management tool fdisk

4. Use the fdisk tool to add partitions to the current disk of the system. Enter the fdisk interactive working mode and complete the following operations in sequence:

(1) Enter the command fdisk /dev/sdb to enter the interactive working mode, enter the command m
Insert picture description here
Insert picture description here
(2), enter the command p
Insert picture description here
(3), enter the command n , enter p, here we use the system default as the starting sector number, directly Press Enter to default to 1 , and continue to press Enter to start by default, and then enter 1400000 (any number is acceptable, as long as it does not exceed the maximum) and press Enter.
Insert picture description here
(4). Enter w and save. If you are not like the following after entering w, please enter q
Insert picture description here

5. Use the partprobe command to read the disk partition table

(1) Enter the command partprobe /dev/sdb1 , and there is no display after entering the command , indicating that the operation is successful
Insert picture description here

6. Use the lsblk and parted commands again to view the disk and partition information of the system

(1) Enter the command lsblk /dev/sdb -p and press enter; enter the command parted /dev/sdb p and press enter
Insert picture description here

7. Continue to add two new partitions, and use the "+sector" and "+size" formats to specify the size of the new partition respectively

(1) Same as above, look at the picture, + sector we also use +1400000
Insert picture description here
(2), use size to add the third partition, we specify 500MB
Insert picture description here

8. Use the fdisk tool to delete one of the newly created partitions and view the results

(1) Enter the command fdisk /dev/sdb , enter d and press Enter, we delete the first partition, so enter the number 1 , enter w (save and exit), and then enter lsblk /dev/sdb
Insert picture description here

All operations are complete, click like!

Guess you like

Origin blog.csdn.net/weixin_49655687/article/details/115306230