[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guest fstrim does not unmap, sometimes

From: Narcis Garcia
Subject: Guest fstrim does not unmap, sometimes
Date: Wed, 7 Oct 2020 10:49:57 +0200


I've a host with Debian 10 and Qemu 3.1 to run a guest with Debian 10:

$ qemu-system-x86_64 -cpu host -m 57344 -display curses -enable-kvm
-device virtio-scsi -boot c -drive
-smp cores=10,threads=2 -vga virtio

After guest installation and diverse operations, my "raw" disk image
(MyGuest_sda.img) has an apparent size of 10TiB and 84 GiB really allocated.

Guest filesystems are using only 3GiB; then I run there:
$ fstrim -a -v
/boot: 866.7 MiB (908754944 bytes) trimmed on /dev/sda2
/: 9.9 TiB (10903472549888 bytes) trimmed on /dev/sda3
$ sync
$ sudo /etc/cron.daily/fstrim
/boot: 0 B (0 bytes) trimmed on /dev/sda2
/: 0 B (0 bytes) trimmed on /dev/sda3
$ sync

but nothing changes on host.
If I allocate 100GiB in guest with dd command (writing zeroes), guest
sees 103GiB used and host sees 184GiB allocated. After removing that
temporary file, automatically that space is unmapped:
Guest 3GiB used, host 84GiB allocated.

How can I unmap that 81GiB of excess?

Thank you.


Narcis Garcia

reply via email to

[Prev in Thread] Current Thread [Next in Thread]