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"
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
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
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..."