Transferring Ubuntu to New Harddrive
February 4, 2009
My old harddrive had 60 G for my Ubuntu partition and the free space left was less than 2 G (and it is going fast). I figured it was time for me to find a bigger home for my Linux partition. I followed the Backup and Restore post but it missed out a couple simple and very important steps. So I guess it is good to log these here.
Honestly, I think the backup procedure might work (though unlikely, at least I think one shouldn’t just copy the boot folder to a new harddrive) if I only had nothing but a Linux partition. Anyhow, I think it is good to keep a Windows partition even though I rarely go there.
As mentioned in the backup guide, it is important to restore grub. However, the grub restoration guide there didn’t work for me. Actually, I’m not even sure the restoration steps did help or not since I got exactly the same problem–Grub Error 17: Cannot Mount Selected Partition–before and after applying these steps.
Actually, the problem can be fixed easily as follows.
Use Ubuntu Live CD to get on a working OS, from menu->Places->xxG Media to mount your harddrive. Then type
sudo fdisk -l
to see your actual drive location. Most probable reason of grub error 17 is that you have a wrong device link of your drive (wrong info inherited from my previous harddrive in my case). In my case, I have
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6080 48837568+ 7 HPFS/NTFS
/dev/sda2 6081 60801 439546432+ 5 Extended
/dev/sda5 60045 60801 6080571 82 Linux swap / Solaris
/dev/sda6 6081 60044 433465767 83 Linux
My Linux partition sda6 corresponds to (hd0,5). If you have sdb5 and sdc4, they correspond to (hd1,4) and (hd2,3) and so on.
Edit boot/grub/menu.lst in your Linux partition, your drive mostly should be mounted to /media. If you are not certain, you can go to menu->System->Administration->System Monitor and select File System tab, it should display where your drive mount to. In my case, it is /media/disk. Then, edit grub menu by typing (or any other editor)
sudo vi /media/disk/boot/grub/menu.lst
Search for something like the following and
title Ubuntu 8.10, kernel 2.6.24-21-generic
root (hd0,4)
kernel /boot/vmlinuz-2.6.24-21-generic root=UUID=683edbfa-6d51-49f9-ae55-95f07a644b53 ro quiet splash
initrd /boot/initrd.img-2.6.24-21-generic
quiet
replace (hd0,4) by the correct drive link, which is (hd0,5) in my case.
Actually, that is not complete yet. If you reboot now, you will have another problem saying something like UUID=683edbfa-6d51-49f9-ae55-95f07a644b53 not found.
Instead, before rebooting, type ls -l /dev/disk/by-uuid
there should be a couple file with long names which link to one of your drive. For my case, I have
total 0
lrwxrwxrwx 1 root root 10 2009-02-04 08:04 6b453fda-b857-4ba1-a00b-74aadb2123c6 -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-02-04 08:04 91f2ed9a-de11-4dfb-9ccc-46c0ae3e97cb -> ../../sda6
lrwxrwxrwx 1 root root 10 2009-02-04 08:04 960447000446E2BB -> ../../sda1
so, I should replace the uuid in menu.lst by 91f2ed9a-de11-4dfb-9ccc-46c0ae3e97cb. Everything should work fine with these changes.
Entry Filed under: About computer. Tags: backup, installation, linux, restoration, ubuntu.
2 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
Mark Sanborn | February 5, 2009 at 7:01 am
When you transfer drives in Linux there is an awesome utility called dd that comes with all distros of Linux that I have ever use including Ubuntu.
It is often times used for computer forensics because it copies the hard drive bit by bit.
Give it a try next time you are moving drives. You can check out my guide here, http://www.marksanborn.net/howto/make-a-backup-image-of-your-hard-drive-with-dd/
2.
phsamuel | February 13, 2009 at 5:05 am
Thanks Mark. I probably will try it out next time.