The HDD I have my Ubuntu installed is about to fail. I would rather not lose 3 years worth of data, customisation and apps. I am looking for a way to move the complete system (SWAP included, because I'm not sure if I can relink the system to a new SWAP partition) to another HDD. But not the complete HDD< only the partition containing Ubuntu, to a partition on a different HDD. Basically I'd like to do what I've been able to do with Norton Ghost for my Windows install. I thought about using Clonezilla but I think I would have issues with GRUB (Especially trying to boot from a different UUID than what is in the conf file). do you know of any way this could be done?
PS, my home directory is encrypted but that's not really an issue, because I can work around that.
EDIT: changed the explanation to make it clearer
I actually ended up using Gparted from the Live CD. I copied the partition and pasted it in the unallocated space on the other HDD. Then I used blkid to check the UUIDs and edited the fstab file. Worked like a charm!
Well, I just used usb stick + ubuntu live.
I was transferring ubuntu 13.10 from larger hdd to a smaller ssd, and clonezilla "said" that it can't be done this way since target partition is smaller than the source partition.
So I started ubuntu live, mounted both hdd's (new disk, was partitioned earlier of course, don't forget about swap ;) ), and just:
then:
above you can see that it's just copying all directories from one hdd to another, recursively with all permissions and stuff preserved.
then I had to make two symlinks in root directory of a new disk:
and the next step was installing grub, so:
where x - device, y - partition number (if unsure use cfdisk or fdisk to print partition table...)
and the last step was, changing uuid of a new hdd to uuid from old hdd (it's the easiest way to fool grub config, fstab or else without searching and fixing configurations)
new UUID will show after device remounting. So now reboot and if everything is ok, your ubuntu should start...
You can do it by using dd. For complete info check the site.
Clone a Hard Drive Using an Ubuntu Live CD
You can also use:
You can download Clonezilla here
Warning Make sure that you check out the Limitation of Clonzilla before you start.
You also mentioned that you have used Ghost for windows, well you can use Ghost for Linux as well.
Source: http://www.howtogeek.com/howto/19141/clone-a-hard-drive-using-an-ubuntu-live-cd/
Source: http://www.makeuseof.com/tag/2-methods-to-clone-your-linux-hard-drive/
Some years ago I used successfully this tool to "clone" my partitions: G4L. Everything worked with some post-installation corrections, such as resizing partitions (I cloned the partitions on different size HD) and grub reinstall (it's pretty simple, you only need a live CD to reinstall it in the MBR).
You can safely ignore your swap partition (you will be able to recreat it at a second time) or clone it too and active it later, manually editing
/etc/fstab
or from command line.In the past weeks I did again the clone with clonezilla, and everything went ok with the same post-cloning corrections. So don't worry and give them a try, nothing on your original HD will be touched!
EDIT:
I found an old mail where I described the first cloning process. I acted as follow:
Booted again with the Live CD and mounted the new disk:
Restart, check the swap
@boywithaxe - Regarding your comments to Mitch's answer you can indeed just copy the relevant partitions by doing
dd if=/dev/sdb3 of=/dev/sda3
. That is actually the easiest part. The most tricky part is that you will also have to mount the newly copied partition, as well as a couple of other partitions and install grub (grub-install /dev/sda
) (and add a swap partition before you reboot (if you are cloning a bootable partition)). Using this method there is no need toresize2fs
either.I have just had to do this myself, and I used a combination of Boot repair after a Windows Upgrade on Ubuntu 14.04 (non-RAID) and jasmines answer.
So, after having booted from the liveCD:
When that has finished, then
where sda3 contains the recently copied boot and root partitions)
note this is sda not sda3