Ubuntu – How to replace the disk without having to rebuild the Ubuntu install?

hard drivesystem-installation

I'd like to buy a new 1TB disk to replace my old 150GB disk.
Is there an easy way to copy my Ubuntu installation with

  • my home folder content,
  • system settings,
  • applications,
  • and so on…

so at the end I can just unplug my old disk and plug the new one without having to re-install everything?

Best Answer

sudo dd if=/dev/sda of=/dev/sdb will create an exact replica of sda to sdb as long as sdb is at least as big as sda.

Plugin your hard disk to your system, make sure the BIOS is recognizing it correctly and boot normally to your system.

Check your hard disks with Disk Utility(To launch Disk Utility, you can use the dash),
make sure that your old hard disk is sda and your new hard disk is sdb (change the devices on the example command to reflect your hardware configuration), no need to mount the new disk (it should be empty anyways so there is nothing to mount).

Run the command with the right devices in a terminal wait until its finished and that's it.

PS: triple check the command and make sure that your old hard disk is in the if part and that your new disk is in the of part of the command.

Your partitions will be copied from your old disk to the new one byte by byte so no need to worry about reconfiguring / installing MBR and bootloader. The only thing you need to do after the disk is copied is to remove the old disk from the system or set the new disk as boot device in your BIOS.

Later on when you tested that all is ok you can resize your partitions on the new disk with gparted, boot from a LiveCD, install gparted and resize the partitions of your new disk to fit your needs.

This solution requires no installation of extra tools except for the installation of gparted later on for resizing the partitions.

Related Question