How do I clone a larger disk to a smaller disk using clonezilla?

4

2

I have a larger disk Disk A and a smaller disk Disk B.

  • Disk A contains a few partitions but the total size of all the partitions is smaller than the capacity of Disk B.
  • Disk A is a GPT formatted disk.

I tried using clonezilla (ubuntu, precise pangolin version) in expert mode and selected the icds option but on starting the cloning process, it always errors out with an error indicating that it is unable to create the partitions.

Is there any way to make this work?

RJ-

Posted 2016-08-10T09:21:24.280

Reputation: 713

Answers

0

The error appears to stem from the use of GPT partitions. The workaround is to use the manual creation of partition table option from clonezilla. The commands needed are HERE:

sgdisk -R /dev/sdY /dev/sdX
where:
sdX = Disk A
sdY = Disk B

Notice the order of the disks or else you will have a problem: GPT table recovery.

RJ-

Posted 2016-08-10T09:21:24.280

Reputation: 713

Beware where you put the -R (--replicate), Counterintuitively the OP use command -R target source (my suggestion was rejected)

– Pablo A – 2019-07-20T20:13:46.600

4

My solution is the same as JackeJR but I like to elaborate my case.

I have tried a disc to disc clone from a 930GiB HDD (source drive) with a GPT partition table to 890GiB SSD (destination). Please note I am a Linux user and I have a dual boot with windows 10. I have tried to left unchanged all the partitions and to reduce slightly the size of my data partition only.

  1. With gparted, I resized the bigger data partition in order to have an overall size that fits the destination SSD, and moved all free space at the end
  2. I used clonezilla-Live from USB pen, with advanced mode and -icds enabled.

It failed. It looks like Clonezilla fails, at start, to clone the partition table to the destination disk because it wrongly uses sfdisk utility that is for older partition types instead of sgdisk utils. My solution:

  1. The same as previous (overall size must fit)
  2. I manually copied the partition from one drive to another, using Clonezilla shell with sgdisk (only for GPT partitions):

    sgdisk /dev/sdSourceDeviceName -R /dev/sdDestinationDeviceName
    
  3. Performed Clonezilla disc-to-disc clone, selecting the option -icds: Skip checking destination size before creating partition table, and then the option -k: Do NOT create partition table on boot sector on target machine. (In this case Clonezilla uses the destination partitions as they are, and resizes partitions when sizes are smaller, in order to fit, it performs a good "best effort").

It worked. I obtained all the partitions the same size as source (Yes I only reduced the bigger partition a bit). Dual boot with windows keeps working well.

Fabiano Tarlao

Posted 2016-08-10T09:21:24.280

Reputation: 153

0

We got it working by editing the following files in the image to match the total sector count of the destination drive:

  • sda-pt.sf (edit last-lba)
  • sda-pt.parted.compact (edit Disk /dev/...)
  • sda-pt.parted (edit Disk /dev/... , don't forget the s at the end)
  • sda-gpt.sgdisk (edit Disk /dev/...: ... sectors, ... GiB)

I'm not sure which ones are actually required, so you might get away with less.

Patrik

Posted 2016-08-10T09:21:24.280

Reputation: 103