уменьшить загрузочный раздел ext4 внутри образа qemu

Мне нужно уменьшить виртуальный размер моего загрузочного qemu образа (который скачан с glance) с 12G до 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 [...]

И мне нужно не уничтожить его. Возможно ли это?

0
задан 4 October 2021 в 21:38

0 ответов

Другие вопросы по тегам:

Похожие вопросы: