使用fdisk对/dev/nvme0n1剩余空间进行分区
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (3,4, default 3): 3
First sector (38160384-62914559, default 38160384):
Last sector, +sectors or +size{K,M,G,T,P} (38160384-62914559, default 62914559):
Created a new partition 3 of type 'Linux' and of size 11.8 GiB.
Command (m for help): p
Disk /dev/nvme0n1: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe4b0df16
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 1026047 1024000 500M 83 Linux
/dev/nvme0n1p2 1026048 38160383 37134336 17.7G 8e Linux LVM
/dev/nvme0n1p3 38160384 62914559 24754176 11.8G 83 Linux
2.新添加一块儿磁盘使用gdisk,设置gpt分区表,新建分区
[root@rhcsa01 ~]# gdisk /dev/nvme0n2
设置gpt分区
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y
Command (? for help): p
Disk /dev/nvme0n1: 62914560 sectors, 30.0 GiB
Model: VMware Virtual NVMe Disk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 1C87F617-68F7-4EF8-B1EB-C1FD33A81DF4
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 62914526
Partitions will be aligned on 2048-sector boundaries
Total free space is 62914493 sectors (30.0 GiB)
Number Start (sector) End (sector) Size Code Name
Command (? for help):
3.使用parted对新添加的磁盘添加分区(交互式)
[root@rhcsa01 ~]# parted /dev/nvme0n2
GNU Parted 3.2
Using /dev/nvme0n2
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: NVMe Device (nvme)
Disk /dev/nvme0n2: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 525MB 524MB primary xfs boot
2 525MB 19.5GB 19.0GB primary lvm
4.使用parted对/dev/nvme0n1新增分区(命令式)
[root@rhcsa01 ~]# parted /dev/nvme0n2 mkpart 3rdGPT 632M 932M
5.挑选任一分区,进行格式化挂载(临时挂载)
[root@rhcsa01 ~]# mkfs.ext3 /dev/nvme0n2
[root@rhcsa01 ~]# mkdir /data
[root@rhcsa01 ~]# mount /dev/nvme0n2 /data
[root@rhcsa01 ~]# cd /data
[root@rhcsa01 data]# touch file{1..5}.txt
[root@rhcsa01 data]# ls -l
total 0
-rw-r--r--. 1 root root 0 Jul 22 13:18 file1.txt
-rw-r--r--. 1 root root 0 Jul 22 13:18 file2.txt
-rw-r--r--. 1 root root 0 Jul 22 13:18 file3.txt
-rw-r--r--. 1 root root 0 Jul 22 13:18 file4.txt
-rw-r--r--. 1 root root 0 Jul 22 13:18 file5.txt
6.挑选另一分区,进行格式化挂载(永久挂载)
[root@rhcsa01 ~]# mkfs -t xfs /dev/nvme0n2
[root@rhcsa01 ~]# vim /etc/fstab
重启后自动挂载
[root@rhcsa01 ~]# df -h