Migrate ubuntu to another partition

Phillip Susi psusi at cfl.rr.com
Tue Mar 7 15:26:42 UTC 2006


Alan McKinnon wrote:
>> Also if you try to install grub to the wrong /boot partition it
>> will not make the system unbootable, it will simply fail to install
>> because it can't find the stage2 file.
>>     
>
> I don't understand what you mean here. Does grub-install not keep it's 
> stages in /lib/grub/<arch>, and copy stage 1 and stage1_5 to the MBR 
> and boot sector, and stage2 to /boot/grub? At boot time stage1 loads 
> stage1_5, which loads stage2 from /boot/grub
>
>   

Actually, stage1_5 gets installed to the free space between the MBR and 
the first partition.  No boot sectors get touched.

> On unbootable, this will indeed be the case if grub was installed to 
> the / partition, and the bootloader is set up with root(x,y) pointing 
> to the /boot partition. But this matters naught if the user did a 
> default install.
>
>   

If you install grub with grub-install while /boot is not mounted, then 
it will set up the menu.lst to issue the root command pointing to the 
root fs, and your /boot partition will just never be used for anything.  
Essentially, you won't have a /boot partition, just a spare unused one.  
If you manually edit menu.lst and change the root to the unused 
partition, then yea, you've broken your boot up, but you can still hit 
escape during boot and tell grub to use the correct root. 

> It's /boot/boot -> ./ on the partition holding /boot. Again, it's for 
> dual-boot systems with more than one distro. To this day I still 
> often make the mistake of getting --root-directory=/path/ wrong and 
> grub presents me with a completely blank screen. Usual solution = 
> reboot with Knoppix, re-run grub-install. With a minimalist grub 
> backup on / I instead usually get a grub shell, which can boot. Then 
> I don't have to search for the Knoppix cd (which is never handy when 
> I need it). The symlink is a gentoo-ism that catches the occasional 
> wrong --root-directory path. Since I started using it my grub-install 
> failures are zero, one symlink does no harm and when I get it wrong 
> it still gives the result I want
>
>   

I see how that would help you now.  If you specify 
--root-directory=/boot then grub will look for a directory named boot in 
the /boot partition, which your symlink provides.  Why bother specifying 
--root-directory at all though?  I've never needed to.  I believe if you 
omit the parameter then grub looks for /boot and if it isn't there, then 
just installs to the root ( of the /boot partition ).  In other words, 
it's smart enough to figure it out if you don't try to outsmart it ;)

>>> as root:
>>> mount --bind / /mnt/test
>>> cd /mnt/test/boot/
>>>       
>> Why make an alias with the bind mount?  Just skip the mount and cd
>> to /boot.
>>     
>
> My bads, the order is wrong. 'cd /boot ; ln -s . boot' is issued 
> before 'mount'. And it's --rbind, not --bind
>
> The --rbind is to get to the files under /boot on the root partition. 
> They are hidden once /boot is mounted
>
>   
But you never mounted anything over /boot.  Maybe you just forgot to 
show that?
>>> ln -s . boot
>>> mkdir -p grub
>>> cp /boot/vmlinuz-xxxxxx ./
>>> cp /boot/grub/menu.lst grub/
>>>       
>> That is trying to copy /boot/vmlinuz-xxx onto itself, which isn't a
>> good idea.
>>     
>
> Nope. It will copy a file from the real /boot partition to the / 
> partition at /mnt/test/boot. mount --rbind does not bind sub-mounts
>
>   

If you mounted something over /boot then yes, it would copy from the 
/boot partition to the /boot directory in the root partition, but I 
think you got --bind and --rbind backwards.  --bind binds a single mount 
point, --rbind includes all mount points under that one.  The r is for 
recursive.


Again though, what good does having hidden copies of /boot files in the 
root fs do you? 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060307/c98c2201/attachment.html>


More information about the ubuntu-users mailing list