aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-01-08 10:32:37 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-01-08 10:32:37 -0300
commit254c7def6f68b5529686d331b98c60a77780ff0f (patch)
treeed1c3e0a6c4ceab9d302498be91070a9d8cc659c
parent86f81339303d50696b37ccf92316811e66094110 (diff)
downloadhydra-254c7def6f68b5529686d331b98c60a77780ff0f.tar.gz
hydra-254c7def6f68b5529686d331b98c60a77780ff0f.tar.bz2
Feat: hydractl: provision: support for discards (TRIM)
-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..."