[ale] replacing disk sda

Michael H. Warfield mhw at WittsEnd.com
Wed Apr 23 13:15:13 EDT 2014


On Wed, 2014-04-23 at 10:13 -0500, Preston wrote:
> On 4/23/2014 9:35 AM, Paul Cartwright wrote:
> 
> > On 04/23/2014 10:29 AM, Preston wrote:
> > 
> > > > 
> > > > 
> > > here's one of the mbr-backups.
> > > 
> > > pboyington at openmediavault:/media/3b7fcae9-905e-4863-91fb-ddfee3396254/Data/fsarchive-backup$ cat mbr-backup-2014-04-15.bak
> > > # partition table of /dev/sdf
> > > unit: sectors
> > > 
> > > /dev/sdf1 : start=       63, size=224845677, Id=83, bootable
> > > /dev/sdf2 : start=224845740, size=  9590805, Id= 5
> > > /dev/sdf3 : start=        0, size=        0, Id= 0
> > > /dev/sdf4 : start=        0, size=        0, Id= 0
> > > /dev/sdf5 : start=224845803, size=  9590742, Id=82
> > > 
> > > maybe you were expecting a hex output like dd does?  this is
> > > handled by sfdisk.
> > then I guess I misunderstood what is in an MBR:)
> > there is nothing there about grub, or what OSes can be booted, just
> > the partition start/end/sizes.. I guess I'm getting edumacated:)
> > where does the grub info go in the MBR??
> 
> GRUB is a boot loader and is in your /boot directory (/boot/grub/).

Yes, but that's not the whole story.  Grub is also the boot code that
gets loaded into the MBR so the machine can find the boot code in /boot.
Grub2 also requires some of the protected sectors after sector 0 and
before the start of the first partition, if you are using a classical
BIOS boot.  If you are using EFI boot, the game changes significantly
but, still, part of grub, the initial boot code, is installed to the
MBR.

> From what little I remember, your MBR just lists the device, starting
> point, number of sectors, partition type, and whether it is bootable.
> It doesn't include logical partitions as they are described within the
> extended partition.

Not true.  The Master Boot Record also contains the asm code to start
the boot process.  The (classical) partition table is only the last
small part of the MBR.

> So your MBR just tells your machine to look at the bootable partition
> and from there GRUB takes over.

Machine BIOS validates the magic number (55AA) and CRC of the MBR and
then executes it.  It's the code from the MBR which then examines the
partition table and chains over to the boot code in the appropriate
locations.

The partition table starts at +01BEh in the first sector.  Everything
before that is boot code and grub / grub2 installs part of itself in
there.

http://en.wikipedia.org/wiki/Master_boot_record

Now, that being said, using something like syslinux, you can set up more
of a classical MBR honoring the "bootable" bit in the partition and
install grub into the partition itself.  Then the bootloader code
chainboots to the code in the partition and the process recurses.  I'm
not so sure you can do that with grub2 which requires those extended
sectors after sector 0.

> Preston
> 
> -- 
> Be who you are and say what you feel, because those who mind don’t matter and those who matter don’t mind.
> -Dr. Seuss
> 
> -- 
> This message has been scanned for viruses and 
> dangerous content by MailScanner, and is 
> believed to be clean. 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo

-- 
Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://mail.ale.org/pipermail/ale/attachments/20140423/18141582/attachment.sig>


More information about the Ale mailing list