From ed89cb578cc75af461b3279f4c23bddb39d9f302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 14 Feb 2014 06:49:30 +0000 Subject: [PATCH] FedoraTemplateUpgrade changed added "compact root.img" section --- FedoraTemplateUpgrade.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/FedoraTemplateUpgrade.md b/FedoraTemplateUpgrade.md index 6ed792fa..8441822a 100644 --- a/FedoraTemplateUpgrade.md +++ b/FedoraTemplateUpgrade.md @@ -42,3 +42,25 @@ sudo yum --releasever=20 --setopt=cachedir=/mnt/removable distro-sync ``` After upgrade is finished, you can remove /var/tmp/template-upgrade-cache.img file. + +Compacting templates root.img +============================= + +fstrim, nor "discard" mount option do not work on template root fs, so when some file is removed in the template, space isn't freed in dom0. This means that template will use about twice a space that is really need after upgrade. + +You can compact root.img in the "old way": Start the template, fill all the free space with zeros, for example with: + +``` {.wiki} +dd if=/dev/zero of=/var/tmp/zero +(wait for "No space left on device" error) +rm -f /var/tmp/zero +``` + +Then shutdown template and all VMs based on it. Go into template directory in dom0 (/var/lib/qubes/vm-templates/fedora-20-x64 or so) and issue: + +``` {.wiki} +cp --sparse=always root.img root.img.new +mv root.img.new root.img +``` + +Done.