Ubuntu – How to make duplicate of whole HDD

backuphard drivepartitioning

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?

Best Answer

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.