I'm stuck with a centos 7 vm with 1 disk that has 4 primary partitions created... and now I need to add more space:
It currently looks like this - simplified:
mount
/dev/mapper/centos-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 175G 14G 162G 8% /
lsblk
sda 8:0 0 250G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 59.5G 0 part
│ └─centos-root 253:0 0 175G 0 lvm /
├─sda3 8:3 0 60G 0 part
│ └─centos-root 253:0 0 175G 0 lvm /
└─sda4 8:4 0 80G 0 part
└─centos-root 253:0 0 175G 0 lvm /
The disk /dev/sda has already been extended, with 50gb free and unpartitioned. Normally, I would do one of the following:
create a new partition with the free space and add it to the
centos-rootLV. Unfortunately, sda1-4 are all primary partitions, so I can't actually create any more.use
resize2fsto shrink the filesystem, thenlvreducethe LV. But this filesystem is xfs, and cannot be reduced.
I also tried to create a new virtual disk /dev/sdb, and run the following to clear one of the partitions:
pvcreate /dev/sdb
vgextend centos /dev/sdb
pvmove /dev/sda4 /dev/sdb
/dev/sda4: Moved: 0.00%
/dev/sda4: Moved: 3.06%
[kernel panic] ????
But this actually crashes the whole VM... and now I'm stuck. How can I clean up at least one of these partitions, or at least add the space I've already extended?