[root@edgex ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x795ab816.
Command (m for help): o Building a new DOS disklabel with disk identifier 0x51f639a5.
Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-104857599, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): Using default value 104857599 Partition 1 of type Linux and of size 50 GiB is set
Command (m for help): t Selected partition 1 Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
[root@edgex ~]# lvextend -L +50G -n /dev/mapper/centos-root Insufficient free space: 12800 extents needed, but only 12799 available
发现报错了,空间不够,所以 降低1G输入如下命令:
1 2 3
[root@edgex ~]# lvextend -L +49G -n /dev/mapper/centos-root Size of logical volume centos/root changed from <8.00 GiB (2047 extents) to <57.00 GiB (14591 extents). Logical volume centos/root successfully resized.
逻辑卷扩展后并不会马上生效,需要使用“resize2fs”命令重新加载逻辑卷的大小
1 2 3 4
[root@edgex ~]# resize2fs /dev/mapper/centos-root resize2fs 1.42.9 (28-Dec-2013) resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.