From 2ec29a4d4cc7dca7ebe760b792758bed6ae34689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 2 Apr 2019 18:04:26 +0200 Subject: [PATCH] Cleanup lvm archived metadata files Those files may easily accumulate in large quantities, to the point where just listing the /etc/lvm/archive directory takes a long time. This affects every lvm command call, so every VM start/stop. Those archive files are rarely useful, as Qubes do multiple LVM operations at each VM startup, so older data is really out of date very quickly. Automatically remove files in /etc/lvm/archive older than one day. Fixes QubesOS/qubes-issues#4927 Fixes QubesOS/qubes-issues#2963 --- rpm_spec/core-dom0-linux.spec.in | 2 ++ system-config/lvm-cleanup.cron-daily | 3 +++ 2 files changed, 5 insertions(+) create mode 100755 system-config/lvm-cleanup.cron-daily diff --git a/rpm_spec/core-dom0-linux.spec.in b/rpm_spec/core-dom0-linux.spec.in index 5b377ed..097d37f 100644 --- a/rpm_spec/core-dom0-linux.spec.in +++ b/rpm_spec/core-dom0-linux.spec.in @@ -127,6 +127,7 @@ install -m 0440 -D system-config/qubes.sudoers $RPM_BUILD_ROOT/etc/sudoers.d/qub install -D system-config/polkit-1-qubes-allow-all.rules $RPM_BUILD_ROOT/etc/polkit-1/rules.d/00-qubes-allow-all.rules install -D system-config/qubes-dom0.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/qubes-dom0.modules install -D system-config/qubes-sync-clock.cron $RPM_BUILD_ROOT/etc/cron.d/qubes-sync-clock.cron +install -D system-config/lvm-cleanup.cron-daily $RPM_BUILD_ROOT/etc/cron.daily/lvm-cleanup install -d $RPM_BUILD_ROOT/etc/udev/rules.d install -m 644 system-config/00-qubes-ignore-devices.rules $RPM_BUILD_ROOT/etc/udev/rules.d/ install -m 644 system-config/12-qubes-ignore-lvm-devices.rules $RPM_BUILD_ROOT/etc/udev/rules.d/ @@ -237,6 +238,7 @@ chmod -x /etc/grub.d/10_linux %config /etc/udev/rules.d/00-qubes-ignore-devices.rules %config /etc/udev/rules.d/12-qubes-ignore-lvm-devices.rules %attr(0644,root,root) /etc/cron.d/qubes-sync-clock.cron +/etc/cron.daily/lvm-cleanup %config(noreplace) /etc/profile.d/zz-disable-lesspipe.sh %config(noreplace) /etc/dnf/protected.d/qubes-core-dom0.conf /usr/lib/systemd/system-preset/75-qubes-dom0.preset diff --git a/system-config/lvm-cleanup.cron-daily b/system-config/lvm-cleanup.cron-daily new file mode 100755 index 0000000..25b5afb --- /dev/null +++ b/system-config/lvm-cleanup.cron-daily @@ -0,0 +1,3 @@ +#!/bin/sh + +find /etc/lvm/archive/ -type f -mtime +1 -name '*.vg' -delete