Skip to content

Instantly share code, notes, and snippets.

@itxx00
Last active August 29, 2015 14:00
Show Gist options
  • Save itxx00/ac6e5eb0c61332669a30 to your computer and use it in GitHub Desktop.
Save itxx00/ac6e5eb0c61332669a30 to your computer and use it in GitHub Desktop.
discard-support
[root@localhost ~]$ rpm -q qemu-kvm
qemu-kvm-1.6.2-1.fc20.x86_64
[root@localhost ~]$ rpm -q libvirt-daemon
libvirt-daemon-1.1.3.4-4.fc20.x86_64
[root@localhost ~]$ mount -o discard /dev/sda1 /sda
[root@localhost ~]$ mount /dev/sdb1 /sdb
[root@localhost ~]$ for _ in {1..3}; do
/bin/dd if=/dev/urandom of=/sda/file.$RANDOM bs=1M count=100 && sync
/bin/dd if=/dev/urandom of=/sdb/file.$RANDOM bs=1M count=100 && sync
/bin/rm -f /sda/file.* /sdb/file.* && sync
done
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none' discard='unmap'/>
<source file='/disk/fedora20.data1.img'/>
<target dev='sda' bus='scsi'/>
</disk>
<controller type='scsi' index='0' model='virtio-scsi'>
</controller>
[root@localhost ~]$ du -h sd{a,b}.img
34M sda.img
138M sdb.img
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none' discard='unmap'/>
<source file='/mnt/sda.img'/>
<target dev='sda' bus='scsi'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/mnt/sdb.img'/>
<target dev='sdb' bus='scsi'/>
</disk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment