K
K
Konstantin2017-02-22 13:05:02
VMware
Konstantin, 2017-02-22 13:05:02

How to shrink a vmware disk?

The bottom line is that when installing ubuntu, I made a 25 GB rubber hard
drive, and it took exactly as much data on my disk - about 5 GB.
But today I copied and tested mysql work with large files many times and the disk was full up to 20 GB!
Although I found out in the system through the du command that there was data for a maximum of 9GB . I
completed the work of the virtual machine. found the command to clean, compress the disk - does not help ...
how to shrink the disk to 5GB again?
maybe somehow in ubuntu it is necessary to optimize the disk?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mamahtehok, 2017-02-22
@mamahtehok

If vm is on esxi then:
1. zero out blocks in linux (dd bs=1M count=15000 if=/dev/zero of=zero) where count is available free space (find out in df).
2.1 If there are several datastores, we migrate between datastores.
2.2 If there is only one datastore on esxi, execute the command vmkfstools -K --punchzero /path/to/vmdk/disk.vmdk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question