Mystery of chroot

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sun Jul 22 16:28:15 UTC 2007


Timothy Murphy wrote:
> This is a purely theoretical question.
> 
> Yesterday I re-installed Windows XP on /dev/sda1 on my laptop
> (I'd used dd to try to copy Windows from a smaller partition,
> and while this booted it had a number of bizarre error).
> 
> Anyway, this removed grub from the MBR,
If it replaced grub, then you probably also replaced the partition
table on the drive. Depending on the sizes of the drives involved,
the drive may also be reporting a different geometry then it should.
I don't remember if XP puts the file system size information at the
start of the partition, but at least some versions of Windows did,
requiring you to zero out the first sector of the partition, or
something like that. You are better off using something like parted
to copy a partition.

> so I used Knoppix to re-install grub,
> which I did without problem by running
>         grub-install --root-directory=/mnt/sda5 /dev/sda
> 
> I was surprised how long this took - over 10 minutes
> on a ThinkPad T43 (800MHz with 512MB RAM).
> Admittedly the new disk is quite large, 120GB,
> but what exactly is grub-install doing?
> 
It should not take this long - I think you had other problems -
possible because of the way you copied Widows to the drive.

> But that isn't my question.
> My first attempt to re-install grub
> was to mount /dev/sda5 as /mnt/sda5
> and then run "chroot /mnt/sda5".
> What puzzled me is that after this /dev/sda was not found.
> Why is this?
> Does one have to run something like udevd after chroot now?
> 
What does your partition table look like? Is sda5 your root
partition, or your boot partition? If it is your root partition, it
would be interesting to see what is in the /dev directory after you
run chroot.


One other thing to keep in mind is that it is better to create the
first partition using Windows. Windows and Linux do not always agree
on the geometry of the drive. If you create a partition using
Windows, then Linux fdisk will see the geometry that Windows is
using and use it.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070722/7a65f70c/attachment-0002.bin 


More information about the users mailing list