23

According the docs, Clonezilla supports cloning to a smaller drive using the option -icds. Let's cite:

If you are sure all the data from the image could fit the smaller disk, i.e. it won't be written to the wrong disk space, you can check the option "-icds"

That's my case. I am trying to transfer the OS and data from my friend's failing drive to a new one. I really want to avoid reinstalling Win Vista 32bit and all the SW.

Source disk: SATA 320 GB WD drive with two partitions (C: and D:), a couple of bad sectors. Used about 50 GB out of the entire 320 GB.

Target disk: Crucial MX500 250 GB.

I run current UBCD 5.3.8 and Clonezilla within Parted Magic. Except the default settings I am adding these options:

  • -rescue: to ignore the bad sectors
  • -icds: this is the important one to allow for cloning onto a smaller drive
  • -k1: create partition table proportionally

However, the cloning stops with an error:

Target partition size(163830 MB) is smaller than source(209716 MB). Use option -C to disable size checking(Dangerous). Failed to clone /dev/sda1 to /dev/sdb1

Why does not Clonezilla respect the -icds setting and does not run Partclone with the -C switch? How to make it to perform the cloning?

I am attaching the content of the log file:

Starting /usr/sbin/ocs-onthefly at 2018-09-25 01:49:59 UTC...
Shutting down the Logical Volume Manager
Finished Shutting down the Logical Volume Manager
PS. Next time you can run this command directly:
/usr/sbin/ocs-onthefly -g auto -e1 auto -e2 -j2 -r -rescue -icds -k1  -f sda -t sdb
*****************************************************.
*****************************************************.
The first partition of disk /dev/sda starts at 2048.
Saving the hidden data between MBR (1st sector, i.e. 512 bytes) and 1st partition, which might be useful for some recovery tool, by:
dd if=/dev/sda of=/tmp/ocs_onthefly_local.S1OeQB/src-hidden-data.img skip=1 bs=512 count=2047
2047+0 records in
2047+0 records out
1048064 bytes (1.0 MB) copied, 0.00758521 s, 138 MB/s
*****************************************************.
Collecting partition /dev/sda1 info...
Collecting partition /dev/sda2 info...
Non-grub boot loader found on /tmp/ocs_onthefly_local.S1OeQB/sdb-mbr...
The CHS value of hard drive from EDD will be used for sfdisk.
Searching for data partition(s)...
WARNING! THE EXISTING DATA IN THIS HARDDISK/PARTITION(S) WILL BE OVERWRITTEN! ALL EXISTING DATA WILL BE LOST: sdb
*****************************************************.
Machine: M56S-S3
sdb (250GB_CT250MX500SSD1__CT250MX500SSD1_1829E14A98AF)
sdb1 (152.6G_boot(In_CT250MX500SSD1_)_CT250MX500SSD1_1829E14A98AF)
sdb2 (80.3G(In_CT250MX500SSD1_)_CT250MX500SSD1_1829E14A98AF)
*****************************************************.
Will create the partition on the target machine...
Let me ask you again.
*****************************************************.
 [1;33mMachine: M56S-S3
sdb (250GB_CT250MX500SSD1__CT250MX500SSD1_1829E14A98AF)
sdb1 (152.6G_boot(In_CT250MX500SSD1_)_CT250MX500SSD1_1829E14A98AF)
sdb2 (80.3G(In_CT250MX500SSD1_)_CT250MX500SSD1_1829E14A98AF)
 [0;39m*****************************************************.
 [1;33mWARNING!!! WARNING!!! WARNING!!!
WARNING! THE EXISTING DATA IN THIS HARDDISK/PARTITION(S) WILL BE OVERWRITTEN! ALL EXISTING DATA WILL BE LOST: sdb
 [0;39mAre you sure you want to continue? ? (y/n) OK, let's do it!!
Shutting down the Logical Volume Manager
Shutting down the Logical Volume Manager
Finished Shutting down the Logical Volume Manager
Finished Shutting down the Logical Volume Manager
Trying to clean the MBR and GPT partition table on the destination disk first: /dev/sdb
Creating MBR type's partition table...
 [1;33mCreate the proportional partition table based on /tmp/ocs_onthefly_local.S1OeQB/tgt-pt.sf and the size of /dev/sdb...
 [0;39mNo partition table exists in target disk /dev/sdb, try to initialize one so that we can get the disk size by parted... done!
The ratio for target disk size to original disk size is .7812.
The partition table to write in /dev/sdb:
*****************************************
unit: sectors
/dev/sdb1 : start= 2048, size= 319979520, Id=7, bootable
/dev/sdb2 : start= 319981568, size= 168371623, Id=7
/dev/sdb3 : start= 0, size= 0, Id=0
/dev/sdb4 : start= 0, size= 0, Id=0
*****************************************
Running: sfdisk --force -C 38912 -H 255 -S 63 /dev/sdb < /tmp/new_sf.2tdNbd

Disk /dev/sdb: 38912 cylinders, 255 heads, 63 sectors/track
Old situation:
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          1   30400   30400  244188000   83  Linux
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
New situation:
Units: sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1   *      2048 319981567  319979520   7  HPFS/NTFS/exFAT
/dev/sdb2     319981568 488353190  168371623   7  HPFS/NTFS/exFAT
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
Successfully wrote the new partition table

Re-reading the partition table ...

Partition table was created by: sfdisk --force -C 38912 -H 255 -S 63 /dev/sdb < /tmp/new_sf.2tdNbd
done!
*****************************************************.
The first partition of disk /dev/sdb starts at 2048.
Restoring the hidden data between MBR (1st sector, i.e. 512 bytes) and 1st partition, which might be useful for some recovery tool, by:
dd if=/tmp/ocs_onthefly_local.S1OeQB/tgt-hidden-data.img of=/dev/sdb seek=1 bs=512 count=2047
2047+0 records in
2047+0 records out
1048064 bytes (1.0 MB) copied, 0.0247041 s, 42.4 MB/s
*****************************************************.
Cloning the boot loader (executable code area) from "sda" to "sdb"...
Now we will start to clone data to the target machine...
Searching for data partition(s) in source disk: sda ...
Source partition file system is ntfs...
Cloning the /dev/sda1 to /dev/sdb1...
Using partclone to clone...
Run partclone: partclone.ntfs -z 10485760 -N --rescue -L /var/log/partclone.log -b -s /dev/sda1 -O /dev/sdb1
Partclone v0.2.66 http://partclone.org
Starting to back up device(/dev/sda1) to device(/dev/sdb1)
we need memory: 6408260 bytes
image head 4160, bitmap 6400000, crc 4100 bytes
Calculating bitmap... Please wait... get device size 163829514240 by ioctl BLKGETSIZE64,
Target partition size(163830 MB) is smaller than source(209716 MB). Use option -C to disable size checking(Dangerous).
Failed to clone /dev/sda1 to /dev/sdb1
Source partition file system is ntfs...
Cloning the /dev/sda2 to /dev/sdb2...
Using partclone to clone...
Run partclone: partclone.ntfs -z 10485760 -N --rescue -L /var/log/partclone.log -b -s /dev/sda2 -O /dev/sdb2
Partclone v0.2.66 http://partclone.org
Starting to back up device(/dev/sda2) to device(/dev/sdb2)
we need memory: 3375908 bytes
image head 4160, bitmap 3367648, crc 4100 bytes
Calculating bitmap... Please wait... get device size 86206270976 by ioctl BLKGETSIZE64,
Target partition size(86207 MB) is smaller than source(110352 MB). Use option -C to disable size checking(Dangerous).
Failed to clone /dev/sda2 to /dev/sdb2
*****************************************************.
Searching for data partition(s) in target disk for post process: sdb...
Now tuning the file system size on partition /dev/sdb1 to fit the partition size...
"boot" is an unknown or unsupported filesystem... Skip resizing that.
*****************************************************.
Now tuning the file system size on partition /dev/sdb2 to fit the partition size...
Unknown or unsupported partition (/dev/sdb2) found! Skip this partition /dev/sdb2.
*****************************************************.
Creating the swap partition if exists...
*****************************************************.
Trying to remove udev hardware record in the restored OS...
The specified destination device: sdb1 sdb2
Trying to remove udev persistent files. The devices to be searched: sdb1 sdb2...
Now searching possible device /dev/sdb1...
Skip /dev/sdb2 (No file system. Extended partition?).
done!
*****************************************************.
Device /dev/sdb1 is not a FAT partition.
Skip updating syslinux on that.
Device /dev/sdb2 is not a FAT partition.
Skip updating syslinux on that.
*****************************************************.
Run grub install on disk sdb...
The grub directory is NOT found. Maybe it does not exist (so other boot manager exists) or the file system is not supported in the kernel. Skip running grub-install.
*****************************************************.
Try to run partclone.ntfsfixboot for NTFS boot partition if it exists. Scanning partition(s):  sdb1 sdb2...
The NTFS boot partition was not found or not among the restored partition(s). Skip running partclone.ntfsfixboot.
*****************************************************.
Ending /usr/sbin/ocs-onthefly at 2018-09-25 01:52:34 UTC...
5
  • 1
    I've never used Clonezilla, but you might try reducing the size of the source partition to 240 GB, given that you have used only part of it. The method to do that depends on the source OS. Commented Sep 26, 2018 at 1:25
  • 1
    I would shrink the source partition down to 5gb of free space. Then clone it with -icds Then expand it to fill the new drive.
    – cybernard
    Commented Feb 1, 2019 at 16:01
  • It failed for me, using gparted and a copy of the MBR using dd solved the issue for me. Much more flexible than clonezilla if you ask me. Commented Feb 18, 2021 at 23:45
  • 1
    Don't waste your time: I have spend an insane amount of time on this and could never ever make it work. It absolutely does not work, as of this date (September 2022) Clonezilla will fail, no matter what options or parameter you use, the error will also be nonsensical, like "invalid parameter" etc. It does not matter how little space is taken of the partitions, it just can't resize partitions DOWNWARDS, just upwards. I hope for a feature where Clonzilla actually can do this and only occupied space counts. Commented Sep 18, 2022 at 0:31
  • I encountered the same issue few times back, then I used third-party software EaseUS Disk easeus.com/questions/backup/… Commented Feb 1 at 6:14

1 Answer 1

19

Officially, Clonezilla requires the destination drive to be the same size or larger than the master drive.

However, it can be done. The issue you are running into is not the size of the disk, but the size of the partition(s). If the sum if the partition sizes are larger than the destination drive, Clonezilla will fail. You need to shrink the partitions on the master drive before running Clonezilla with -icds.

This can be done in a GParted Live environment, or within the OS (depending on setup).

In Clonezilla, choose expert mode and enable the “-icds” option. You need to also  choose the option "Resize partitional table proportionally. "

Alternatively, there are other disk cloning software programs that can do this automatically.

4
  • 1
    That's probably how it used to be but according to the citation I provided in the beginning of my post (along with a link) they now support restoring to a smaller disk if the data fit within it. But it did not work for me and that's why I wrote this question.
    – Pontiac_CZ
    Commented Sep 27, 2018 at 7:09
  • 3
    While using the "-icds" option is true, with a Linux drive, I ran into the issue where the "Resize partition table proportionally" would make the target partition smaller than the source partition. And this was after shrinking the source partition using gparted. So, with the source partition shrunk, I manually created the partitions on the source drive, then told Clonzilla to NOT write to the partition table. Viola!
    – jaylweb
    Commented Dec 29, 2019 at 0:29
  • 2
    On a Windows 10 drive, the "-icds" option and the "Resize partition table proportionally" worked fine. I learned that Clonezilla uses other tools to perform cloning operations and thus, different results with different drive types. I get it, but it was frustrating nonetheless having a more difficult experience with Linux.
    – jaylweb
    Commented Dec 29, 2019 at 0:32
  • 2
    @jaylweb you should post an answer with your first comment, it was a lifesaver for me!
    – Aritz
    Commented Mar 11, 2020 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .