Device Boot StartEnd Blocks Id System /dev/sda1 * 16451200083 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 642611204584968e Linux LVM
[root@node-002 ~]# fdisk /dev/vda 命令(输入 m 获取帮助): m 命令操作 a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition 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 (1 primary, 1 extended, 2 free) l logical (numbered from 5) Select (default p): p #选择主分区 分区号 (1-4,默认为 3): 3 #分区序号 起始 sector (499712-314572799,默认为 499712): #分区开始回车默认 将使用默认值 499712 Last sector, +扇区 or +size{K,M,G} (499712-501757,默认为 501757): 将使用默认值 501757 命令(输入 m 获取帮助): n #new 新分区 Partition type: p primary (2 primary, 1 extended, 1 free) l logical (numbered from 5) Select (default p): p #选择主分区 Selected partition 4 #分区序号 起始 sector (62912512-314572799,默认为 62912512): #分区开始回车默认 将使用默认值 62912512 Last sector, +扇区 or +size{K,M,G} (62912512-314572799,默认为 314572799): 将使用默认值 314572799 命令(输入 m 获取帮助): t #修改分区格式 分区号 (1-5): 4 #修改分区号 Hex code (type L to list codes): 8e #格式选择8e linux LVM Changed system type of partition 4 to 8e (Linux LVM) 命令(输入 m 获取帮助): p #显示分区信息 Disk /dev/sda: 161.1 GB, 161061273600 bytes 16 heads, 63 sectors/track, 312076 cylinders, total 314572800 sectors Units = 扇区 of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0001a023 设备 启动 起点 终点 块数 Id 系统 /dev/sda1 * 2048 499711 248832 83 Linux /dev/sda2 501758 62912511 31205377 5 扩展 /dev/sda3 499712 501757 1023 83 Linux Partition table entries are not in disk order 命令(输入 m 获取帮助): w #保存信息 The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: 设备或资源忙. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
重启Linux操作系统,使用reboot命令。
创建物理卷,使用pvcreate /dev/sda3命令。
1 2
[root@node-002dev]# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created
[root@node-002dev]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name vg_node003 PV Size 19.51 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 4994 Free PE 0 Allocated PE 4994 PV UUID UC4j5m-rJO4-DroW-E92L-n5Vj-SU0U-PJyfJf "/dev/sda3" is a new physical volume of "30.00 GiB" --- NEW Physical volume --- PV Name /dev/sda3 VG Name PV Size 30.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID nng8Gx-51fP-DIBH-YeF4-Sw7B-S0jQ-oGXfpa
[root@node-002dev]# vgdisplay --- Volume group --- VG Name vg_node003 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 49.50 GiB PE Size 4.00 MiB Total PE 12673 Alloc PE / Size 4994 / 19.51 GiB Free PE / Size 7679 / 30.00 GiB VG UUID v37e5T-4iPX-olm0-Claw-8EfO-axHf-evCAfc
[root@node-002mapper]# resize2fs /dev/mapper/vg_node003-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg_node003-lv_root is mounted on /; on-line resizing required old desc_blocks = 2, new_desc_blocks = 3 Performing an on-line resize of /dev/mapper/vg_node003-lv_root to 12451840 (4k) blocks. The filesystem on /dev/mapper/vg_node003-lv_root is now 12451840 blocks long.
如出现下列情况
1
resize2fs: Bad magic number in super-block 当尝试打开 /dev/mapper/vg_node003-lv_root 时 找不到有效的文件系统超级块.