The reason the images are small is that they're more flexible being small.
Essentially, its absolutely trivial to grow a disk by just adding zeros to the
end of it (and cloud-init does that automatically).
Ie:
qemu-img resize 10G my.img
or
truncate --size 10G my.img
Its much more difficult and even impossible without OS knowledge to
shrink a disk.
That said, its really much better for vagrant to learn how to instruct
virtualbox to resize a disk to a larger size. I think that can be accomplished
with:
vboxmanage modifyhd /tmp/my.img --resize 10000 # that is in megabytes
I did test, and the image sizes are not terribly made larger by having space if
everything is correctly zeroed.. Heres what I did to show that:
for size in 10G 1400M 40G; do
raw="my-$size.raw"; qcow="my-$size.qcow"; qcowz="my-$size.qcowz"
rm -f "$raw" "$qcow" "$qcowz"
echo === $(date) $size ===
truncate --size $size $raw
mkfs.ext4 -F $raw >/dev/null 2>&1 || { echo "failed mkfs"; exit 1; }
time qemu-img convert -O qcow2 $raw $qcow
time qemu-img convert -c -O qcow2 $raw $qcowz
done
$ ls -altr /tmp/my-* | awk '{print $5, $9}'
10737418240 /tmp/my-10G.img
1468006400 /tmp/my-1.4G.img
10737418240 /tmp/my-10G.raw
4521984 /tmp/my-10G.qcow
851968 /tmp/my-10G.qcowz
1468006400 /tmp/my-1400M.raw
1441792 /tmp/my-1400M.qcow
524288 /tmp/my-1400M.qcowz
42949672960 /tmp/my-40G.raw
8323072 /tmp/my-40G.qcow
1966080 /tmp/my-40G.qcowz
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1278989
Title:
vagrant cloud images disk is too small
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/1278989/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs