Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
1  
Possible Duplicate of askubuntu.com/questions/78076/… –  James Jun 25 '12 at 1:33
    
@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 7:31
    
similar question askubuntu.com/q/106527/27559 –  Samik Jun 27 '12 at 11:41

5 Answers 5

up vote 9 down vote accepted
+50

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.
share|improve this answer
2  
Will Clonezilla bring over grub & the MBR also? –  jasonwert Jun 25 '12 at 2: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 5 '12 at 20:27

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 -t ext3 /dev/sda1 /mnt
    

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

    grub-install --root-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 ?

share|improve this answer
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

I'd reply exactly as I did here: http://askubuntu.com/a/151132/32230

share|improve this answer
    
Is this going to work for an encrypted ext4 partition? –  pl1nk Jun 27 '12 at 10:00
    
Definitely yes! –  jasmines Jun 27 '12 at 10:34

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.