From 2ccabf911b05afe41df509373ea2b465ef54b2f9 Mon Sep 17 00:00:00 2001 From: sfajeff Date: Wed, 7 Sep 2022 15:24:20 -0500 Subject: [PATCH] Update '4.copy-root-contents.sh' --- 4.copy-root-contents.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/4.copy-root-contents.sh b/4.copy-root-contents.sh index 1c225ea..f157f5c 100644 --- a/4.copy-root-contents.sh +++ b/4.copy-root-contents.sh @@ -1,10 +1,11 @@ #!/bin/bash ISCSI_ROOT_PARTITION="/dev/sda1" -ISCSI_ROOT_DIR="/dev/sda" +ISCSI_ROOT_DIR="/iscsi/$(hostname -s)-iscsi" # Create the btrfs Filesystem -sudo mkfs.btrfs /${ISCSI_ROOT_PARTITION} -ISCSI_ROOT_DIR="$(mktemp -d)" +sudo mkfs.btrfs -f /${ISCSI_ROOT_PARTITION} +#ISCSI_ROOT_DIR="$(mktemp -d)" +sudo mkdir -p ${ISCSI_ROOT_DIR} sudo mount "${ISCSI_ROOT_PARTITION}" ${ISCSI_ROOT_DIR} # Mount the Root Partion in the Generated Image @@ -15,7 +16,7 @@ sudo mount "${ISCSI_ROOT_PARTITION}" ${ISCSI_ROOT_DIR} # Begin the Copy #sudo rsync -a --info=progress2 "${IMAGE_ROOT_DIR}/" ${ISCSI_ROOT_DIR} -sudo rsync -xa --progress --exclude /nfs / ${ISCSI_ROOT_DIR} +sudo rsync -xa --progress --exclude /nfs --exclude /iscsi / ${ISCSI_ROOT_DIR} # The generated image is no longer needed, so we can cleanup. #sudo umount ${IMAGE_ROOT_DIR}