qmp command 'guest-fstrim' failed - got timeout

janos

Well-Known Member
Aug 24, 2017
174
16
58
Hungary
www.awh.hu
Hi,

On a CentOS 7 VM with CEPH backend, i can run fstrim inside the VPS without issue:

Code:
~ # time fstrim -a -v
/data: 0 B (0 bytes) trimmed
/boot: 817.9 MiB (857587712 bytes) trimmed
/: 13 GiB (13946646528 bytes) trimmed

real    0m15.663s
user    0m0.013s
sys     0m0.026s

I try to do this via the agent:

Code:
qm guest cmd 144 fstrim
But this is the result:
Code:
VM 144 qmp command 'guest-fstrim' failed - got timeout

I see this in the VM syslog:
Code:
Dec  7 20:54:58 proxy qemu-ga: info: guest-ping called
Dec  7 20:54:58 proxy qemu-ga: info: guest-fstrim called

I think, qm try to wait for the respond, and after few seconds it run to timeout, what is normal because fstrim can run several sec or min. However i do not see timeout settings for "guest cmd" command.

Any idea?
 
Now I get this in 7.4-3

Code:
# qm guest exec 106 fstrim -- -a
timeout reached, returning pid
{
   "pid" : 30791
}
 
Hi,
Now I get this in 7.4-3

Code:
# qm guest exec 106 fstrim -- -a
timeout reached, returning pid
{
   "pid" : 30791
}
how large is your disk? What kind of underlying storage do you have (network storage)? The timeout is 10 minutes now, but maybe that still is not enough for you.
 
Storage is local zpool. 350G with 200G used.

I didn't time it, but I think it was under a minute, certainly not ten.

Just tried again, this time it succeeded after 26 seconds. Seems it's a bit hit and miss.
 
Storage is local zpool. 350G with 200G used.

I didn't time it, but I think it was under a minute, certainly not ten.

Just tried again, this time it succeeded after 26 seconds. Seems it's a bit hit and miss.
Ah, you're right. There is a different timeout depending on whether the command is issued via API or via CLI. And the default in the CLI is 30 seconds. But it's not a big deal, you get the PID and the command will just continue inside the VM. If you do want to wait for it, just use qm guest exec 106 fstrim --timeout <seconds> -- -a with a large timeout.
 

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!