Skip to content

Commit

Permalink
Update copy-rootfs-ssd.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
LinirZamir authored Mar 21, 2023
1 parent b35bde3 commit 3fdcb30
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions copy-rootfs-ssd.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
#!/bin/bash
# Mount the SSD as /mnt
sudo mount /dev/nvme0n1p1 /mnt
# Copy over the rootfs from the SD card to the SSD

if [ "$#" -ne 1 ]; then
echo "Usage: $0 <nvme|usb>"
exit 1
fi

device_type=$1
device_path=""

if [ "$device_type" == "nvme" ]; then
device_path="/dev/nvme0n1p1"
elif [ "$device_type" == "usb" ]; then
device_path="/dev/sda1"
else
echo "Invalid device type. Supported types: nvme, usb"
exit 1
fi

# Mount the device as /mnt
sudo mount $device_path /mnt
# Copy over the rootfs from the SD card to the device
sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude={"/dev/","/proc/","/sys/","/tmp/","/run/","/mnt/","/media/*","/lost+found"} / /mnt
# We want to keep the SSD mounted for further operations
# So we do not unmount the SSD
# We want to keep the device mounted for further operations
# So we do not unmount the device

0 comments on commit 3fdcb30

Please sign in to comment.