Let’s assume, for the sake of this guide, that you have an AHCI SSD at
/dev/sda and a NVMe SSD at
/dev/nvme0n1. Commands mentioned here assume you’re running Fedora 26.
Ideally, you’d want to perform the cloning task whilst booted into linux off a Live USB — Ubuntu/Fedora/Debian/<insert your favourite distro here> would work just fine; ideally you’d want to use one that has fairly mature drivers/kernel modules so that you can at least get to a shell and access the two devices listed above.
blkidare useful to get a mapping of the attached devices and file-system UUIDs.
fdisk -lprovides a more thorough listing into each device and its partitions etc.
We are going to use
dd will work just as well.
# (Optional) Removing partitions from the M.2 NVMe SSD (data still remains though!) dd status=progress if=/dev/zero of=/dev/nvme0n1 bs=16M count=1 conv=notrunc # Clone the AHCI SSD to the NVMe SSD dcfldd if=/dev/sda of=/dev/nvme0n1 status=on bs=64K - or - dd if=/dev/sda of=/dev/nvme0n1 status=progress bs=64K
At this point, you may assume that you can remove the AHCI SSD - however,
dracut will need configuring to ensure that when the boot loader loads the kernel and
initramfs image into memory (and then starts the kernel) that it will load drivers to support
This needs to be performed first on the AHCI SSD, so we’ll need to re-clone this over to the NVMe SSD afterwards
# Create the following file, with its contents shown below. [[email protected] ~]# cat /etc/dracut.conf.d/nvme.conf add_drivers+=" nvme " # Rebuild the initramfs [[email protected] ~]# dracut -f # Clone the AHCI SSD to the NVMe SSD - Once more! dcfldd if=/dev/sda of=/dev/nvme0n1 status=on bs=64K
That’s it, all you need to do now is issue
shutdown -h now, and unplug the AHCI SSD (or wipe it, if that’s your thing…)