Prepare a disk to be imaged by Clonezilla for use on smaller disks?

41,722

Solution 1

Inside every clonezilla image, there is a file called sda-pt.parted. You can edit the sector size of /dev/sda to be smaller than your target hard drive.

Here is how we do it:

  1. Install OS and programs
  2. Shrink partition in OS to lowest possible value (we find under 80 works best)
  3. Sysprep and clone
  4. Edit image/sda-pt.parted

Below is a sample of an edited sda-pt.parted file

Model: ATA ST31000524AS (scsi)
Disk /dev/sda: 78200000s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start    End        Size       Type     File system  Flags
1      2048s    206847s    204800s    primary  ntfs         boot
2      206848s  78135295s  77928448s  primary  ntfs

Original:

Model: ATA ST31000524AS (scsi)
Disk /dev/sda: 1953525168s

Solution 2

In creating your Master Image, resize the partitions or "total non Free space area" to be smaller than your smallest target drive will be.

Use the expert mode instead of beginner in Clonezilla.

If you are sure all the data from the image could fit the smaller disk, add the option "-icds"

CloneZilla will work fine Imaging to a smaller drive than the image was created on.

Solution 3

The other fix provided here worked for me. The file to edit is image/sda-pt.parted inside the image folder itself.

In that file, just shrink number in the line that says

Disk /dev/sda: #########s

If you know the target size you want in bytes, you can divide by the sector size to get the number of sectors you want. In my case, I'd built out a 40GB system with 40GB partitions but it was on a 320GB drive. Sure enough, just changing the disk size to 40GB / 512 sectors (40000000000/512=78125000s) did the trick.

Alternatively, you can just look at the end of your partition table in that file and use a number just bigger than that the endpoint of your last partition.

I should also note that none of the options I found when I searched clonezilla help for pushing bigger images to smaller drives worked ("expert mode", resize, etc.). It seems like the best approach is to build your image, then adjust the disk size to be as small as possible before pushing.

Solution 4

We started using a 64Gb SSD to build our images. We have a drive reserved for this purpose. When building a new image, we first put this drive in the computer to be used as a template. We find this also helps us produce and capture images faster, as well as ensuring the resulting image will fit in any system we have in service.

Share:
41,722

Related videos on Youtube

poke
Author by

poke

Updated on September 18, 2022

Comments

  • poke
    poke almost 2 years

    A recurring problem we have is that the computers we use to build our master images on may have larger hard drives than some of the target systems' drives. Its well-known that Clonezilla won't put a disk image on a smaller drive.

    Outside of finding a physical drive that is smaller/as small as all of our target systems, I've used this method to get around our problem:

    1. After preparing the master computer, use gparted to shrink the partition(s) so they will all fit on the smaller size disk.
    2. Create a VM with a hard drive of the target size.
    3. Create the right partition(s) on the VM by installing a copy of the target OS on the VM.
    4. Use the save/restore partition functionality in Clonezilla to copy each partition from the master computer to the VM.
    5. Create an image of the VM. Use this image as the golden master for imaging computers.

    Is there any way to use gparted (or another program) to resize the master drive before cloning it? I know how to resize individual partitions, but it would be really, really handy if I could do something to make Clonezilla think the original drive was smaller. That way I could use the restore disk functionality to make an image that was small enough for all target systems.

    Due to various issues, building the master image directly in a VM is not feasible for our situation.

  • DaveTheMinion
    DaveTheMinion over 6 years
    This is a most unconventional way to go about this, but it is the only way that I could get to work properly. Attempting to use the "resize partition table proportionally" option just didn't work at all.
  • flywire
    flywire over 6 years
    Leave a comment if you don't like the answer.