qemu-img resize - make hdd smaller

informant

Renowned Member
Jan 31, 2012
780
10
83
hi all, i have a problem. i have a 1T hdd in my proxmox and would make it smaller to 150G.
- i have shutdown vm
- i have start gparted and shrink vda1 to 150G
- i have copy qcow2 file as backup
- i have convert qcow2 file to raw
- i have resize raw -- -874G
- i have convert new raw back to qcow2
- i have start debian and get a error message....

can you help ? what can i do here?
regards
 

Attachments

  • errormsg.png
    errormsg.png
    10.4 KB · Views: 42
hi udo, thanks, i have done
it with systemrescuecd already, here result:



what can i do here?
regards
 

Attachments

  • 1.png
    1.png
    8.9 KB · Views: 23
  • 2.png
    2.png
    7.6 KB · Views: 4
  • 3.png
    3.png
    20 KB · Views: 10
Last edited:
Hi,
with your mkfs on vda (not vda1) you have destroyed successfully your filesystem on vda1!!

In your case, you have also vdaX in an extended partition - i guess for swap - which are outside of the new hdd-size!

Copy again your backup, disable swap (fstab), remove the swap-partition and the extended partiion.
After that, you can resize the fs of vda1 again and after that resize the partition and last the disk.
If all work, create vda2 as swap.

Udo
 
hi udo, thanks for answer again, but don´t work. or do i have forgett a option?
i have 1st comment out swap in fstab
than stop vm
than start vm with gparted cd
than remove swap and extended
than resize vda1 smaller to 150gb
than apply
than stop
than convert to raw
than resize to 150gb
than convert to qcow2
than start, but same information comes.... initramfs screen...

i have also stop vm again, resize disk over web 8gb more (1gb more works too) and restart, starts normal
here screen: is it all or do i have forgett a option,
swap and extended i must create yes, but other ok?

regards
 

Attachments

  • 4.png
    4.png
    8.6 KB · Views: 10
Last edited:
hi udo, thanks for answer again, but don´t work. or do i have forgett a option?
i have 1st comment out swap in fstab
than stop vm
than start vm with gparted cd
than remove swap and extended
than resize vda1 smaller to 150gb
than apply
than stop
than convert to raw
than resize to 150gb
than convert to qcow2
than start, but same information comes.... initramfs screen...
any ideas? regards
Hi,
do you change the disk from virtio to scsi?
The partition table don't fit to the disk-size - so you must start an live-cd and repair the partition-table.

Perhaps an mkinitrd (depends on your vm-distro) and grub-update will also an good idea.

Udo
 
hi, no disk was not change. virtio scsi is active in web interface.
what was command to repair partition-table?
and what you mean with mkinitrd this is new for me :)
regards

this is my actual stand:
 

Attachments

  • 5.png
    5.png
    10.4 KB · Views: 5
Last edited:
hi, no disk was not change. virtio scsi is active in web interface.
Hmm, but this don't fit with vda... this must be "harddisk (virtio0)" in the gui and not "harddisk (scsi0)".
Does the boot order (options) fit to the harddisk?
what was command to repair partition-table?
normaly detect fdisk the wrong size and ask for repairing...
But your partition table looks valid for me.
and what you mean with mkinitrd this is new for me :)
regards
What kind of OS (version) do you have inside the VM? grub1/grub2/lilo?
If you have an old linux, it can happens, that only the virtio-driver is included in initrd/initramfs and if you changed from virtio to scsi, you must create an new one...


Udo
 
hi udo,

also inside run last debian version with grub2. after resize in webinterface, chkdsk run automatical on start 1x. i mean, system is ok or?
this are webinterface options, i mean are ok, or?


regards
 

Attachments

  • 1.png
    1.png
    7.8 KB · Views: 13
  • 2.png
    2.png
    4.6 KB · Views: 8

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!