I was trying to shrink a vmdk (VMWare disk image) file to be as small as possible, and found two recommendations. The first is to
cat /dev/zero into the fs then delete it, and run VMWare tools' shrink. This works okay. The second is to copy everything into a new vmdk. I went the second route. I did not use
dd because I actaully want to use as few blocks as possible, instead of having a block-by-clok copy. Any unlinked files will still have blocks that aren't zeroed out. Secondly the centos image was mostly lvm, except for the boot partition, and my target was going to be 4gb instead of 8gb.
I did use
dd for the first 40mb to get the boot blocks and partition copied. I then used
parted to create an identical primary boot, and smaller primary lvm. Then I used
pvcreate on that device sdb2,
lvcreate to create a root and swap. I used mkfs.ext3fs on the root partition and then
rsync -av / /2root excluding
/proc /sys /2root /dev. So far everything went fine.
My problem is that:
- The result is 2.7 GB while the source was 2.1 GB. This is weird to me.
- The second vgroup is called VolGroup01, while the original was called VolGroup00.
How can I rename the VolGroup01 to VolGroup00 and swap it out after all this?
© Server Fault or respective owner