Feature changed by: Stefan Hundhammer (shundhammer) Feature #320834, revision 14 Title: [BETA 1 / 2] Create a /var/cache subvolume Requested by: Thorsten Kukuk (kukuk) Developer: YaST Maintainers mailing-list (yast2-maintainers) Partner organization: openSUSE.org Description: On the openSUSE Factory list, somebody found a valid bug in our current setup for snapshots: /var/cache is part of the snapshot. This means: all RPMs used for an update are part of the snapshot as they will be only deleted after creating the snapshot. This is a big problem if you regular update online, it will eat up your diskspace very fast. The same is true for all other cached data, there is no real sense in having them included into a snapshot, since they change very fast, they will only eat up disk space. We need to add /var/cache to the list of directories, for which we create a subvolume with btrfs. And (that's why I created a FATE and no bug) we need to add something to the release notes, so that customers are aware of this and can create the subvolume at their own for existing installations. Documentation Impact: snapper.xml Business case (Partner benefit): openSUSE.org: Save disk space by excluding irrelvant/outdated cached data from snapshots. Discussion: #1: Hannes Kühnemund (hkuehnemund) (2016-05-04 13:33:56) Just read the conversation on research and passed on to PrjMgr. #2: Jiri Srain (jsrain) (2016-05-05 13:28:59) Updated yast2-storage is on its way to SP2:GA (https://build.suse.de/request/show/114103). Keeping open for now, since the release notes entry to document how to create such subvolume in an installed system (without having any side effects) is missing. #3: Thorsten Kukuk (kukuk) (2016-05-10 13:42:43) I added some first, rough text for the release-notes. #4: Stefan Brüns (stefanbruens) (2016-05-18 03:07:18) on openSUSE, / is not created as subvolume @ (at least it was not with 13.2). Documentation how to mv /var/cache in this case would be nice Release Notes: Move /var/cache into an own subvolume for snapshots and rollback Challenge: - /var/cache contains a lot of very volatile data. Due to this - volatility, the size a snapshot needs increases very fast for data, - which is not needed anymore. + /var/cache contains a lot of very volatile data, like the zypper cache + with RPM packages in a lot of different versions for each update. Due + to this volatility, the size a snapshot needs increases very fast for + data, which is not needed anymore. Solution: To solve this, /var/cache should be moved into a separate subvolume. If you install with SLES12 SP2 or newer, this is done automatically during installation. For existing root file systems, do these steps manually: - - Explicitly mount the root file system's toplevel subvolume to another - mount point (/mnt in this example): - For SLE 12, that toplevel - subvolume is named "@": mount <root device> -o subvol=@ /mnt - btrfs - subvol create /mnt/var/cache - mv /var/cache/* /mnt/var/cache/ - umount - /mnt - Add an entry to /etc/fstab for the new /var/cache subvolume. - - grep var.crash /etc/fstab | sed -e 's|/var/crash|/var/cache|g' >> - /etc/fstab - mount /var/cache + - Explicitly mount the root file system's toplevel subvolume to a + temporary mount point (using /mnt in this description). <root_device> + is the device name of the root file system (/dev/sda2, /dev/sda3 etc.) + - For SLE 12 and recent Tumbleweed installations (it depends on when + the root file system was created!), that toplevel subvolume is named + "@": mount <root_device> -o subvol=@ /mnt + - For openSUSE 13.2 and older Tumbleweed installations, this does not + have a name, so you will have to use the subvolume ID. This ID is + always 5: + mount <root_device> -o subvolid=5 /mnt + - Create a new subvolume: + btrfs subvol create /mnt/var/cache + - Move all files and directories from the root file system's /var/cache + to the new subvolume: + mv /var/cache/* /mnt/var/cache/ + - Unmount the subvolume from the temporary mount point: + umount /mnt + - Add an entry to /etc/fstab for the new /var/cache subvolume. Use an + existing subvolume as a template to copy from. Make sure to leave the + UUID untouched (this is the root file systems's UUID) and change the + subvolume name and its mount point consistently to /var/cache. + - Mount the new subvolume as specified in /etc/fstab: + mount /var/cache -- openSUSE Feature: https://features.opensuse.org/320834