0

I am looking for some help on expanding my LVM partitions. I have two disks I want to expand (10GB to 50GB and 40GB to 150GB).

I added the extra space in VMWare and the expanded disk is being picked up.

root@server:/home/admin# lvs
  LV                     VG                   Attr   LSize   
  chat_history           chat_history_vg      -wi-ao  50.00g
  file_store             file_store_vg        -wi-ao 150.00g

They are on sdb and sdc. This is all new to me but from what I can see there is still more to do to make them accessible based on the Alloc PE/Size value shown below.

root@server:/home/admin# vgdisplay
  --- Volume group ---
  VG Name               file_store_vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  55
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               150.00 GiB
  PE Size               4.00 MiB
  Total PE              38399
  Alloc PE / Size       38399 / 150.00 GiB
  Free  PE / Size       0 / 0
  VG UUID               H4tar2-QUt0-xCd1-iC2T-kQb3-TBZR-aVGk9O

  --- Volume group ---
  VG Name               chat_history_vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  55
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               50.00 GiB
  PE Size               4.00 MiB
  Total PE              12799
  Alloc PE / Size       12799 / 50.00 GiB
  Free  PE / Size       0 / 0
  VG UUID               CHnhT1-UBNw-wFQe-AA1D-4z8N-Cx3M-EX6zvo

I have been reading up numerous sites on using fdisk. My first question relates is when I run fdisk on one of these partitions I get this warning about the lack of a partition table. Is this benign?

root@server:/home/admin# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x2b40ee91.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action

From what I understand, even though I have existing data on the disk I wish to expand I should still choose to 'n' to create a new partition?

One last question the RedHat site starts with the step to unmount the disk before working on it. Other sites don't mention this. Am I ok leaving /dev/sdb mounted during the expansion?

Thanks,

Michael

1 Answers1

2

From what you describe, the "disk" is really a virtual disk inside a virtual machine and you increased the disk size by resizing the volume in VMWare?

If that's the case and the disk inside the virtual machine doesn't have a partition table (which is fine), than you have to use pvresize directly to increase the PV and don't use fdisk at all.

pvresize /dev/sdb

After that, you can extend the size of the logical volumes with lvresize.

As usual: Working with LVM, fdisk & co is really dangerous, especially if you don't fully understand how they relate to each other. Always make sure you have a current backup before doing that kind of operations.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • From what I can gather vgdisplay shows that the extra disk is picked up already (I restarted the VM). VG Size: 150.00 GiB and Alloc PE/Size: 38399 / 150.00 GiB. I am wondering if I now need to look at running lvresize and then resize2fs? – Michael Maher Jun 29 '16 at 13:34