Clone disk to slightly smaller SSD

I am using Linux (Fedora 21) and have a 500GB SSHD that shows some failure errors. I bought a new SSD disk of 480GB and I want to clone the SSHD to the SSD. There is more than enough free space, so the slightly smaller disk should be no problem. I tried to use CloneZilla for this, but it bails out complaining the target disk is too small.

My partition layout is as follows:

Command (m for help): p
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xf215ba27
Device Boot Start End Sectors Size Id Type
/dev/sda1 63 80324 80262 39.2M de Dell Utility
/dev/sda2 * 81920 32935935 32854016 15.7G 7 HPFS/NTFS/exFAT
/dev/sda3 32935936 434964442 402028507 191.7G 7 HPFS/NTFS/exFAT
/dev/sda4 434964480 976773167 541808688 258.4G 5 Extended
/dev/sda5 434966528 435990527 1024000 500M 83 Linux
/dev/sda6 435992576 976773119 540780544 257.9G 8e Linux LVM

And these are the mounted file systems:

[bf@laptop-bf ~]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 4027292 0 4027292 0% /dev
tmpfs 4039452 220 4039232 1% /dev/shm
tmpfs 4039452 1832 4037620 1% /run
tmpfs 4039452 0 4039452 0% /sys/fs/cgroup
/dev/mapper/fedora_localhost-root 51475068 13636828 35200416 28% /
tmpfs 4039452 40 4039412 1% /tmp
/dev/sda3 201014248 93952 200920296 1% /mnt/windows7
/dev/sda5 487652 174469 283487 39% /boot
/dev/mapper/fedora_localhost-home 206394032 172686096 23200672 89% /home
tmpfs 807892 12 807880 1% /run/user/42
tmpfs 807892 28 807864 1% /run/user/1000

What tool could I use to clone my disk?

2

3 Answers

The obvious partition to shrink is /dev/sda3 (Win7). If this has a running W7 on it, it is safest to shrink from within that. Since it has so much unused space, I would shrink by more than 20GB, so that subsequently more space can be made available in the nearly full Linux partition.

Then use Linux for the copying. It will be better to use a LiveCD, to stop any disc changes during the copy. I recommend Ubuntu live, which has the excellent gparted on it.

When there are disc errors, I use dd conv=noerrror,sync ..., with the default 512-byte buffer, which is slow, but copies the maximum number of good sectors.

I would copy the whole disc with dd, which will error after copying all the sectors it can fit on to the SSD. If the target is /dev/sdb, then use:

dd conv=noerrror,sync if=/dev/sda of=/dev/sdb

You can use count=435992576 to stop the copy before /dev/sda6, which will be written in the next stage.

If you use gparted you can now easily delete the extended partition on the target drive and copy the extended partition from the old drive into the free space on the new drive, then expand both the extended and the LVM partition to use the rest of the space on the new drive.

You can do this copy with dd skip=... seek=... ..., but you need to make sure of the offsets, whereas gparted does all the arithmetic for you.

The important thing is not to do anything on the old drive until you have created a successful, bootable copy on the new drive, where all the partitions pass a disc check (fsck or chkdsk.exe)

This is not an easy solution, but by taking a very conservative approach it maximises the data recovered to the new drive.

The other answers point to valid open-source solutions, you can shrink partitions on the source disk (with gparted) and clone the disk on the destination disk using the "dd" command or "clonezilla".

But, I like to propose one non-open alternative solution.

EaseUS Backup Free, is a very good proprietary software for Microsoft Windows that also performs disc-clone with automatic on-the-fly shrink. This is ideal for HD->SSD migration.

In case you need to execute EaseUS on another Linux-only machine, with the EaseUS Backup Free software you can also create a bootable WinPE DVD/USB drive. You can create the bootable emergency disk directly from EasyUS, from menu "Tools" > "Create Emergency Disk", and then select the WinPE option (it is the choice that provides more features).

While booting with the EaseUS Emergency Disc you execute a full-fledged EaseUS Backup Free instance, and you can perform all the disc-clone operations you need. The EasyUS graphical interface is quite self-explanatory.

Using gparted shrink the disk down below the size of the target disk. Then when using clonezilla I believe there is an option to expand the partitions as it copies them.

That said you may also run into issues with the bad sectors. If you do you may have to use the rescue flag when copying everything over or clonezilla will quit on the first error. It has been a while since I did this so i am not sure where it is but if you read the options as you go it should be obvious.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like