From 7f5136210aff6ae9f746a0eefffd41ecdee6d2a3 Mon Sep 17 00:00:00 2001 From: sfajeff Date: Mon, 5 Sep 2022 23:09:19 -0500 Subject: [PATCH] Add '5.update-fstab.sh' --- 5.update-fstab.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 5.update-fstab.sh diff --git a/5.update-fstab.sh b/5.update-fstab.sh new file mode 100644 index 0000000..f4a5a79 --- /dev/null +++ b/5.update-fstab.sh @@ -0,0 +1,24 @@ +#!/bin/bash +PI_SERIAL="3079dde4" +TFTP_ROOT="/volume1/rpi/tftpboot/" +ISCSI_ROOT_PARTITION="/dev/sda1" +ISCSI_ROOT_DIR="/tmp/tmp.8feKTYMg0S" +ISCSI_TARGET_IQN="iqn.2000-01.com.synology:SynologyNAS.default-target.b63ef49539c" + +# Update /boot to point to the NFS mount of the TFTP folder for the Pi. +NFS_IP="192.168.1.5" +NFS_ROOT_PATH="${TFTP_ROOT}${PI_MAC}" +sudo sed -i -r -E \ + "s@.*/boot +.*@${NFS_IP}:${NFS_ROOT_PATH} /boot nfs defaults,vers=4.1,proto=tcp 0 0@" \ + ${ISCSI_ROOT_DIR}/etc/fstab + +# Update / to point to the iSCSI drive. +ISCSI_ROOT_PARTUUID=$(sudo blkid | grep ${ISCSI_ROOT_PARTITION} | tr ' ' '\n' | grep PARTUUID | cut -d '=' -f 2 | tr -d '"') +sudo sed -i -r -E \ + "s@.*/ +.*@PARTUUID=${ISCSI_ROOT_PARTUUID} / ext4 _netdev,noatime 0 1@" \ + ${ISCSI_ROOT_DIR}/etc/fstab + +# The connection to the iSCSI device is no longer needed, so clean it up. +#sudo umount ${ISCSI_ROOT_DIR} +#sudo iscsiadm --m node -T ${ISCSI_TARGET_IQN} --portal ${ISCSI_TARGET_IP}:3260 -u +#sudo iscsiadm -m node -o delete -T ${ISCSI_TARGET_IQN} --portal ${ISCSI_TARGET_IP}:3260 \ No newline at end of file