Gentoo Archives: gentoo-user

From: Eric Bliss <eric@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] More on mbr
Date: Wed, 21 Dec 2005 00:40:08
Message-Id: 200512201635.33982.eric@creativecow.net
In Reply to: [gentoo-user] More on mbr by reader@newsguy.com
1 On Tuesday 20 December 2005 03:45 pm, reader@×××××××.com wrote:
2 > How can I get a real eyes on look at what is in the MBR. I'm trying
3 > this:
4 >
5 > dd if=/dev/hda of=mbr.img bs=512 count=1
6 >
7 > I thought maybe it could be mounted so:
8 > mkdir mbr
9 > mount -o loop mbr.img mbr
10 >
11 > But mount wants to know what `type' filesystem it is. I tried a few
12 > things but really didn't expect them to work like:
13 > ext2 msdos minix iso9660
14 >
15 > None worked of course. So can this be done? Any one know what
16 > should be in there exactly and how to view it?
17 >
18
19 The MBR isn't a partition itself, it merely stores the partition information.
20 As I understand it (and if somebody else has better info, or I've got things
21 backward, please correct me), the MBR is the first 512 bytes of the disk.
22 The first 446 bytes of it is the bootstrap loader code itself - the actual
23 workhorse that starts the system up to load the OS. The rest of it (66
24 bytes) is the core partition information for the disk. Overwriting this part
25 of it will wipe out your partition table - not something you want to do.
26
27 The book "Linux Desktop Hacks" has a section just on saving, fixing and
28 restoring the MBR. Rather than using bs=512, you'll want to use bs=446 when
29 overwriting the MBR (if you had a backup, and want to do it by hand), or use
30 a tool like grub-install (the Gentoo Handbook has a chapter on configuring
31 the bootloaders - LILO or GRUB - part 1, chapter 10).
32
33 Good luck.
34
35 --
36 Eric Bliss
37 systems design and integration,
38 CreativeCow.Net
39 --
40 gentoo-user@g.o mailing list