You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For avocado-vt and it providers(tp-libvirt, tp-qemu), most of us create image by dd. It creates a image file and formating it with 0. However, most of time we don't need to format the file, then we can replace dd with fallocate to save time. Sometimes, sparse image also works(e.g. targetcli backstore file), we can use truncate to save the fs free space.
Here is the comparision of time and space spent for truncate, allocate and dd:
➜ ~ time dd if=/dev/zero of=file-dd bs=1G count=20
20+0 records in
20+0 records out
21474836480 bytes (21 GB, 20 GiB) copied, 25.9644 s, 827 MB/s
dd if=/dev/zero of=file-dd bs=1G count=20 0.00s user 16.59s system 63% cpu 25.971 total
➜ ~ time fallocate -l 20G file-falloc
fallocate -l 20G file-falloc 0.00s user 0.00s system 45% cpu 0.007 total
➜ ~ time truncate -s 20G file-truncate
truncate -s 20G file-truncate 0.00s user 0.00s system 54% cpu 0.004 total
➜ ~ ls -sh file-*
21G file-dd 21G file-falloc 0 file-truncate
Luckily, qemu-img has implemented this 3 modes into the option preallocation(not so sure if preallocation=full equals to zeroing, to be confirmed at this mail):
For avocado-vt and it providers(tp-libvirt, tp-qemu), most of us create image by
dd
. It creates a image file and formating it with 0. However, most of time we don't need to format the file, then we can replacedd
with fallocate to save time. Sometimes, sparse image also works(e.g. targetcli backstore file), we can use truncate to save the fs free space.Here is the comparision of time and space spent for truncate, allocate and dd:
Luckily, qemu-img has implemented this 3 modes into the option preallocation(not so sure if preallocation=full equals to zeroing, to be confirmed at this mail):
The text was updated successfully, but these errors were encountered: