6

I would like to move my current installation of Ubuntu 11.10 to a bigger harddisk, since the old one is failing.

I would like to avoid solutions like dd block copying (since there would be unused space at the end) with something cleaner, but I'm open to suggestions.

Partitions info:

Size  Used Avail Use% Mounted on Partition type Encrypted
19G  9.9G  7.6G  57% /           ext4
59G   50G  6.2G  90% /home       ext4           Yes

What is the best way to accomplish such a task, preferably with advantages/disadvantages of any given approach.

Anwar
  • 76,649
pl1nk
  • 6,399
  • @James It's not a duplicate, in the question that you mentioned the OP doesn't want to re-install everything. I'm open to suggestions and prefer answers that depict advantages/disadvantages of any given approach. – pl1nk Jun 25 '12 at 07:31
  • similar question http://askubuntu.com/q/106527/27559 – Samik Jun 27 '12 at 11:41

4 Answers4

9

Use clonezilla.

It will allow you to clone your current system including the mbr without actually copying unused space that dd does hence doing it faster

Since its reading / writing on a filesystem level you can only use it on a supported filesystem, on the contrary to dd, which works on a device level, allowing the copy of any filesystem.

Clonezilla's front page has a list of the software's limitations:

  • The destination partition must be equal or larger than the source one.
  • Differential/incremental backup is not implemented yet.
  • Online imaging/cloning is not implemented yet. The partition to be imaged or cloned has to be unmounted.
  • Software RAID/fake RAID/firmware RAID is not supported by default. It can be done manually only.
  • Due to the image format limitation, the image cannot be explored or mounted. You can not recovery single file from the image. However, you still have workaround to make it, read this.
  • Recovery Clonezilla live with multiple CDs or DVDs is not implemented yet. Now all the files have to be in one CD or DVD if you choose to create the recovery iso file.
tomodachi
  • 14,832
  • 2
    Will Clonezilla bring over grub & the MBR also? – jasonwert Jun 25 '12 at 02:14
  • 1
    @jasonwert here you can see how to include MBR and GRUB while disk copying, but while copying partition MBR won't be included as it's not a part of a partition. – Samik Jun 27 '12 at 11:54
  • 1
    @jasonwert yes it will clone the mbr. I've added it to the response. Thanks for the feedback! – tomodachi Jun 27 '12 at 14:20
  • This worked great. I moved my root partition to an SSD two days ago using clonezilla. I used boot-repair from a live cd to setup grub. Thanks! – jasonwert Jun 29 '12 at 13:58
  • It works like a charm! Do you know how can I enlarge my partitions to use the available space --or should I make a new question? – pl1nk Jul 05 '12 at 20:27
4

I'd use Gparted.

  1. start from your Gparted LiveCD or LiveUSB (using Lily)
  2. Plug in both of your HD (old and new one)
  3. select partitions on the old disk and "COPY" it on the new disk
  4. Resize partitions on your new disk according to your willing
  5. Start from Ubuntu liveCD/liveUSB
  6. Use blkid to check the UUID of the partitions on the new disk
  7. Edit your /etc/fstab located on your new disk according to your UUID
  8. Open a terminal (Ctrl + Alt + T) in order to re-install Grub on your new disk.

    fdisk -l
    

    fdisk to Check the name of the Ubuntu partition on your new disk. In my case, it's sda1 so let's continue by mounting this partition :

    mount /dev/sda1 /mnt
    

    Finally, let's re-install Grub in your new disk sda :

    grub-install --boot-directory=/mnt /dev/sda
    
  9. Shut down and re-start from your new disk !

[EDIT] Thanks to tomodachi, I edited my answer to reflect his advices :

  • No need to edit the fstab on the new HD because Gparted is supposed to copy the partition as well as its UUID

  • I added some extra steps to make your new HD bootable.

maybe there are simpler methods ?

Sulliwane
  • 2,085
  • 1
    When copying partitions gparted also copies the UUID to the destination drive so it will be unchanged. It wont copy the grub MBR, since its not in the partition. Meaning , that one has to install grub manually to the new drive for it to be bootable – tomodachi Jun 27 '12 at 14:29
  • The option -t ext3 is outdated and can be left out. The option --root-directory=/mnt should read --boot-directory=/mnt, according to man grub-install. – Serge Stroobandt Aug 23 '16 at 12:17
0

Here is a tutorial that explains in detail how to move your system to new larger disk. In short, you have to boot to Ubuntu live CD, then using gparted prepare your new HDD by creating the partition of the same size of old system partition and leaving extra free space before creating any new partitions. Then backup partition using partimage, restore it to system partition on new HDD, fix grub, and then resize the new system partition to desired value.

Here is the explanation in details. Connect both hard drives and boot from Ubuntu Live CD. Then you need to enable universe/multiverse repositories. When this is done open terminal (Alt+F2 then type gnome-terminal) and type:

sudo apt-get install gparted partimage

and when this is done type:

sudo gparted   

1

For Complete detailed instructions, see Ubuntu How To's

1Source:Ubuntu How To's

Mitch
  • 107,631
0

You can also use redobackup, it makes a whole disk image, and will exactly image your current computer to the larger hard disk.

After you were done, you would want to expand your partition to fill the rest of the disk with gparted.

Redobackup is pretty intuitive.

Jobi Carter
  • 539
  • 3
  • 8