How to replace my disk without having to rebuild my Ubuntu install?
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.
If you are looking for an application which has a GUI, check Clonezilla:
http://clonezilla.org/
http://www.howtoforge.com/back-up-restore-hard-drives-and-partitions-with-clonezilla-live
http://www.backuphowto.info/how-to-backup-your-data-in-linux-using-clonezilla
Without a GUI:
http://www.backuphowto.info/linux-backup-hard-disk-clone-dd
http://mark.koli.ch/2009/05/howto-whole-disk-backups-with-dd-gzip-and-p7zip.html
I would recommend partimage.
You can live-boot, install partimage and copy your partitions over.
What I really like about this software is that it is quite easy to handle (it's semi-graphical :-) ) and it's fast because it only copies the non-empty blocks. In other words you can copy a 10Gb partition to a bigger (on your new drive) one without much hassle.
Install it with apt-get.
more here: http://www.partimage.org/