2

I have a disk with 1000gb and ~7partitions that take about 210 GB, and I'm trying to clone those partitions to 240 GB disk. I've tried doing it with clonezilla boot up USB. Using dd if=/dev/sdc of=/dev/sdb bs=512 count=1 it says that it creates the partition on target sdb disk, so I turn it off and boot up again, and the partitions aren't there. Any ideas how to make it work?

1
  • You have to make the partitions smaller so they fit on the smaller disc , then clone using any tool you wish.
    – Panther
    Dec 1 '18 at 19:08
0

The dd command that you are using isn't copying any partitions in particular but the entirety of /dev/sdc which isn't going to work because /dev/sdc is ~4 times the size of /dev/sdb.

What you need to do is create partitions of equal size on /dev/sdb and then use either dd or cat to clone the partions separately.

Make sure that there are no mounted filesystems on /dev/sdb. After creating the partitions on /dev/sdb:

dd if=/dev/sdc3 of=/dev/sdb3 bs=2M

dd if=/dev/sdc4 of=/dev/sdb4 bs=2M

For better (and quicker) performance, use cat:

cat /dev/sdc3 > /dev/sdb3

cat /dev/sdc4 > /dev/sdb4

And so on and so forth.

1
  • @roaima cat does indeed give better performance unless other options are used with dd (which I forgot to include). I've just always used dd. I'll add cat to my answer. Jan 12 '19 at 19:04
0

Generally you cannot clone from a bigger drive to a smaller drive.

But there are workarounds.

  • You can shrink (and maybe move) the partitions on the bigger drive, so that they all reside within the limits of the smaller drive (with a small amount of drive space reserved for a backup partition table at the tail end in case of a GUID partition table, GPT).

    Beware, that if you move the head end of a boot partition (the root partition may be a boot partition), the bootloader must be reinstalled in order to find it. This is possible, but a complication.

  • Then you can clone this part of the bigger drive, and if a GUID partition table, GPT, afterwards fix the backup partition table for example with gdisk.

    I would still recommend to clone the 'whole' drive, from /dev/sdx to /dev/sdy, where x is the device letter of the source drive and y is the device letter of the target drive. Cloning with dd or similar tools will be truncated, when the target drive is full.

  • There are also other things, that can create problems. A few minutes ago I wrote a list of things to watch out for, when you intend to clone a drive. See the following link, Cloning from one drive to another drive.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.