Update '4.copy-root-contents.sh'

This commit is contained in:
2022-09-07 15:24:20 -05:00
parent b00d2bbcda
commit 2ccabf911b
+5 -4
View File
@@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
ISCSI_ROOT_PARTITION="/dev/sda1" ISCSI_ROOT_PARTITION="/dev/sda1"
ISCSI_ROOT_DIR="/dev/sda" ISCSI_ROOT_DIR="/iscsi/$(hostname -s)-iscsi"
# Create the btrfs Filesystem # Create the btrfs Filesystem
sudo mkfs.btrfs /${ISCSI_ROOT_PARTITION} sudo mkfs.btrfs -f /${ISCSI_ROOT_PARTITION}
ISCSI_ROOT_DIR="$(mktemp -d)" #ISCSI_ROOT_DIR="$(mktemp -d)"
sudo mkdir -p ${ISCSI_ROOT_DIR}
sudo mount "${ISCSI_ROOT_PARTITION}" ${ISCSI_ROOT_DIR} sudo mount "${ISCSI_ROOT_PARTITION}" ${ISCSI_ROOT_DIR}
# Mount the Root Partion in the Generated Image # Mount the Root Partion in the Generated Image
@@ -15,7 +16,7 @@ sudo mount "${ISCSI_ROOT_PARTITION}" ${ISCSI_ROOT_DIR}
# Begin the Copy # Begin the Copy
#sudo rsync -a --info=progress2 "${IMAGE_ROOT_DIR}/" ${ISCSI_ROOT_DIR} #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. # The generated image is no longer needed, so we can cleanup.
#sudo umount ${IMAGE_ROOT_DIR} #sudo umount ${IMAGE_ROOT_DIR}