0

I just copied a 50 GB disk image using dd for bit copying to a new harddisk with 200 GB storage. On the disk is LVM including the system partition EXT4 and a swap partition (both LVs).

Well the copy is running and works great. Now I would like to expand the whole LVM VG, and LV and also the underlying EXT4 to use the whole disk.

At the moment it still claims to have 50 GB only. I would like to extend it not at a second disk to the Volume Group. What would be the best way to do it?

TheMAn
  • 31
  • 1
  • 1
  • 3
  • Indeed is a copy as I see. If I look into answer two. One is missing the gpart part of the procedure. I did not know that gpart or similar tools can handle it if LVM is underlying. So it makes sense first gpart than lvm resize. By the way Clonezilla is overhead as written in the duplicate! A simple dd or dd with pv pipe is enough. – TheMAn Jan 13 '16 at 21:19

1 Answers1

0

Well so far I found the solution on my own. http://bhaisaab.org/logs/lvm-cloning/ posted a HowTo to obtain the desired result.

For me, everything from pvdisplay up to the end was absolutely clear and should be save. I just did not know, that it is possible to use fdisk to delete the partition first and after that just to create a new one with the full size to get the correct partition table without loosing your data.

Well so far it works great. Don't ask me if it is very safe to follow that guide :)

TheMAn
  • 31
  • 1
  • 1
  • 3
  • 1
    Playing around with partitions is always a bit risky but deleting them outright to recreate is riskier than most ways. I would have advised using a tool like GParted (and booting from a liveUSB so you're not playing with partitions on a live system) to resize the partition in question rather than deleting/recreating in fdisk; there's less that can go wrong. – Carcer Jan 13 '16 at 18:37
  • Well nice, I did not think that GParted would handle a resize of the PV when LVM is underlying on the disk. My fault I just did not tried it. so if GPart for PV and lvm resize for the VG works, it looks like a far safer solution than fdisk. Do you think that there may follow error depending on the fdisk procedure in the future or should it be secure if everthing went well? :P – TheMAn Jan 13 '16 at 21:22
  • No, if it's working now you're probably fine. gparted is an alternative tool to fdisk for editing the partitions on the disk; I don't believe it can resize the PV (that's handled by the `pvresize` command once the partition has been enlarged so the PV has space to expand into). – Carcer Jan 13 '16 at 23:23