diff --git a/move_ssd.md b/move_ssd.md index e69de29..3b5c9d8 100644 --- a/move_ssd.md +++ b/move_ssd.md @@ -0,0 +1,123 @@ +Step-by-Step Instructions +📀 1. Clone the OS to the New SSD + +We’ll start by cloning your OS from /dev/nvme0 to the new SSD (/dev/nvme1). +a) Partition and Format the New SSD + +First, partition the new SSD (/dev/nvme1) and create the root partition: + +# Launch fdisk to partition the new SSD +sudo fdisk /dev/nvme1 + + Type g to create a GPT partition table (if it's not already). + + Type n to create a new partition, use the entire disk. + + Type w to write the partition table. + +Then, format the new partition (/dev/nvme1p1): + +sudo mkfs.ext4 /dev/nvme1p1 + +b) Mount the New SSD + +Create a mount point and mount the new SSD: + +sudo mkdir /mnt/ssd +sudo mount /dev/nvme1p1 /mnt/ssd + +c) Clone the OS from /dev/nvme0 to /dev/nvme1 + +Now, we’ll copy the entire root filesystem, excluding /home, to the new SSD: + +sudo rsync -aAXv / --exclude=/home --exclude=/proc --exclude=/sys \ +--exclude=/dev --exclude=/run --exclude=/mnt --exclude=/tmp \ +/mnt/ssd/ +################################################################################################### +This command copies the entire OS and system data but excludes /home, as we’ll sync that separately later. +🧩 2. Prepare the New SSD to Boot +a) Mount Necessary Filesystems and Chroot + +To make the new installation bootable, we need to bind mount critical filesystems and chroot into the new root. + +for dir in dev proc sys; do +sudo mount --bind /$dir /mnt/ssd/$dir +done + +If you are using UEFI, you might also need to mount the EFI partition: + +sudo mount /dev/nvme0p1 /mnt/ssd/boot/efi # Adjust if needed + +Now, enter the chroot environment: + +sudo chroot /mnt/ssd + +b) Update /etc/fstab + +Make sure /etc/fstab points to the correct root filesystem and removes any /home partition references. + +blkid # Get the UUID of /dev/nvme1p1 +nano /etc/fstab + +Ensure the / entry is updated to use the new SSD, for example: + +UUID= / ext4 defaults 0 1 + +And remove or comment out any /home partition entry. +c) Install GRUB on the New SSD + +Now install GRUB to make the system bootable from /dev/nvme1. + +grub-install /dev/nvme1 +update-grub +exit + +🔄 3. Reboot from the New SSD + + Reboot the system. + + Go into BIOS/UEFI and set /dev/nvme1 as the primary boot drive. + + Boot into the new SSD. + +📁 4. Sync /home from /dev/sda (Old Home Drive) + +Now, we’ll sync the /home data from the old drive (/dev/sda) onto the new root partition. +a) Mount the Old /home Drive + +First, mount /dev/sda (the old /home drive): + +sudo mount /dev/sda1 /mnt/oldhome + +b) Sync /home to the New SSD + +Now, copy the /home data: + +sudo rsync -aAXv /mnt/oldhome/ /home/ + +Make sure /home is mounted correctly on /dev/nvme1p1 (the new SSD) by checking with df -h or lsblk. +🧹 5. Cleanup (Optional) + +Once you verify everything works as expected: + + Remove /home entry from /etc/fstab if it exists. + + You can either repurpose or wipe the old drives (/dev/nvme0 and /dev/sda). + + Confirm everything is working fine and you’re now booting from /dev/nvme1. + +✅ Final Checks + + Check disk usage: + +df -h + + Verify partitioning: + +lsblk + + Verify boot order in BIOS/UEFI to make sure you're booting from /dev/nvme1. + +This approach ensures you move everything safely, with minimal risk of data loss. + +Let me know if you encounter any issues or need further clarification! \ No newline at end of file diff --git a/restartcaddy.sh b/restartcaddy.sh index 9726b98..738d239 100755 --- a/restartcaddy.sh +++ b/restartcaddy.sh @@ -1,9 +1,11 @@ -(cd "/home/soenke/docker/" && echo "" > newCaddyfile) +(cd "/home/soenke/docker/" && echo "" > ./caddy/newCaddyfile) for dir in *; do if [ -d "$dir" ]; then - ( cd "$dir" && cat Caddyfilepart >> ../newCaddyfile) + ( cd "$dir" && cat Caddyfilepart >> ../caddy/newCaddyfile) fi done - +( cd "/home/soenke/docker/caddy" ) +( mv Caddyfile Caddyfile.bak) +( mv newCaddyfile Caddyfile) ( cd "/home/soenke/docker/caddy" && docker compose down && docker compose pull && docker compose up -d) diff --git a/scratch_4.md b/scratch_4.md index e69de29..6fc21f0 100644 --- a/scratch_4.md +++ b/scratch_4.md @@ -0,0 +1,34 @@ +sudo mount /dev/nvme0p1 /mnt/newssd/boot/efi +sudo chroot /mnt/newssd + + + +/dev/nvme1n1p1: UUID="ad271484-f3d7-4065-b1b7-224cdd4cd1ca" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3c04012f-35d1-a64d-bc80-04382a24d521" + + +soenke@heimdall:/var/cache$ sudo blkid +/dev/nvme0n1p3: UUID="4476761c-6ba1-4ef7-bb5f-81f38f96ff44" TYPE="swap" PARTUUID="f60a9a77-2842-40ab-9315-e92e35f42ca6" +/dev/nvme0n1p1: UUID="1504-1CE6" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="c4c73403-14cd-4a99-842c-a02c5c772214" +/dev/nvme0n1p2: UUID="f6b9a157-815a-4f61-a463-0caf165a92b4" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="260bc56c-585a-446f-b2c2-ba7e1057289d" +/dev/sda1: UUID="c810ee0e-35ab-4f2a-a273-0a94ea401731" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="721505ac-9419-4475-9843-e5058fb41550" + +vi /etc/fstab + +# Use 'blkid' to print the universally unique identifier for a +# device; this may be used with UUID= as a more robust way to name devices +# that works even if disks are added and removed. See fstab(5). +# +# systemd generates mount units based on this file, see systemd.mount(5). +# Please run 'systemctl daemon-reload' after making changes here. +# +# +# / was on /dev/nvme0n1p2 during installation +UUID=ad271484-f3d7-4065-b1b7-224cdd4cd1ca / ext4 errors=remount-ro 0 1 ### change this line to uuid of nvme1(or 1)n1p2 (ext4 one...) -> f6b9a157-815a-4f61-a463-0caf165a92b4 +# /boot/efi was on /dev/nvme0n1p1 during installation +UUID=1504-1CE6 /boot/efi vfat umask=0077 0 1 +# /home was on /dev/sda1 during installation +# UUID=c810ee0e-35ab-4f2a-a273-0a94ea401731 /home ext4 defaults 0 2 ####Re-Add this one? +# swap was on /dev/nvme0n1p3 during installation +UUID=4476761c-6ba1-4ef7-bb5f-81f38f96ff44 none swap sw 0 0 + +