Skip to content

Commit 605cb47

Browse files
committed
Enable LVM autoextend and set default value to 90 for thin_pool
Fixes QubesOS/qubes-issues#5826
1 parent ea5f370 commit 605cb47

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

rpm_spec/core-dom0-linux.spec.in

+22
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,28 @@ if [ $1 -ge 2 ]; then
192192
fi
193193
fi
194194

195+
# setup thinpool autoextend
196+
if [ -e /etc/lvm/lvm.conf ]; then
197+
tpool_threshold_line_value=$(grep -n -Po '^[^#]thin_pool_autoextend_threshold[ \t]*=[ \t]*\K\d+' /etc/lvm/lvm.conf)
198+
if [ -n "$tpool_threshold_line_value" ]; then
199+
tpool_threshold_line="$(echo "$tpool_threshold_line_value" | cut -d':' -f1)"
200+
tpool_threshold_value="$(echo "$tpool_threshold_line_value" | cut -d':' -f2)"
201+
202+
prev_line="$(sed -n "$((tpool_threshold_line-1))p" /etc/lvm/lvm.conf)"
203+
qubes_comment='# QUBES OS: Custom value detected, not enforcing default. Recommended value: 90'
204+
205+
if [ "$tpool_threshold_value" == 100 ]; then
206+
sed -i 's|^\([^#]thin_pool_autoextend_threshold\)[ \t]*=.*|\1 = 90|' /etc/lvm/lvm.conf
207+
208+
systemctl restart lvm2-monitor
209+
else
210+
if [ "$tpool_threshold_value" != 90 ] && [ "$prev_line" != "$qubes_comment" ]; then
211+
sed -i "${tpool_threshold_line}i $qubes_comment" /etc/lvm/lvm.conf
212+
fi
213+
fi
214+
fi
215+
fi
216+
195217
%preun
196218
if [ "$1" = 0 ] ; then
197219
# no more packages left

0 commit comments

Comments
 (0)