Migrating/Cloning to a new SSD

Hello,

I want to clone/migrate my Linux partition to a new 1 TB M.2 from my old 120 GB SSD, but I ran into some difficulties. It’s just Manjaro, no dual boot!

I tried using dd, since it supports ext4. The cloning itself seems to work perfectly fine using:

sudo dd if=/dev/sda of=/dev/nvme0n1 bs=64K conv=noerror,sync

Using gparted I can see the same “amount” of data on my new M.2 as on my old SSD, as well as the same partitions.

What doesn’t work however, is changing the UUID of the new drive. Following this guide ( How to move Linux root partition to another drive quickly | by Dominik Gacek | Medium ) I tried the following:

sudo mdir /mnt/new

sudo mount /dev/nvme0n1 /mnt/new

which outputs an error message:

mount.nilfs2: Error while mounting /dev/nvme0n1 on /mnt/new: Invalid argument

so I tried skipping this part of the tutorial coming straight to the UUID:

  1. generate new UUID:
    uuidgen

  2. rebrand M.2 UUID:

sudo tune2fs /dev/nvme0n1 -U 2f5d19a5-a1fd-4e5a-9858-081579002830

this however also outputs an error message (I did some translation on it):


tune2fs 1.46.4 (18-Aug-2021)
tune2fs: invalid magic number in the super block trying to open, /dev/nvme0n1
/dev/nvme0n1 contains data from „DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 1953525167 sectors, extended partition table (last)”

I did initialize the partition table of the M.2 as gpt.

Now I am stuck and don’t know how to proceed.

Is this even a valid attempt on migrating?

I know there are other tools to migrate (e.g. clonezilla). however these do not support the “ext4” type, which after some quick and shallow research should be superior to “ext3”.

Is there a way to do a new clean install and afterwards just copy the properties of my old partition?

In the beginning I thought: “just clone it, reboot and you’re done :^)”

Any help or alternative method is appreciated.

The standard form of the mount command, is

mount -t type device dir

mount(8): mount filesystem - Linux man page

You need to re-check the accuracy of that command.
What you did here is to copy the entire device (not just the contents of a partition on it)
to a partition on the other device

That can’t yield a working result.
You probably should be copying from /dev/sda1 … or whereever the system is that you want to transfer.

and also:

dd operates on a device level - the partitions and filesystems on it are completely irrelevant
it just copies raw data

Well copying the entire device is what I had in mind, since I wish to switch to the M.2 and use the SSD for some other purpose.

Is it not possible to “copy the device and reboot the new M.2”? that’s how I understood cloning when I was reading about it (well this and reconfiguring the UUID as well as grub).

Ok, that’s some nice detail to know, but it was more about making the point why I am not using clonezilla, or something else with a GUI. Well and it seemed fast and easy.

Even the guide that you used says to copy (dd) from
/dev/sdx1 to /dev/sdy1
from one partition to the other
as opposed to the equivalent of what you did
/dev/sdx to /dev/sdy1

I’d be creating partitions on the new device, create filesystems …
mount and use cp or rsync to copy the contents
and then readjust everything

… no, actually not - since this is much work and error prone
nvme drives are not the same as spinning disks - but I never had or used one myself
I’d just reinstall on the new device and then copy or replicate the configuration files.
But that is just me …

It might even work, despite my scepticism because of the difference between spinning disk vs nvme drive.
But you need to do the copying from one partition to another
(/dev/sdx1 to /dev/sdy1)

Might have been quicker as well, since I have been trying to get it working for 3 hours…

And like I said, I did interpret cloning/migrating like this:

I guess I’ll have a look the method with the configuration files.

I’ve always just used rsync. Never had any issues, no matter the ‘from’ and ‘to’ medium.

So I mixed up some information. Clonezilla does support ext4! Which is why I went and used it.

Here are the resources I used, may they help you as well as they helped me:

  1. This step by step guide, while in clonezilla:
  1. To creat a bootable Clonezilla USB drive:
    1. download your respective clonezilla iso: Clonezilla - Downloads
    1. create bootable usb stick with (sdc is my usb device): sudo dd if=clonezilla-live-2.8.1-12-amd64.iso of=/dev/sdc bs=1M (from Clone Any System - YouTube , linux part at ~2:30)

I am currently booted up on my new M.2, so far everything is exactly as it was before! Sorry for mixing things up!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.