123 lines
3.2 KiB
Markdown
123 lines
3.2 KiB
Markdown
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=<new-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! |