0

I have a centos 7 OS on VM with default partitioning like this:

enter image description here

  • NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

  • sda 8:0 0 1T 0 disk

    • sda1 8:1 0 200M 0 part /boot/efi

    • sda2 8:2 0 1G 0 part /boot

    • sda3 8:3 0 98.8G 0 part

      • centos-root 253:0 0 50G 0 lvm /
      • centos-swap 253:1 0 2G 0 lvm [SWAP]
      • centos-home 253:2 0 46.8G 0 lvm /home

In order to increase the /home directory, I added 1TB to the current disk space on VM(as you can see the size of sda above). I'm trying to extend the /home directory and add 1TB to it using fdisk /dev/sda command, but I couldn't manage it. Could anybody please help me? What steps I should take to do this? Any help would be appreciated.

1 Answers1

0

Instead, add the space as a new virtual disk.

# Add the new disk (raw, no partitions) to LVM
# Find your disk's device, check in /dev/disk/by-id/
vgextend centos
# Move the volume to the new disk
pvmove --name home /dev/sda3
# Resize the LV and the file system on it
lvextend --resizefs --size 50g /dev/centos/home

Note that the centos VG now requires both disks to be online to activate. There are ways to design around this potential problem.

This isn't the only way to do storage, but it does not require partitioning. The default storage on EL uses partitions to make the bootloader work, but LVM doesn't need them.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32