I’ll be using the Arch Linux Live ISO.
- Intel 730 480GB SSD
- Intel 750 400GB NVMe SSD
- /dev/sda1 is /boot
- /dev/sda2 is LUKS and mounted as / (ext4)
- No GRUB bootloader - only EFI
Backup your data!
If both drives were exactly the same size you could just use
dd and not worry about copying files. I’ve used the
dd method many times when migrating between different SSDs of the same or larger size.
This shows the 480GB SSD as
/dev/sdaand the new NVMe device as
/dev/sda2partition use cryptsetup.
cryptsetup luksOpen /dev/sda2 rootfs
I’m going to check the remaining space on the drive to make sure there’s enough space on the new drive.123mount /dev/mapper/rootfs /mntdf -humount /mnt
I have 179G used which leaves plenty of room.
Create the partition table on the NVMe SSD.
The first partition will be 512M allocated to EFI. The second partition will be for LUKS and will take up the remaining space on the disk.
Use cryptsetup to format the new LUKS partition.
cryptsetup luksFormat --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 /dev/nvme0n1p2
Open the new encrypted partition.
cryptsetup luksOpen /dev/nvme0n1p2 rootnew
Format with ext4.
Format the EFI partition with FAT32
mkfs.fat -F32 /dev/nvme0n1p1
Create new folders for mount points.12345mkdir /mnt/old /mnt/newmount /dev/mapper/rootfs /mnt/oldmount /dev/mapper/rootnew /mnt/newmount /dev/sda1 /mnt/old/bootmount /dev/nvme0n1p1 /mnt/new/boot
Copy the files over to the new drive.
cp -afv /mnt/old/* /mnt/new/
Copying took about an hour to complete.
/etc/fstabto contain the new UUID. Use
blkidto list block device UUIDs.
/boot/loader/entries/arch.confto contain the LUKS UUID.
mkinitcpio -p linux
Shutdown and unplug the old SSD.
If you did everything correctly, on boot it will ask you for the password to unlock the device. If not, check your boot devices in the BIOS.