trim or discard mapped size disk from within the host machine

NabiKAZ

Member
May 6, 2017
25
2
23
42
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.
 

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!