Need help shrinking a VM raw disk

  • Thread starter Thread starter madjeff
  • Start date Start date
M

madjeff

Guest
I've been searching but don't seem to be hitting the right info to help me here, so I'm tossing this on up to the gurus. =)

I created a base VM that I've been cloning with the DD command and it's been working well. This base VM is running Ubuntu 10.04 Server. The original VM Disk size was 150Gb and is in RAW format, but now I need to resize the disk down to about 8Gb. The size of the actual data is only about 3Gb, so crunching it down to 8Gb should be pretty straightforward, right? Is there a good how-to somewhere that can show me the steps needed to shrink the logical volume?

Currently all my VM disks are created in /dev/vmstore/ as vm-1##-disk-1 as logical volumes. I know this has to be pretty straightforward but in my googling I'm getting a lot of different conflicting was to do this, and none that I can get working. Please help an idiot! =)
 
I've been searching but don't seem to be hitting the right info to help me here, so I'm tossing this on up to the gurus. =)

I created a base VM that I've been cloning with the DD command and it's been working well. This base VM is running Ubuntu 10.04 Server. The original VM Disk size was 150Gb and is in RAW format, but now I need to resize the disk down to about 8Gb. The size of the actual data is only about 3Gb, so crunching it down to 8Gb should be pretty straightforward, right? Is there a good how-to somewhere that can show me the steps needed to shrink the logical volume?

Currently all my VM disks are created in /dev/vmstore/ as vm-1##-disk-1 as logical volumes. I know this has to be pretty straightforward but in my googling I'm getting a lot of different conflicting was to do this, and none that I can get working. Please help an idiot! =)
Hi,
i think the easy way is to create a second disk (8GB), use dd to copy the first GB (or the complete 8GB) from the 150GB disk to the new one (than you have mbr,/boot and a trashed filesystem).
Open with fdisk and change the partition layout (left /boot). mkfs the new root, mount to /mnt and tar the contend from /-150GB to /mnt. shutdown, remove both disks in the gui and add the 8GB-disk as new one and define as start-disk.
Should work, if you don't have lvm running - in this case you need use pvremove first on the 8GB-disk (sdb2?) and than change fstab and menu-lst on the new disk.

Udo