trim or discard mapped size disk from within the host machine

NabiKAZ

Member
May 6, 2017
25
2
23
43
About returning unused space (trim or discard mapped size disk)
I know about use `fstrim` command in guest vm.
But I can not login to the guest customers!
Now, my question is, is there any way to do this from within the host machine (main proxmox server)?
 
I should be enable "Qemu Agent" by this command:
Code:
root@pve:~# qm set 104 -agent 1
update VM 104: -agent 1
And then stop/start vm.
But when I try again get me another error:
Code:
root@pve:~# qm agent 104 fstrim
VM 104 qmp command 'guest-fstrim' failed - got timeout
 
Last edited:
Oops! Seem I just should be install "qemu-guest-agent" on guest.
Code:
# yum install qemu-guest-agent

Now works:
Code:
root@pve:~# qm agent 104 fstrim
{
   "paths" : [
      {
         "minimum" : 0,
         "path" : "/boot",
         "trimmed" : 951955456
      },
      {
         "minimum" : 0,
         "path" : "/",
         "trimmed" : 17067794432
      }
   ]
}


It's powerful ;-)

Thanks.