API resize disk VM

alex.d

New Member
Aug 30, 2022
19
1
3
pvesh set /nodes/nodes1/qemu/888/resize --disk scsi0 --size +100M

Go to VM 888 (debian)
echo -e 'yes\n\n' | parted ---pretend-input-tty /dev/sda resizepart 1 100%
or
yes | parted ---pretend-input-tty /dev/sda resizepart 1 100%
resize2fs /dev/sda1
Everything works on the virtual machine and the disk grows


pvesh create /nodes/nodes1/qemu/888/agent/exec -command 'echo' --command 'echo' --command "-e 'yes\n\n'" --command '|' --command 'parted' --command '---pretend-input-tty' --command '/dev/sda' --command 'resizepart' --command '1' --command '100%'
pvesh get /nodes/nodes1/qemu/888/agent/exec-status -pid ****
exitcode │ 0 │
├──────────┼────────────────────────────────────────────────────────────────────────────┤
│ exited │ 1 │
├──────────┼────────────────────────────────────────────────────────────────────────────┤
│ out-data │ echo -e 'yes\n\n' | parted ---pretend-input-tty /dev/sda resizepart 1 100%

When I do the same thing through the API call. The command to the server indicates that it was sent. But nothing is running on the server. Tell me what's the problem

LOG VM
Sep 8 09:39:24 debian qemu-ga: info: guest-ping called
Sep 8 09:39:24 debian qemu-ga: info: guest-exec called: "echo yes | parted ---pretend-input-tty /dev/sda resizepart 1 100%"
Sep 8 09:39:30 debian qemu-ga: info: guest-ping called
Sep 8 09:39:30 debian qemu-ga: info: guest-exec-status called, pid: 1769
 
Last edited:
Hello,
Debian + cloud-init
works :
qm guest exec 888 -- "/bin/bash" "-c" "echo yes | parted ---pretend-input-tty /dev/sda resizepart 1 100%"
or
pvesh create /nodes/nodes1/qemu/888/agent/exec -command "/bin/bash" --command "-c" --command "echo yes | parted ---pretend-input-tty /dev/sda resizepart 1 100%"
And autoresize
Thanks a lot.
 
  • Like
Reactions: aaron

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!