Shrink VM-disk size (ubuntu, raw, ext4)

michu

Member
May 20, 2010
63
1
6
Hi,

I have some VMs with Ubuntu 10.04 (ext4 filesystem on raw disk image) inside Promox 1.9.
The problem is with their disk size. For example my FTP machine has disk-2.raw mounted as /srv/ftp/data
The real allocated space inside quest is 12GB (df -h), but inside Proxmox file size is nearly 45GB.
I know that is correct because this space is used in raw file.

Actually I need to shrink this partition (I mean zero usused space).
I was thinking about zerofree util inside quest machine, but docs says it doesn't support ext4 filesystem :(

So is there other (quite easy) way to do it ?


Sorry for my english.
Regards
michu
 
Hi dietmar,

Thanks for tip. I'll try later (evening). Now it can kill I/O on my machine.


Regards
michu
 
Dietmar, I tried this on test machine with 20GB HDD, after all it shows that 19GB is used (via GUI menu: "Storage" option).
It seems it doesn't help :/

Regards
michu
 
Dietmar, I tried this on test machine with 20GB HDD, after all it shows that 19GB is used (via GUI menu: "Storage" option).
It seems it doesn't help :/

It is still allocated on the host file system. But I guess backup files will be much smaller now.What problem do you want to solve exactly? Future versions will include a guest agent, which will report disk size from inside the guest.
 
Dietmar, you are right the backup size decreased (but backup time is the same).
So there are still 2 issues:

1) Backup time.
2) Host system show bigger size than it's real - but your quest agent will fix it in the future -> here is one question, how it will work ?

How about using cp --sparse=always ? cp manual says that zero bytes (from /dev/zero) will be sparsified. Is it safe for ext4 filesystem ? Anyone tried this ?
 
For backup time, I usually schedule backups at 2am of saturday or suday, when the workload is really low.
I've found that changing ionice from default 7 to 4 dramatically reduces backup time (i.e. a 320 SAS LVM VM, backed up into a sata disk, snapsot mode, has dropped from 23 hours to 3:30!)
So edit (create if does not exist):
/etc/vzdump.conf
enter
ionice: 4
and let us know :)
 
For backup time, I usually schedule backups at 2am of saturday or suday, when the workload is really low.
I've found that changing ionice from default 7 to 4 dramatically reduces backup time (i.e. a 320 SAS LVM VM, backed up into a sata disk, snapsot mode, has dropped from 23 hours to 3:30!)
So edit (create if does not exist):
/etc/vzdump.conf
enter
ionice: 4
and let us know :)

I backup weekly on second machine via SSH (fuse.ssh). I don't think that ionice improve significaly backup speed since it's network resource :/