How to trim AppVm's data to match the correct size inside?

111 views
Skip to first unread message

8c36b1b85a745a25508d01ced9335bef7a1e4ed1

unread,
Oct 9, 2016, 9:19:47 AM10/9/16
to qubes-users
I have delete a lot of big datas on one of my appvm, but the problem is the size doesn't change eventhough 'df -h' in the appvm shows that the user's data already decreased. Qubes-Manager and dom0 still recognised its size with the old values. How can i proceed to decrease it?

yaqu

unread,
Oct 9, 2016, 10:54:11 AM10/9/16
to qubes...@googlegroups.com
Procedure should be similar to compacting templates:
https://www.qubes-os.org/doc/fedora-template-upgrade-21/#compacting-the-upgraded-template

Inside VM fill unused space on private.img with zeros:

[user@untrusted ~]$ dd if=/dev/zero of=/home/user/zero
[user@untrusted ~]$ rm /home/user/zero

And then copy image in dom0:

[user@dom0 ~]$ qvm-shutdown --wait untrusted
[user@dom0 ~]$ cd /var/lib/qubes/appvms/untrusted/
[user@dom0 ~]$ cp --sparse=always private.img private.img.new
[user@dom0 ~]$ mv private.img.new private.img

But I have just noticed, that after removing big files in appvm, its
private.img has been automagically compacted, without using this
procedure. Tested on R3.2 and fedora23-based appvm.

--
yaqu

8c36b1b85a745a25508d01ced9335bef7a1e4ed1

unread,
Oct 9, 2016, 12:20:56 PM10/9/16
to qubes-users, qubes...@openmailbox.org

Excellent, it's working. Thanks for your answer. I skipped the dd part since I already delete big files before that and its still works.

Chris Laprise

unread,
Oct 10, 2016, 12:13:17 PM10/10/16
to 8c36b1b85a745a25508d01ced9335bef7a1e4ed1, qubes-users, qubes...@openmailbox.org
Space should be recovered automatically if your template is set to mount
/rw with the 'discard' option. That is the Qubes default.

You can do a one-time recovery simply with 'sudo fstrim -v /rw' . There
should be no need to resort to long brute force methods like using dd
and cp.

Chris
Reply all
Reply to author
Forward
0 new messages