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 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).

share|improve this question
    
Have you modified /etc/fstab on the external hd? Have you run update-grub in addition to grub-install on the chroot? –  enzotib May 16 '11 at 13:38
    
I updated fstab to use UUID, I have run grub-install on the external drive after chrooted into that drive. –  Ernelli May 16 '11 at 13:58
add comment

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
It worked, except that update-grub must be run before reboot (Missed that out) update-grub always reads and writes to / and /boot so I had to chroot into external drive and then do the whole grub-install-update dance –  Ernelli May 16 '11 at 17:05
    
Yes sorry you do need to "sudo update-grub" before you reboot –  Malee May 17 '11 at 10:35
add comment

you could use the dd command to clone your hard drive into the external one.

dd if=/dev/sda of=/dev/sdb

where sda is the internal and sdb the external. that would clone the sda drive into the sdb device.Just adjust the device to your needs. it will also mirror the partition table. so it will preserve the swap or /home partition.

share|improve this answer
    
I was planning to use dd later on to copy the partition, but that is not the problem, the problem is that after the disk is mirrored, how do I make it bootable? e.g fstab and grub both points to /dev/hda, I chrooted, ran grub-install /dev/hdb, updated fstab ti use UUID but still the Laptop has the internal HDD mounted after boot. –  Ernelli May 16 '11 at 13:47
add comment

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.