12

I have an Ubuntu 12.04 production server with a 500 GB (nearly 15 gb used) HDD. I want to duplicate whole HDD including, its partition structure, to another HDD with 400 GB size so that changing the HDD will not affect the working system.

Which tool is the best solution for this task?

landroni
  • 6,011
hunter
  • 267

5 Answers5

6

There are many tools that can do this, each with its own advantages and disadvantages. Clonezilla is a utility that's often used for this task; however, I'm not sure how well it would cope with the fact that your target disk is smaller than the source disk.

Another option is to manually partition the target (using GParted, parted, fdisk, gdisk, or some other tool), create filesystems on the target, mount the target partitions, and copy everything over with cp or tar. This will require some additional changes on the target, such as (possibly) adjusting its /etc/fstab and installing a boot loader. Overall, this method requires more effort than many, but if you know what you're doing, it's quite flexible, and it can definitely copy from a larger disk to a smaller one, provided the files will actually fit into the target space.

Rod Smith
  • 45,120
  • 7
  • 66
  • 108
3
  1. Backup your production-hdd.
  2. Use gparted to shrink your production-harddisk to a little less than the capacity of your target-disk, in your case smaller than 400GB.
  3. Copy whole hdd. To do so, boot from a live-cd and use dd if=/dev/sda of=/dev/sdc bs=1M where sda is your production-hdd and sdc your new hdd. Or something like clonezilla (copy whole disk).
Clausi
  • 5,057
1

I would recommend Clonezilla, its simple to use, performs whole disks backup, and doesnt use much space for the backup also.

To do that, first you would have to download the clonezilla ISO from here.

After you have downloaded it, you will need to burn it to a CD.

Then you will have to boot from it to do the full system Backup.

The full procedure for it is given here- http://clonezilla.org/clonezilla-live-doc.php

You will have to choose the option "Save disk image", the procedure for which is given here-http://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/01_Save_disk_image

After you have made the backup, you can restore it using the option- "Restore Disk Image", the procedure for which is given here- http://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/02_Restore_disk_image

Look into it. If you have any queries let us know.

Thank You!

abchk1234
  • 1,869
1

As others proposed, Clonezilla could do the job if you resize working partition to smaller size. However, I have seen there is a tool named FSArchiver that allows to restore data to a smaller drive, as soon as the data fits in (like in your case). I am sorry I can not help you more in this since I have used only Clonezilla but there is some information in the link and in their forum.

bob
  • 1,198
0

You can use dd to copy the disk. This post describes how to clone a hard drive using an Ubuntu Live CD.