Growing file system is easy. Shrinking the file system is trickier and not supported by all file systems. ext3 and ext4 do support shrinking, though, but BE VERY CAREFUL WITH IT. Make absolutely sure you have good backups. Then, verify once more you have good backups.
You should first shrink the file system itself with resize2fs /dev/yourdevice newsizegoeshere
.
Next you need to shrink the logical volume: lvresize -L X /path/to/your/logical_volume
, where X
is the new size expressed in some way. I purposely left out the syntax, see man lvresize
for available options to see your preferred way to tell the new size. You can subtract from the old size or just specify the new size.
Next you need to shrink the volume group itself with vgresize
, if you see that necessary. Alternatively you can just create new logical volumes inside the volume group, now that the previous step with lvresize gave you some space to breathe.
If you took the vgresize
route, you finally need to adjust the partition size with fdisk
by deleting the partition, and recreating it with the exactly same starting block as before and making the size smaller than before.
EDIT: It appears that with LVM2 volume group shrinking is not that trivial thing to do. You may need to delete the volume group and recreate it... oh dear. So, how about my footnote, would it work?
If you and/or software fail in any of these steps, your data goes boof. So once more: MAKE SURE YOU HAVE GOOD BACKUPS.
Oh, and as your copy-paste mentions VMware: could you just create a new virtual disk in VMware, copy over your stuff from your over-sized disk to the new disk, nuke the over-sized disk from the orbit and call it a day?
There's no easy answer since virtualisation is involved. You have a virtual disk sitting on top of a file system on top of a block device presented to a virtual guest which has its own driver presenting a block device to LVM. I don't know for sure if that would necessarily cause such a huge difference, but it may be possible.
Beyond that...
LVM adds overhead so there will be a difference. If your LVM and block devices aren't aligned properly that can also be a contributing factor.
Alignment isn't a simple subject that can be covered in a setting such as this. The best I can do is refer you to a couple of documents, maybe you'll find more answers in them:
Best Answer
a normal tar backup/restore can do the job for you, and if the disk layout is to be the same on all machines, simply use dd (or derived toos, like g4u, clonezilla etc...)