From f047c79e54c33417dcdad5c298cb6c8db1e62aa9 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:00 -0400 Subject: [PATCH] Set discard on system disk if supported --- templates/install.sh | 14 +++++++++++--- templates/installer.list.chroot | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/templates/install.sh b/templates/install.sh index 934d04e..4471e3d 100755 --- a/templates/install.sh +++ b/templates/install.sh @@ -800,10 +800,18 @@ for disk in /dev/disk/by-path/*; do fi done +# Check if TRIM is supported on the root disk +if hdparm -I ${target_disk} | grep --silent "TRIM supported"; then + extdiscard="discard," +else + extdiscard="" +fi + echo -n "Adding fstab entries... " -echo "/dev/mapper/vgx-root / ${filesystem} errors=remount-ro 0 1" | tee -a ${target}/etc/fstab >&2 -echo "/dev/mapper/vgx-ceph /var/lib/ceph ${filesystem} errors=remount-ro 0 2" | tee -a ${target}/etc/fstab >&2 -echo "/dev/mapper/vgx-zookeeper /var/lib/zookeeper ${filesystem} errors=remount-ro 0 2" | tee -a ${target}/etc/fstab >&2 +echo "# fstab configuration for PVC hypervisor" | tee ${target}/etc/fstab >&2 +echo "/dev/mapper/vgx-root / ${filesystem} defaults,${extdiscard}errors=remount-ro 0 1" | tee -a ${target}/etc/fstab >&2 +echo "/dev/mapper/vgx-ceph /var/lib/ceph ${filesystem} defaults,${extdiscard}errors=remount-ro 0 2" | tee -a ${target}/etc/fstab >&2 +echo "/dev/mapper/vgx-zookeeper /var/lib/zookeeper ${filesystem} defaults,${extdiscard}errors=remount-ro 0 2" | tee -a ${target}/etc/fstab >&2 echo "/dev/mapper/vgx-swap none swap sw 0 0" | tee -a ${target}/etc/fstab >&2 echo "${bypath_disk}-part3 /boot ext2 defaults 0 2" | tee -a ${target}/etc/fstab >&2 echo "${bypath_disk}-part2 /boot/efi vfat umask=0077 0 2" | tee -a ${target}/etc/fstab >&2 diff --git a/templates/installer.list.chroot b/templates/installer.list.chroot index 0dc0206..f2b3248 100644 --- a/templates/installer.list.chroot +++ b/templates/installer.list.chroot @@ -1 +1 @@ -live-task-standard live-tools live-boot live-boot-initramfs-tools psmisc mdadm lvm2 parted gdisk dosfstools debootstrap sipcalc vim ca-certificates vlan tftp-hpa curl ipmitool lsscsi +live-task-standard live-tools live-boot live-boot-initramfs-tools psmisc mdadm lvm2 parted gdisk dosfstools debootstrap sipcalc vim ca-certificates vlan tftp-hpa curl ipmitool lsscsi hdparm