Boot External-HDD Transfer – How to Transfer Installation from Internal to External USB HDD

bootexternal-hddtransfer

I started to use Ubuntu 10.04 on a Laptop booting from an external USB HDD, it worked pretty well after some tweaking (Had to use a separate 1GB Boot partition etc).

After a while running mostly on my external HDD I decided to wipe the internal HDD (e.g get rid of the useless crippled and slow corporate WinXP installation) and migrate my Ubuntu installation from the external to the internal HDD. That went fine after some tweaks, I copied the entire disk using "cp -a" without any major problems.

After running for a while now in the internal HDD I need to temporarily move back my system to the external HDD since I am swapping Laptops. What I did initially was to simply transfer the internal HDD to the external using rsync on a running system, just to test. I will make the real transfer later on after booting from USB flash so both HDD's is not in use.

I tried to setup the external HDD for boot using grub-install after I chrooted to the external hdd but everytime I bootup the Laptop and select external HDD as boot device it always boots from the internal HDD. I know that I can probably copy external HDD back into the internal on the new Laptop and fix it later, but I really want to test booting from the External HDD before giving back my Laptop in exchange for a new one.

TL;DR:

  • Installing Ubuntu 10.04 on external HDD and boot, OK!
  • Migrating Ubuntu 10.04 from external HDD to internal HDD and boot, OK!
  • Trying to mirror the internal HDD to external HDD and boot from external HDD, Failed!

EDIT

It seems that the Laptop boots on the internal HDD even though I chose External HDD in the Bios Boot menu, e.g the bios fails to find a bootable partition on the external HDD and falls back to the internal HDD.

I will dig into the mysteries of grub cli at the moment to investigate the status of the mounted partitions, I have (hd0) internal and (hd1) external visible in grub. Both has subpartitions 1, 5 and 6. (1 is /boot partition 1GB, 5 primary root / partition and 6 is swap).

Best Answer

Boot to live cd.

Then:

sudo mount /dev/sdXY /mnt

Example:

sudo mount /dev/sda1 

Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot.

Note: If the user has a separate /home partition, this must be mounted to /mnt/home. Encrypted home partitions should work.

Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.

sudo grub-install --root-directory=/mnt /dev/sdX

Example:

sudo grub-install --root-directory=/mnt /dev/sda

Reboot

Refresh the GRUB 2 menu with sudo update-grub.