Need Help Cloning HDD to SSD

Ok, I’m attempting to clone the 500GB HDD in my Thinkpad to a 480GB SSD in an external USB enclosure.

While booted to a live Linux Mint USB;

First, I shrank the main partition on the HDD with GParted so that the total size of all partitions would fit within the 480GB on the SSD.

Next, I ran the dd command to copy sda1(the HDD) to sdc1(the SSD) which was about 30GB and that completed without error. It filled the SSD with that partition, so I shrank it to 30GB with GParted so that the rest of the SSD is unallocated.

I then ran fdisk /dev/sdc and created a new 2nd partition on the rest of the SSD (sdc2) which showed up fine as ‘linux file system’ under fdisk -l.

Now, when I try to run dd to copy sda2 to sdc2, it runs and gets to about 4.1GB copied, then says; No space left on device and stops.

I’m not sure what the problem is or what I’m doing wrong. There’s definitely enough space on the SSD for the 2nd partition.

The HDD has an Arch Linux installation which I’m trying to clone to the SSD to swap into this device.

Thanks in advance.

EDIT: I was also using the following parameters with the dd command:
bs=64K conv=noerror,sync status=progress
as per the Arch Linux wiki instructions for cloning partitions.

1 Like

I can’t help with copying the partitions manually but have you considered using something like Clonezilla to clone the drive?

You can create a Clonezilla Live USB which you can use to boot your laptop and clone from the source drive to the target. It will take care of copying all the partitions (I think it does a sector level clone)

Using something like Clonezilla Live USB also means that your source HDD isn’t in use during the clone which might cause problems.

I’m booted on a live Linux Mint USB while performing these operations, so the source and destination drives are not mounted or in-use. I will keep clonezilla in mind in case I can’t get this to work. Thanks. :slight_smile:

There’s another issue, though; it seems I cannot format the unallocated sector after the 1st 30GB partition on the SSD now. It “says” it partitioned it and shows up under fdisk as sdc2 linux file system, however in GParted, it shows as an ‘unknown’ partition…

Um, you know you can copy and paste partitions in GParted, and it will do all the background stuff itself?

I did not know that, thanks.

Part of the reason I wanted to do this via CLI was to learn how to do it manually. But if I can’t get this to work, I might attempt as you suggested via GParted.

It doesn’t recognise all files system types, and can’t always copy, but will give useful error codes, especially with windows partitions that are not in a safe state to copy

Fair play, and good to practice, learn and experience…
I can see why you are doing it partition by partition, because dd doesn’t like going from large to small…

Have you looked Into Ddrescue? It’s based on DD, but for disk to disk might be able to go from large to small

Yeah, I can’t see why it wouldn’t work as I’m attempting. And not sure why the remaining unallocated sector of the SSD will not format correctly.

Haven’t looked into ddrescue yet. Thanks for the suggestion.

Try to use Acronis True Image. It serves me well. I did not have any problems with moving HDD->SSD.
https://files.fm/u/5gyn9nun

1 Like

Thanks. I’m attempting to copy using GParted now, but will keep this as another option should this fail.

Ok, so, GParted successfully copied the first 30GB partition, but then threw up an error (not enough space) when trying to copy the 2nd partition - even though there IS enough space…

Created a bootable USB with Acronis img using rufus on a separate windows machine, but it will not boot on this device and will not let me create a bootable USB for legacy (UEFI option only). It’s an older ThinkPad T410 that is non-UEFI (legacy).

The large partition, is it a Windows C:\ partition?

Because if it just a data partition, you might have better luck creating a partition and copying the files across?

As mentioned in the OP, it’s an Arch Linux installation I’m trying to clone.

The larger second partition is the /home partition.

The 1st partition is the /root

So the root partition copied okay, but the home one didn’t?
I would leave the home partition for now, make sure you can boot from the ssd, then manually copy the home data.
It seems like you pretty much know what you are doing, and that you would expect there to be a load of hidden .files and .folders.

The reason I asked about Windows is because the system wouldn’t boot unless the partition uuid matches, and a checkdisk/ integrity check needs to be run after a resize

After swapping in the SSD with the root partition copied, it will not boot. Assuming I need to run grub repair…

I sort of know what I’m doing, lol. I know what I want to do and, more or less, how to do it, I just don’t know why it’s not working. :wink:

Okay, glad you are playing and practicing though. You might need an efi partition/ boot section separate to the root partition, in which case it might be easier to fresh install on the ssd, create a separate home partition, then copy the home data from the hdd?
I am surprised the root was sda1, but didn’t include the boot config, but it’s been a long time since I played with Arch.
You might alternatively look on the wiki for how to generate a boot part on the arch wiki?
In the mean time, at least you have the working hdd in the mean time, so can always fall back to that if you run out of time before completing the project

1 Like

Yeah, for UEFI you create a small separate partition for boot. For non-UEFI, you don’t, and create the grub later on during the installation.

It was my first time installing Arch successfully, which is partly why I want to clone the drives rather than doing another full install. :stuck_out_tongue:

I think if I re-run the grub-install and configuration commands from the Arch installation media, it should work. Knock-on-wood. And yes, I still have the HDD to fall back on, should this fail. If I can’t get this to work, I will probably do a clean install of Manjaro and be done with it. Always wanted to install and try Arch just for the heck of it, but not necessarily use it as my daily OS, so it’s not a huge issue in that regard. :wink:

1 Like

Alright, made several attempts to repair the grub, but no dice. I’ve decided to just go back to a clean install of Manjaro. Thanks anyways for the help & suggestions. :slight_smile:

Will play around with Arch again in the future, no doubt though.

OP,

You are missing the Partition Table. So if you simply want to copy a drive, you would copy sda to sdc not individual partitions. Since you have an SSD that is smaller than the HDD, you format the SSD first with fdisk, then shrink you sda1 partition, copy it over, then shrink your sda2 and etc. It is possible that you are off by a byte or two and that is why the second partition did not copy because technically you were out of space. If I am going from a larger drive to a smaller drive, I usually make the source smaller by 10MiB of the target’s capacity.

Does the above make sense?