aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydractl/provision17
1 files changed, 14 insertions, 3 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 9c4b32f..c3f4620 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -138,6 +138,7 @@ function hydra_provision_config {
fi
hydra_user_config disable_zeroing n "Disable zeroing of LVM volumes? (y/n)"
+ hydra_user_config discards n "Enable discards on volumes (TRIM etc)? (y/n)"
hydra_user_config hostname machine "Hostname"
hydra_user_config domain example.org "Domain"
hydra_user_config arch $base_arch "System arch"
@@ -153,6 +154,11 @@ function hydra_provision_config {
echo "You probably want to run provision-raspi instead of provision"
exit 1
fi
+
+ # Set discards config
+ if [ "$discards" == "y" ]; then
+ crypttab_discards=",discard"
+ fi
}
# Load configuration
@@ -444,19 +450,19 @@ echo "# <target name> <source device> <key file> <options>" | $SUDO tee $WORK
if [ "$encrypt" == "y" ]; then
cat <<-EOF | $SUDO tee $WORK/etc/crypttab > /dev/null
-root /dev/mapper/$vg-root none luks
+root /dev/mapper/$vg-root none luks$crypttab_discards
EOF
fi
if [ "$home_size" != "0" ] && [ "$encrypt" == "y" ]; then
cat <<-EOF | $SUDO tee -a $WORK/etc/crypttab > /dev/null
-home /dev/mapper/$vg-home none luks
+home /dev/mapper/$vg-home none luks$crypttab_discards
EOF
fi
if [ "$var_size" != "0" ] && [ "$encrypt" == "y" ]; then
cat <<-EOF | $SUDO tee -a $WORK/etc/crypttab > /dev/null
-var /dev/mapper/$vg-var none luks
+var /dev/mapper/$vg-var none luks$crypttab_discards
EOF
fi
@@ -516,6 +522,11 @@ EOF
fi
fi
+# LVM.
+if [ "$discards" == "y" ]; then
+ $SUDO sed -i -e 's/issue_discards = 0/issue_discards = 1' $WORK/etc/lvm/lvm.conf
+fi
+
# Boot device must be available before installing kernel and initramfs.
if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then
echo "Boot device setup..."