I need to reduce my bootable qemu
image (which downloaded from glance
) virtual size from 12G to 2G:
$ qemu-img info w.img
image: w.img
file format: raw
virtual size: 12 GiB (12884901888 bytes)
disk size: 1.67 GiB
$ sudo virt-df -h w.img
Filesystem Size Used Available Use%
w.img:/dev/sda1 11G 1.4G 10G 13%
w.img:/dev/sda15 104M 5.2M 99M 5%
$ sudo virt-resize --shrink /dev/sda1 w.img smaller.img
[ 0.0] Examining work.img
virt-resize: error: /dev/sda1: This partition contains a ext4 filesystem
which will be damaged by shrinking it below 12304109568 bytes (user asked
to shrink it to 2029748224 bytes). If you want to shrink this partition,
you need to use the ‘--resize-force’ option, but that could destroy any
data on this partition. (This error came from ‘--shrink’ option on the
command line.)
If reporting bugs, run virt-resize with debugging enabled and include the
complete output:
virt-resize -v -x [...]
And i need to not destroy it. Is it possible?