francwalter
Enthusiast
Enthusiast

Compact a Ubuntu vm with lvm2 installed

Hello

I have a Ubuntu 12.04 virtual machine, running on a host with something like Parallels Bare Metal virtualisation software.

On my Ubuntu I had LVM (lvm2) installed, I don't know why, maybe while installation, I installed it myself through the cd-image I think I don't need that anyway.

I have 1 TB (on a RAID1 disk, so 2 x 1 TB) HDD storage. I use about 40% of it. Last week the vm didn't boot anymore, no way to access the vm anyhow. The support (Host Europe is the provider) told me then, that the disk is full, it needs to be compacted.

They tried but it didn't work. Then they told me, that with LVM (Logical Volume Manager) installed it is not possible to compact this vm. I thought this is due to a restriction in Parallels software, wouldn't be strange then, but they told me, that

there is no virtualisation software at all which can do it!

Now I want to know if really VMware (ESXi or something like this) as well cannot compress/compact/shrink/defragment (however one would name it) a Ubuntu 12.04 vm with installed LVM.

This would mean, that such vm cannot be used for longer, as the hdd will once be full, how big it is and then no compaction would be possible. I wonder that I don't find any really big issues about this in the net.

Thank

frank

Tags (2)
0 Kudos
2 Replies
francwalter
Enthusiast
Enthusiast

It is disappointing that nobody could answer this question.

By the way, the end of the song was, that I left this virtual machine, at the provider "Host Europe" and moved to another provider, netcup, with another virtualisation system, KVM. This was a lot of work, like usual, when I had to move a productive server to another.

At least I could change to a cheaper product and had even more power (but less HDD), so it was not too bad the change.

0 Kudos
humpback123
Contributor
Contributor

If this is still relevant for you or someone else, use the following script:

GitHub - hamningberg/shrink-vmdk: Free unused space and shrink VMDK virtual disk with or without LVM

0 Kudos