更改将停留在内存中,直到您决定将更改写入磁盘。 使用写入命令前请三思。 命令(输入 m 获取帮助):m 命令操作 a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
命令(输入 m 获取帮助): n #new 新分区 Partition type: p primary (2 primary, 1 extended, 1 free) l logical (numbered from 5) Select (default p): p #选择主分区 Selected partition 3 #分区序号 起始 扇区 (251658240-13631448799,默认为 251658240): #分区开始回车默认 将使用默认值 251658240 Last 扇区, +扇区 or +size{K,M,G} (251658240-13631448799,默认为 13631448799): 将使用默认值 13631448799
Last login: Sat Nov 20 01:59:18 on ttys000 [root@localhost ~]# vgdisplay --- Volume group --- VG Name nlas System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 2 Act PV 2 VG Size 648.99 GiB PE Size 4.00 MiB Total PE 166142 Alloc PE / Size 30462 / 118.99 GiB Free PE / Size 135680 / 530.00 GiB VG UUID Ac7YMK-JWY0-2q9Y-9pun-iU9i-Wsdv-KLEkMR
### 测试大小,超出会显示错误 [root@localhost ~]# lvresize -L +600G /dev/mapper/nlas-root Insufficient free space: 153600 extents needed, but only 135680 available
### 正式的 [root@localhost ~]# lvresize -L +530G /dev/mapper/nlas-root Size of logical volume nlas/root changed from 50.00 GiB (12800 extents) to 580.00 GiB (148480 extents). Logical volume nlas/root successfully resized.
[root@localhost ~]# resize2fs /dev/nlas/root resize2fs 1.42.9 (28-Dec-2013) resize2fs: Bad magic number in super-block 当尝试打开 /dev/nlas/root 时 找不到有效的文件系统超级块.