14

I currently have Ubuntu 10.04 server running on a portable HDD. Want to move it to internal sata HDD. I've got 3 partitions /, /home and swap. On the new HDD I plan to have different partition sizes. What's the correct way of doing these two things (move and resize)?

3
  • it would be useful if you let us know the sizes of origin/destination hard disk drives in order to have a better scenery of your situation, thus lead you to a better reference. Feb 22, 2012 at 17:02
  • Did you use the Clonezilla method in the end, I assume? How did it work?
    – invert
    Apr 26, 2012 at 12:09
  • 1
    @Wesley: I successfully transferred ubuntu installation from USB stick to HDD using clonezilla. However, the tricky part was to remove checkmark of reinstalling grub. With that checkmark I had lot of troubles. Not sure why by default that checkmark is on.
    – Pablo
    Apr 26, 2012 at 12:55

3 Answers 3

10

Clonezilla may be useful for cloning your hard disk, even for those situations on which you need to do it with different size disks as mentioned here: http://www.tuxradar.com/content/how-clone-hard-drives-clonezilla

enter image description here

Moving to a bigger disk

It's easy to ensure that a clone of a SCSI disk is restored to a SCSI disk, but you'll have a tough time finding an exact replica size-wise. The good news is you don't have to restore a disk on another disk of the same size. The even better news is that you can in fact restore the image to a much larger disk.

When restoring a disk, Clonezilla enables you to resize the filesystem and create partitions on the new disk proportionally. But even if you are moving to a bigger disk, you might prefer to keep the partitions as they are. In that case you can ask Clonezilla to create the partition table as its listed in the image.

There is documentation about moving to a larger disk as mentioned here but I am not sure that you can do it the opposite (cloning to a smaller disk).

However, it's worth to try. Clonezilla offers several Live CD's and bootable USB images and there is also documented that you can resize the free space on the disk after the copy, in which case the suggestion by @maniat1k to use gparted is also a good idea.

If you use clonezilla, I would appreciate if you drop comments with your experiences over here in order to have well documented how does this work for future reference.

Thank you a lot and Good luck!

0
3
  1. Time consuming and perfect copy, with the bits in the same order on the disk is made with the unix command dd. Boot off your CD and open Disk Utility (palimpsest). Identify the device IDs of the two hard drives, for instance /dev/sda (the old hard drive) and /dev/sdb (the new one). Next, copy directly with the command dd if=/dev/sda of=/dev/sdb in this case. That step will take days even if the disk is not full. Lastly, open up Disk Utility (palimpsest) again and expand the partition to cover the whole 300GB drive and update grub.
  2. Another way would be to do a complete install on the other drive and then copy over your home folder.
  3. Also, you could simply take a directory and move its contents to the other drive and place a symbolic link from one drive to the other to save space - I do this for my ~/.wine folder on my Ubuntu-running desktop.

Just putting in the new drive and copying over all the files by themselves will not work because the disk will not be listed in GRUB and the partition is not set as bootable.

4
  • i think it esear to reinstall ubuntu
    – hingev
    Mar 26, 2012 at 17:21
  • It may well be, but I wanted to present all options. Mar 26, 2012 at 17:30
  • I recently used dd on a 160GB disk and it took roughly 2h... It is not difficult to do (only looking for disk names, booting with live CD and issuing 1 command - expanding the partition after is optional) but don't mix the command parameters or you will have 2 blank disks!
    – laurent
    Mar 26, 2012 at 19:35
  • 2
    Obs: I think the numbers of days to dd a disk are old. SATA disk are a lot faster now.
    – laurent
    Mar 26, 2012 at 19:40
1

with an live cd open a terminal as root (sudo -i) and use dd.

example: dd if=origin of=destination.

you can do a copy from one hdd to another like this

dd if=/dev/sdx of=/dev/sdy

with the same live-cd you can use gparted and resize what you want.

3
  • 2
    I have used this method to make a clone of a hard drive, It works great but the destination HDD needs to be at least as big as the origin and it is slow and has no progress meter. Feb 22, 2012 at 15:59
  • that's true, I assumed that the disks are the same size.
    – maniat1k
    Feb 22, 2012 at 16:01
  • 2
    Specify a larger dd block size to improve speed, dependant on your disk cache, but bs=4M is a good value. You can print dd status by sending it the SIGUSR1 signal, see prefetch.net/blog/index.php/2006/06/11/printing-dd-status
    – invert
    Apr 26, 2012 at 12:07

Not the answer you're looking for? Browse other questions tagged .