NTL2009
May 29th, 2012, 04:39 PM
Sorry for the length, but I have done testing and made progress, so I'm detailing the steps that worked for me.
The end goal is to move my current 10.04 install (separate / and /home partitions) to an external USB drive, and to be able to boot from that or my current install with or w/o both drives connected. At that point, after some testing, I will wipe my internal drive and install Xubuntu 12.04. I also want to be able to boot the external on another machine, so I want a GRUB2 on the root of that ext drive. Lets say my internal current install is on sda1 (/) and sda2 (/home), and my external is sdb1, sdb2.
I have attempted this in the past, and always seem to run into boot issues. So I am taking some baby steps here, to verify each step in my processes.
I plan to use Grsync with proper 'excludes' to copy each partition. I like Grsync as it does not require a same size or larger partition (I have lots of free space on my current install). I think that to boot the copy, there are a few things I need to do:
A- Find UUIDs of the partitions I copied to (sudo blkid), and update /etc/fstab with those UUIDs in the root of that copy.
That's easy, but the next steps involve installing and updating GRUB2, and I always seem to run into problems here. The problems seem due to the fact that since I can't (yet) boot into the ext, I have to 'tell' my system where I want the GRUB2 installed and updated.
B- I see various methods for this, some examples are like:
sudo mount /dev/sdXY /mnt
sudo grub-install --root-directory=/mnt /dev/sdX
and some others guides where you do something similar, then chroot into it, and some include various --bind commands. I'm confused by all these options. None have worked for me to make the external bootable, even though I seem to get around any errors.
So - here are some baby steps, where I created a UUID mismatch, and fixed it, and that DID WORK for me:
I installed 12.04 Xubuntu on the external, and tested that it booted - OK. NOTE- this is a new install with no UUID conflicts with any other drives.
I then CHANGED the UUID on that / (using tune2fs command), and as expected, it would no longer boot.
I edited /etc/fstab to match the new / UUID, and as expected, it still would not boot (still needs a grub install or upgrade).
Since I fail when I try to 'point' another install to the GRUB2 on this external, I then tried this trick:
Returned the UUIDs and fstab to their original values, and boot this install.
From this running install, I change the / UUID to a new value, and edit fstab to match. I was a little surprised it allowed me to change my 'own' / UUID, but it did.
From this running install, I sudo grub-install /dev/sdX (sdb in my example), then sudo update-grub.
My boot/grub/grub.cfg got updated with the new UUID this time, and it boots!
So to summarize, my fstab edits & GRUB commands seem to work when I'm in the system that I am updating. But trying to update sdb, when I am running from sda or a LIVE USB/CD, doesn't work for me.
I guess I can do my working process if I move that ext drive copy to another computer, or remove the internal. But I'd really like to just copy, edit fstab and then update GRUB from another running install. Any suggestions as to what I'm doing wrong?
edit/add: FYI, I partitioned my external as GUID, if that makes any difference.
-NTL2009
The end goal is to move my current 10.04 install (separate / and /home partitions) to an external USB drive, and to be able to boot from that or my current install with or w/o both drives connected. At that point, after some testing, I will wipe my internal drive and install Xubuntu 12.04. I also want to be able to boot the external on another machine, so I want a GRUB2 on the root of that ext drive. Lets say my internal current install is on sda1 (/) and sda2 (/home), and my external is sdb1, sdb2.
I have attempted this in the past, and always seem to run into boot issues. So I am taking some baby steps here, to verify each step in my processes.
I plan to use Grsync with proper 'excludes' to copy each partition. I like Grsync as it does not require a same size or larger partition (I have lots of free space on my current install). I think that to boot the copy, there are a few things I need to do:
A- Find UUIDs of the partitions I copied to (sudo blkid), and update /etc/fstab with those UUIDs in the root of that copy.
That's easy, but the next steps involve installing and updating GRUB2, and I always seem to run into problems here. The problems seem due to the fact that since I can't (yet) boot into the ext, I have to 'tell' my system where I want the GRUB2 installed and updated.
B- I see various methods for this, some examples are like:
sudo mount /dev/sdXY /mnt
sudo grub-install --root-directory=/mnt /dev/sdX
and some others guides where you do something similar, then chroot into it, and some include various --bind commands. I'm confused by all these options. None have worked for me to make the external bootable, even though I seem to get around any errors.
So - here are some baby steps, where I created a UUID mismatch, and fixed it, and that DID WORK for me:
I installed 12.04 Xubuntu on the external, and tested that it booted - OK. NOTE- this is a new install with no UUID conflicts with any other drives.
I then CHANGED the UUID on that / (using tune2fs command), and as expected, it would no longer boot.
I edited /etc/fstab to match the new / UUID, and as expected, it still would not boot (still needs a grub install or upgrade).
Since I fail when I try to 'point' another install to the GRUB2 on this external, I then tried this trick:
Returned the UUIDs and fstab to their original values, and boot this install.
From this running install, I change the / UUID to a new value, and edit fstab to match. I was a little surprised it allowed me to change my 'own' / UUID, but it did.
From this running install, I sudo grub-install /dev/sdX (sdb in my example), then sudo update-grub.
My boot/grub/grub.cfg got updated with the new UUID this time, and it boots!
So to summarize, my fstab edits & GRUB commands seem to work when I'm in the system that I am updating. But trying to update sdb, when I am running from sda or a LIVE USB/CD, doesn't work for me.
I guess I can do my working process if I move that ext drive copy to another computer, or remove the internal. But I'd really like to just copy, edit fstab and then update GRUB from another running install. Any suggestions as to what I'm doing wrong?
edit/add: FYI, I partitioned my external as GUID, if that makes any difference.
-NTL2009