VMware Communities
UlyssesOfEpirus
Enthusiast
Enthusiast

Why is it so hard to compact an ext3 boot drive?

Compacting under the Virtual Machine Settings does not work on a 12 GB ext3 drive with a ubuntu derivative installed.

Tried to copy it to another 12 GB drive using this from a live CD boot:

dd if=/dev/sda of=/dev/sdb

and the new drive's vmdk was just as large.

Tried Acronis Rescue CD and the same happened.

Why is it so hard?  Must I install linux again to a new drive just to recover the unused space?

Reply
0 Kudos
7 Replies
wila
Immortal
Immortal

Hi,

Not so sure it is that hard,

Have you tried:

sudo vmware-toolbox-cmd disk shrink /

As is described here:

Shrink guest on hosted platform - VI-Toolkit

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
UlyssesOfEpirus
Enthusiast
Enthusiast

Yes I have tried exactly that. And the new disk is 6,721,437,696 bytes big whereas df inside the guest reports only 5790040 Kbytes used so 746 Mb is wasted.

Also tried "dd if=/dev/zero of=foo bs=1024x1024" followed by "rm foo" and now 652 Mb is wasted.

Tried "sudo vmware-toolbox-cmd disk shrink /" again and now 618 Mb is wasted.

Repeated the last two steps without the "rm foo" and now 18.3 Mb is wasted.

Removed the foo file, did the "sudo vmware-toolbox-cmd disk shrink /" again, and 22.4 Mb is wasted.

So it works eventually, but why is it so difficult?

UlyssesOfEpirus
Enthusiast
Enthusiast

Maybe this explains it:

   11389 non-contiguous files (6.6%)
     234 non-contiguous directories (0.1%)
Reply
0 Kudos
wila
Immortal
Immortal

Maybe, but I have my doubts that it matters for reclaiming data.

I was more inclined to think about your swap partition, assuming you have one, it will not be zeroed out.

You would also have to compare what is used in the guest in comparison to what is used at the host.

I was under the impression it was very close to each other once zeroed out and reclaimed.

Can't say I've seen happening what you are reporting.

But then again, I might not have paid much attention to 500Mb wasted as it does not make much of a difference on most of my systems.

Yes I know, crazy if you still remember having used 10 MB hard disks and be amazed about how big that was. Smiley Wink

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
UlyssesOfEpirus
Enthusiast
Enthusiast

I have the swap partition on a separate drive. How do you compare what is used in the guest in comparison to what is used at the host?

Reply
0 Kudos
wila
Immortal
Immortal

Hi,

Having the swap on a separate drive certainly would help.

In the past I used to do that too, even would go as far as moving that vmdk to another physical spindle, to squeeze out the last bit of performance.

Nowadays I tend to keep it simple and mostly stick with defaults.

For determining the usage of space on linux I normally just run "df -h" and look at the "Used" column.

At host level I would look at how much the vmdk file use (or with the vm shut down look at how much space is used in the folder)

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
UlyssesOfEpirus
Enthusiast
Enthusiast

This is what I was doing when I wrote "the new disk is 6,721,437,696 bytes big whereas df inside the guest reports only 5790040 Kbytes used". I thought you had a way to tell which blocks are being used. In order to discover why the above results occurred (it failed to make the vmdk smaller multiple times before eventually succeeding). Understanding the why of this might result in a better way to shrink.

Reply
0 Kudos