Truncate RAW disk image

ppo

Renowned Member
Aug 6, 2012
49
0
71
I've faced with such trouble with one of my first VM, that I want to copy through Internet.
I crated this KVM with raw disk image due performance suggestion. But in future I never saw a performance differences between raw and qcow2. But qcow2 is more useful, especially with disk usage consumption.
Recently I've found this article:
http://schlutech.com/2012/02/truncate-kvmqemu-raw-disk-image/
and I want to ask community is it save to do such thing, is someone did a similar?
Any other suggestions would be very helpful.
Code:
root@proxmox:~# ls -lah /var/lib/vz/images/102/vm-102-disk-1.raw 
-rw-r--r-- 1 root root 5.0G Jun 17 09:14 /var/lib/vz/images/102/vm-102-disk-1.raw
root@proxmox:~# du -sch /var/lib/vz/images/102/vm-102-disk-1.raw 
4.6G    /var/lib/vz/images/102/vm-102-disk-1.raw
root@proxmox:~# ls -lah /mnt/pve/remote/dump/vzdump-qemu-102-2013_06_17-09_06_24.tar.gz 
-rw-r--r-- 1 root root 2.4G Jun 17 09:10 /mnt/pve/remote/dump/vzdump-qemu-102-2013_06_17-09_06_24.tar.gz
[root@vm-102 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rm2-lv_root
                      4.0G  1.7G  2.1G  45% /
tmpfs                 492M     0  492M   0% /dev/shm
/dev/vda1             485M   65M  395M  15% /boot
none                  492M  8.0K  492M   1% /tmp