ubuntu dual boot illustrated site ubuntu dual boot windows 7 maverick meerkat
MBR Page

Edited Saturday, September 25 2010 Document made with KompoZer

This web-page is part of a larger site giving examples of how to install Windows+Ubuntu Linux operating systems 'dual boot' in a computer.  Illustrated Dual Boot HomePage
NOTICE:
This website contains information that is out of date and may be  harmful to new computers.
The author only has old computers and is not contemplating the purchase of any new equipment now or in the near future.  The information given below is relevant to old computers and may still be useful for some people.


PAGE INDEX

Hard Disk Information - for beginners

What is the MBR?.

MBR Backup and Restore

What are 'boot sectors'?.

What is the 'IPL' for the boot loader?.

What does an IPL really look like?.

What does the IPL for a bootloader do?.

What does a Partition Table really look like?.

Is the MBR part of the Windows file system (Partition)?.

Can a bootloader's IPL be installed to a partition?.

The partition table and partition numbering.

Managing My Partitions with GParted.

A Birds's eye view of Windows XP... showing the important files needed for booting

Installing a Boot Loader for Ubuntu.

If you choose <Yes> ( to Install GRUB's IPL to MBR)

If you choose <No> ( to Install GRUB's IPL to a custom location)

If you choose <Go Back> ( to Install LILO Boot Loader)

The Ubuntu Installer Main Menu.



WARNING: This web page contains information which is only partially correct

Information that beginners can understand is not technically correct.
Information that is technically correct is difficult for beginners to understand.
(Lao Tzu)

Hard disks, MBRs and boot sectors, disk geometry, partition tables, and file systems are complex technical subjects. The information in this web page is intended for beginners and should be sufficiently accurate to explain what's happening to someone who wants to install Ubuntu in a computer, and dual boot with some other operating system.  It is beyond the scope of this web page to be technically correct to anyone who takes the subject seriously, for example, anyone studying computer science.  
Care should be taken to check the accuracy of anything in this web page if it will be re-used or quoted for any purpose, (homework, school assignments etc).
This web page contains lots of links to some excellent external websites, however.
Please accept my apologies for any inconvenience that might be caused by any omissions or errors and check the other websites for more accurate and detailed information.


   

Hard Disk Information


DSCF0470.png
                        DSCF0470.png
A hard disk.
Viewed from the outside just looks like a metal box with a ribbon cable and some wires plugged into it.

It is not recommended for users to open their own hard drives because even microscopic dust particles will get in it and ruin it.
This one's just an old one that's no good anymore so I have opened it to see what's in it.

DSCF0471.png
 DSCF0471.png
On the inside, there are some shiny round 'platters' on a 'spindle'. The hard disk in this picture has only two platters, but many have more than that, possibly three or four platters.

A small 12 volt electric motor underneath turns the spindle and platters at a very fast speed, about 5400 rpm for an older, slower hard disk and up to as much as 10000 rpm or more for some of the fastest, most modern hard disk drives.
 
The arms above and below each platter hold tiny read/write heads and are controlled by precision electronics.

The tiny read/write heads on the end of the arms float on a thin cushion of air just above the spinning disk surface. The arms pivot around to sweep the read/write heads across the spinning disk platters in search of the data you want. 
    
Data on the hard disk platters is written in concentric rings (like growth rings on a tree stump), called 'tracks'. 
        
Tracks are divided up into 'sectors'.
There are  63 sectors per track, so they could be imagined to be a little smaller than one minute on a watch face.
One sector on a hard disk can hold 512 bytes of data.
  
When you read the word 'cylinder' when used in reference to hard disk geometry, it means an imaginary cylinder connecting all  the tracks (rings) that are the same size on both the top and bottom of each platter for all the platters in the hard disk.

Now, please click on the following link to a great website whose author has done an excellent job of illustrating and explaining sectors, tracks, cylinders and heads, Disk Geometry   - Elementary Computer Mathematics by Kenneth R. Koehler.
Don't forget to come back to this page when you are finished, in case you start getting interested in the rest of that website!

Zoned Bit Recording
In order to use all the space in a hard disk efficiently, it would be just plain silly to have only 63 sectors in the outside tracks and 63 sectors in the inside tracks.
As anyone can imagine, the sectors in the outside tracks would be much bigger than the sectors in the inside tracks, so why not divide up the outside track into smaller sectors too, and make better use of the available space in the hard disk?
Please take a look at the following web page for more details, Hard Disk Sector Structures - Dew Associates.
The user and the operating system is tricked into believing there are 63 sectors per track, and it is convenient to be able to think that way. What is really inside the hard disk is something much more complicated.

Cylinders, Heads and Sectors
Originally, DOS used 'CHS', (Cylinders, Heads and Sectors) to plot the co-ordinates of important locations on the hard drive, like the Windows boot sector, or end of one partition, and the start of another partition. Cylinder-head-sector - Wikipedia

The main problem with CHS addressing turned out to be, when hard disk makers learned how to make things smaller so we could fit more sectors and hence more information in the same sized disk, the software ran out of room for the numbers it needed to address the extra disk space, so the extra space couldn't be used.

LBA - Logical Block Addressing
Logical Block Addressing simply means numbering each sector starting with sector 0 (zero, the MBR), at the start of the disk, and counting all the way to the end of the disk. It's possible to address many more sectors this way.
When LBA was introduced it meant that Linux could be installed in 'large' hard disks (over 1024 cylinders, or 504 Mb). Logical block addressing - Wikipedia




DSCF0473.png
  DSCF0473.png
What we call the 'start' of a disk means the outside edge, and the 'end' of a disk is really the part closest to the center. For LBA (Logical Block Addressing), sector numbers of the disk are counted from the outside in. It make sense doesn't it? That's probably why they call it 'Logical'  (block addressing).
 
When you are partitioning and decide to place a partition at the 'beginning of the free space', you are putting it towards the outside of the disc.
Placing a partition at 'the end of the free space' puts it towards the center of the disk.

Links:

Hard Disk Drive - Wikipedia

StorageReview.com A Brief History of the Hard Disk Drive

Partition types Andries Brouwer, aeb@cwi.nl 2007-10-01

Minimal partition table specification Andries Brouwer, aeb@cwi.nl 1999-09-16

Large Disk HOWTO Andries Brouwer, aeb@cwi.nl v2.5, 2004-11-01 

Linux Planet Tutorial: Adding Additional Hard Drives in Linux
NOTE: Particularly take a close look at that link's excellent illustrations! (On the second and third pages). Recommended!



 



What is the MBR?
DSCF0478.png
DSCF0478.png
 The MBR is located in sector 0, which is the first sector of the hard disk and at the start of the first track, somewhere close to the outside edge.

Here is the Wikipedia Link: Master Boot Record - Wikipedia

The MBR (Master Boot Record) is located in the first sector of a hard disk. The MBR may also be called a 'boot sector', but it is a very special kind of boot sector because it also contains the partition table.
The partititon table contains directions which define the start and end points of up to four primary partitions.
Without this information, your operating systems and data can be on the disk, but most ordinary software would not know how to find it.

When a PC boots up, the BIOS looks at the hard disks in numerical order and tries to boot the first one it finds with the aa55 bootable disk signal in its MBR. If there is no boot loader code written to the MBR, the BIOS looks for the boot flag in the partition table and tries to boot the first sector of the active partition. (The one with the boot flag).
If there is a boot loader code written to the MBR, the boot loader takes over and the boot loader looks at partition information in the MBR and the computer can start to boot.

The MBR does not belong to any partitions or to any particular operating system. It would be more accurate to say that the partitions and operating systems in the hard disk belong to the MBR, because the MBR contains the partition table.
  • The letters 'MBR' stand for 'Master Boot Record'
  • There can only be one Master Boot Record on each hard disk.
  • The Master Boot Record is always situated in the first sector of each hard disk
  • Every hard disk is given a Master Boot Record when it is formatted.
  • The Master Boot Record contains the hard disk's partition table 
  • The Master Boot Record may contain a small amount of boot loader code
In some ways, the MBR might be thought of as something similar to the index of a book.
The index page of a book gives the page number for the start of each chapter, something like the partition table listing the sector information for the start and end of each partition.

A new hard disk might not have a MBR until it is formatted by using some kind of hard disk partitioning software such as GParted -- LiveCD for example, (that's what I use). 'Formatting' a disk means giving it a MBR.
After your hard disk has a MBR, you can make partitions, by using sofware to write information to the partition table in the MBR.

Another word for a MBR is a 'disk label'.  GParted LiveCD can make several kinds of disc labels.
The msdos type disc label is the kind most of us use, only because most new computers come with Windows in them when we buy them. There are also amiga, bsd, dvh, gpt, mac, pc98, s390, sun and loop disc labels.
Ubuntu isn't restricted to use only the msdos disc label, but this website is about dual booting with Windows, so the msdos type disc label is the kind I'm talking about in this website.



 
What does an MBR really look like?


If you want to take a look at your own hard disk's MBR, try using the following dd command,
code:
sudo dd if=/dev/sda count=1 | hexdump -C

After running that command, you should see something like the text below,
00000000  
00000010  
*
00000050  
00000060  
00000070  
00000080  
00000090  
000000a0  
000000b0  
000000c0  
000000d0  
000000e0  
000000f0  
00000100  
00000110  
00000120  
00000130  
00000140  
00000150  
00000160  
00000170  
00000180  
00000190  
000001a0  
000001b0  
000001c0  
000001d0  
*
000001f0
eb 63 90 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00  00 00 00 80 01 00 00 00
00 00 00 00 ff fa 90 90  f6 c2 80 75 02 b2 80 ea
74 7c 00 00 31 c0 8e d8  8e d0 bc 00 20 fb a0 64
7c 3c ff 74 02 88 c2 52  bb 17 04 80 27 03 74 06
be 88 7d e8 1c 01 be 05  7c f6 c2 80 74 48 b4 41
bb aa 55 cd 13 5a 52 72  3d 81 fb 55 aa 75 37 83
e1 01 74 32 31 c0 89 44  04 40 88 44 ff 89 44 02
c7 04 10 00 66 8b 1e 5c  7c 66 89 5c 08 66 8b 1e
60 7c 66 89 5c 0c c7 44  06 00 70 b4 42 cd 13 72
05 bb 00 70 eb 76 b4 08  cd 13 73 0d f6 c2 80 0f
84 d0 00 be 93 7d e9 82  00 66 0f b6 c6 88 64 ff
40 66 89 44 04 0f b6 d1  c1 e2 02 88 e8 88 f4 40
89 44 08 0f b6 c2 c0 e8  02 66 89 04 66 a1 60 7c
66 09 c0 75 4e 66 a1 5c  7c 66 31 d2 66 f7 34 88
d1 31 d2 66 f7 74 04 3b  44 08 7d 37 fe c1 88 c5
30 c0 c1 e8 02 08 c1 88  d0 5a 88 c6 bb 00 70 8e
c3 31 db b8 01 02 cd 13  72 1e 8c c3 60 1e b9 00
01 8e db 31 f6 bf 00 80  8e c6 fc f3 a5 1f 61 ff
26 5a 7c be 8e 7d eb 03  be 9d 7d e8 34 00 be a2
7d e8 2e 00 cd 18 eb fe  47 52 55 42 20 00 47 65
6f 6d 00 48 61 72 64 20  44 69 73 6b 00 52 65 61
64 00 20 45 72 72 6f 72  0d 0a 00 bb 01 00 b4 0e
cd 10 ac 3c 00 75 f4 c3  b2 90 69 9c 00 00 80 00
01 01 83 1f e0 ff 00 04  00 00 00 04 74 07 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00
*                                                                        
            
00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa

|.c..............|
|................|

|................|
|...........u....|
|t|..1....... ..d|
||<.t...R....'.t.|
|..}.....|...tH.A|
|..U..ZRr=..U.u7.|
|..t21..D.@.D..D.|
|....f..\|f.\.f..|
|`|f.\..D..p.B..r|
|...p.v....s.....|
|.....}...f....d.|
|@f.D...........@|
|.D.......f..f.`||
|f..uNf.\|f1.f.4.|
|.1.f.t.;D.}7....|
0........Z....p.|
|.1......r...`...|
|...1..........a.|
|&Z|..}....}.4...|
|}.......GRUB .Ge|
|om.Hard Disk.Rea|
|d. Error........|
|...<.u....i.....|
|............t...|
|................|

|..............U.|

Boot Loader Code Area
The MBR consists of 512 bytes of data, and the first 446 bytes of the MBR, (the lines between 00000000 and 000001b0) that look like this, 'eb 63 90 00 00 00 00 00  00 00 00 00 00 00 00 00', may contain code for the bootloader if you have one installed. This code is essentially for pointing the BIOS to some other location in a hard disk where it should find more code for a boot loader. If no boot loader has code written in this area, it can be empty or contain garbage. If there is no bootloader code in the MBR, the BIOS will go to boot sector of the active partition, (whichever partition is marked with the  'boot flag' in the partition table).

Disk ID number
The area I have highlighted in light red with dark red font, ( b2 90 69 9c), is the Disk Identifier for the hard disk, which is a 4-byte random number that is automatically generated when the MBR is first written. The disk identifier can also be seen in the output from 'sudo fdisk -lu'.
It's important to preserve this disk Unique ID number especially if there's a Windows 7 or Vista operating system using it, because the BCD boot loader is tied to it, and Windows won't boot if that disk ID number is changed.
If your hard disk fails and you need to clone your Windows installation to a new hard disk, you need to make sure you also clone the first 446 bytes of the MBR which includes this disk ID number, or Windows will refuse to boot.
Click on the following link, Back up your MBR

The partition table consists of four entries of sixteen bytes each, (64 bytes altogether), and we can have up to four primary partitions.
                                                                         80 00
01 01 83 1f e0 ff 00 04  00 00 00 04 74 07 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00
*                                                                                      
00 00 00 00 00 00 00 00  00 00 00 00 00 00

For more partitions than just the four that can fit in the partition table, one of those partition table entries can point to an 'extended' partition which can contain a series of 'logical' partitions who's boot sectors each contain code which points to the next in the series.

The 80 is the boot flag, and a partititon editor like GParted can be used to move the boot flag around, and GParted can even set a boot flag in a logical partition. The boot flag is not important for booting Linux at all, but it seems to be required by some BIOSes for booting older versions of Windows.

Bootable Disk Signature
Last, but not least, your MBR's 2-byte  55 aa 'bootable disk' signal, tells the BIOS that this hard disk is bootable. The BIOS looks for the first hard disk in the list of hard disks that has this  55 aa bootable disk signature and tries to boot it. If it can't find any disk with this signal, it will give an error message something like 'Disk boot failure, insert system disk and press enter'.   Also see this website's BIOS Page.


Here is a link to a web site that explains more about the MBR code, and lots of other interesting subjects as well, The Starman's Realm.

The Starman has way more information about MBRs and boot sectors than I can learn or fit in my website, here is a link to the Starman's MBR pages, MBR (Master Boot Record): Specific Types of Code/Structures.

Here's The Starman's take on Grub and the way we install it in Ubuntu, GRUB - The GRand Unified Boot Manager!  This link also contains a much more detailed examination of the MBR with GRUB's Stage1 code than I have.

The Starman has lots of information on Hexadecimal code too, 'All About Hexadecimal'.

I find The Starman's site very interesting reading. It will be a while before I manage to digest it all.

Here's a link to a website with more dd commands, Learn the DD command - LinuxQuestions.org


Writing a bootloader to MBR.
We often say we are going to install or reinstall some boot loader or another to MBR.
Statements like that cause some confusion for newcomers, because the MBR is only one sector, and one sector of a hard disc can only hold 512 bytes of data. No bootloader is really that small.
Fortunately, there's plenty of vacant hard disk space in the remaining 62 sectors of the first track of the hard disk, immediately following the MBR where we can put some extra code for the boot loader.
When we write GRUB to MBR, we write GRUB's boot.img to the first 446 byte area of the MBR, and embed a custom made core.img to the next approximately 49 sectors of the first track of the disk.

You might not want to have GRUB's core.img embedded in the first track of your hard disk under some circumstances, particularly if you think you might have some other code embedded there already like RAID modules or some kind of full disk encryption software. In that case you may need to look at other options and at least make a dd backup of the first track of your hard disk, see  First track Backup and Restore.

What is the 'IPL' for the boot loader?
The 446 byte area of the 'boot sector' allowed for the bootloader is really too small for any decent boot loader to fit into. There is enough room for a small amount of code called the 'IPL' (Initial Program Loader). The 'First stage' or 'boot.img' of the boot loader are other names for the same code.

What does the IPL for a bootloader do?
All the IPL or first stage of a bootloader has to do is look at the partition table, and tell the BIOS where on the hard disk  to go looking for the next (larger) part of the boot loader.

The larger part of the bootloader is called the 'second stage'.
If it is the IPL for  Windows bootloader, (NTLDR), it points the BIOS to Windows boot sector and on to the right files in the Windows partition to start the second stage. Then the Windows bootloader takes over and does the real work and actually boots the operating system.

If the IPL for GRUB or GAG is in the MBR, the BIOS goes to the first track of the hard disk, which is normally empty, so some boot loaders use that for an area to put extra code. The  first track of the hard disk, beginning with the MBR, is not formatted with any file system so it doesn't belong to any particular operating system.

GAG Boot Manager pretty near fills up the first track of the hard disk, because it has to fit in there entirely, GAG is 'operating system independant', meaning you can delete any or all operating systems and GAG Boot Manager will still be there.

GRUB boot loader uses around the first 49 sectors of the first track for it's core.img. GRUB's core.img loads into memory and the looks for the operating system's /boot/grub/normal.mod and finds /boot/grub/grub.cfg and loads additional modules which enable it to become more functional.
If GRUB's core.img can't find /boot/grub/normal.mod and /boot/grub/core.img you will at least be given a rescue shell, with which you might be able to manually direct GRUB to those files if you know how. See 17.1 GRUB only offers a rescue shell - GNU GRUB Manual 1.98 for more details.

If you choose to install LiLo instead of GRUB, LiLo makes a backup of your MBR, and it doesn't write to the first track of the hard disk at all. LiLo can be installed with the 'Alternate' CD. The 'Alternate' CD is the main subject of this web site. If you choose <Go Back> ( to Install LILO Boot Loader).

The following code will install GRUB to MBR of the first hard disk, from a hard disk installed Ubuntu operating system.
Code:
sudo grub-install /dev/sda
Where: 'sda' is the first hard disk if you have more than one.
You can install Grub to MBR on a non-first hard disk with 'sdb' for second hard disk MBR, or 'sdc' for third hard disk MBR, and so on. 

The Windows FIXMBR command writes Windows XP's boot loader code to MBR. See this website's Un-install Page for details, and for more ways to restore Windows boot code to a hard disk's MBR.




MBR Backup and Restore
If you want to, you can make a back up of your hard disk's MBR with a Linux Live CD such as a ubuntu 'desktop' Live/Install CD before you begin your Linux installation.
This backup is for easily restoring your old boot loader if you make a mistake during the installation.

This MBR backup may be useful to Windows users because it will include your MBR's 'disk signature', which is important for booting Windows 7 and Windows Vista.
No Linux installation will overwrite the 'disk signature' in your MBR, but if you use a partition editor to set a new disk label, (format your hard disk), then your MBR will have a new 'disk signature'.

You can copy the MBR backup file to any media you like for storage.
 In this example I used a USB disk. You may use a floppy disk or a CD-ROM just as easily.
 
Create the MBR backup with a dd command
  1. Boot your Live CD. (Ubuntu Desktop in this example).
  2. Open a terminal (Applications, Accessories, Terminal)
  3. Code:
sudo dd if=/dev/sda of=/home/ubuntu/100921MBR.img bs=446 count=1
Where:  ubuntu is your username (it is the default username for the live CD),
Where:  your hard disk is seen as 'sda', by Linux, feel free to replace the 'a' with a 'b' or 'c' and so on if it's the second or third hard or more hard disk's MBR you're copying.
Where: '100921MBR.img' will be your name for your MBR backup file, you can make up your own file name here, anything you like. I usually use the date for a file name if I can't think of anything better.
quote:
  1+0 records in
 1+0 records out
 446 bytes copied,  4.3e-05 seconds, 10.4 MB/s

Copy the MBR backup to USB disk:
  1. Plug in USB flash memory stick
  2. Open /home/ubuntu directory, locate file named 100921MBR.img
  3. Open your USB drive, drag and drop 100921MBR.img there somewhere.
  4. Carry on with your Ubuntu Install.
Warning:
Some web pages recommend that you should make a backup copy of the entire 512 bytes of your MBR, including the partition table and 55 aa signature.

That may be useful for some purposes, but be sure you destroy that copy of your MBR if you decide to re-partition your disk later. If you accidentally restore your MBR backup with an out of date partition table, it might not match the partitions you have currently on your hard disk. It may cause some of your filesystems to be unreadable and you will need to use TestDisk to write yourself a new partition table - TestDisk Page.

Most people only need a backup copy of the bootloader code area, including the MBR's 'disk signature'. For that we only need the first 466 bytes of the MBR, so it will not include the partition table. That is much safer. That is what I do, and what is shown here. 

Restore command:
  1. You will need to copy your MBR backup file 100921MBR.img from your USB device to the /home/ubuntu folder in your Live CD for this restore command to work as it is, otherwise, you will need alter your command with the correct file path for the file in the USB.
code:
sudo dd if=/home/ubuntu/100921MBR.img of=/dev/sda bs=446 count=1
Where:  ubuntu is your username (it is the default username for the live CD),
Where:  your hard disk is seen as 'sda', by Linux, feel free to replace the 's' with an 'h' if appropriate, or maybe the 'a' with a 'b' or 'c' and so on if it's the second or third hard or more hard disk's MBR you're copying.
Where: 100921MBR.img is the name of your MBR backup file.

Here's a link to a website with more dd commands, Learn the DD command - LinuxQuestions.org

Bitlocker Drive Encryption for Windows
- Can other tools that manage or modify the master boot record work with BitLocker? - Microsoft.
- Vista SP1 won't install on dual-boot systems: Microsoft
- Why do I miss Microsoft BitLocker? - Joanna Rutkowska


First track Backup and Restore

In addition to backing up and restoring the MBR, some people might be interested in making a backup of the entire first track of the hard disk as well, just to be on the safe side.
The reason for that is, GRUB and some other boot loaders or boot managers write code to the first track of the hard disk, meaning the next 62 sectors immediately following the MBR.
Normally, this area of the hard disk is vacant, and reserved for the use of boot loaders.
There are, however, a few other kinds of software that also like to make use of that space. These are rare, but they do exist.  Some viruses hide code in the first track of the hard disk too.
If you're worried that you might accidentally overwrite some special software you may have in the first track of your hard disk when you install GRUB to MBR, you can make a backup of the entire first track of your hard disk beforehand with a dd command.

Backup,
sudo dd if=/dev/sda skip=1 of=/home/herman/first_62_sda.img bs=512 count=62

Restore,
sudo dd if=home/herman/first_62_sdb.img skip=1 of=/dev/sda bs=512 count=62

Here's a link to a website with more dd commands, Learn the DD command - LinuxQuestions.org


Ontrack Disk Manager
- modifies the MBR and installs Dynamic Drive Overlay in the first track of the hard disk, refer Dynamic Drive Overlay - Wikipedia. Ontrack Disk Manager was popular back in the 1980s and 1990s, for allowing Windows users to be able to extend the life of an older computer and use hard disks over 137 GB even if their BIOS doesn't support that capacity.

Express Media Player - Some Toshiba laptops models were able to play music from a disc in the CD/DVD drive withoutbooting the operating system using Toshiba's "Express Media Player", which ran from code embedded in the first track of the hard disk, and was incompatible with GRUB. Refer, P100-ST9612 "Out-of-the-Box" State.



Saving copies of your MBR and first track for examination

If you are curious and want to check to see what the first track of your hard disk is empty or not, here is a command to copy your MBR and first track to a text file so you can take a look and see for yourself,

Before,
sudo dd if=/dev/sda bs=512 count=63 | hexdump -C > testfile_1

If you want to learn more about what changes are made in your MBR and first track of your hard disk when GRUB is installed, overwrtten or removed, you can easily keep your copy of this file and compare it to another file after changes have been written.

Try making changes to your MBR and first track in some way, either by dd comand or by installing a different boot loader or by using a partition editor, or whatever, and then make another text file copy of them,

After,
sudo dd if=/dev/sda bs=512 count=63 | hexdump -C > testfile_2

Now you can compare the two files to see what has been changed. Meld Diff Viewer is useful for comparing files.
If you can think of your own interesting experiments, you can learn a few things about GRUB and other boot loaders in this way.

Here's a link to a website with more dd commands, Learn the DD command - LinuxQuestions.org



Is the MBR part of the Windows file system (partition)?

If you enter the code 'sudo fdisk -lu' in a terminal, you will see that the first sector of the first partition does not begin until at least sector 63 or even not until sector 1024 or 2048 for modern operating systems.
Code:
herman@amdxz:~$ sudo fdisk -lu

herman@amd64hh:~$ sudo fdisk -lu
[sudo] password for herman:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x000ba675

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    42331274    21165606   83  Linux
/dev/sda2        42331275   209905289    83787007+   5  Extended
/dev/sda3   *   209905290   312576704    51335707+   7  HPFS/NTFS
/dev/sda5        42331338   204266474    80967568+  83  Linux
/dev/sda6       204266538   209905289     2819376   82  Linux swap / Solaris

It doesn't matter whether the first partition on the disk happens to be Linux or Windows, the first track of a hard disk (first 63 sectors), are normally empty except for the MBR and not formatted with any filesystems.
With Windows7 and Vista the number of unused sectors at the start of the hard disk has been increased to 2048.
So you don't need to worry if you have NTFS in Windows in your first partition and you have heard that Linux can't write to it, if that's scaring you from using GRUB.
Neither the MBR or even the whole first track are part of any filesystem, however, in rare cases there could be something in the first track that you may need to consider before installing GRUB to MBR.

What are 'boot sectors'?

This first sector of a partition is known as the 'boot sector'.

A boot sector is not to be confused with an MBR, they are two different things.
A MBR and a boot sector both may contain code for a boot loader, but a boot sector is not a MBR.
'MBR' stands for 'Master Boot Record', there can only be one Master Boot Record per hard disk, but there can be many partitions. There can be as many 'boot sectors' as there are partitions.

There are backup copies of the boot sector in some file systems.

In a FAT32 file system, the backup of the boot sector is in sector 6 of the file system. The FAT32 boot sector can be restored from its backup with Linux commands, see When the bootsector is not the same as its backup - FAT32. We can also use TestDisk for restoring the FAT32 boot sector from it's backup, Advanced FAT Repair - CGSecurity.

An NTFS file system has the backups of it's boot sector in the last sector of the file system. We can restore the boot sector of a partition containing an NTFS file system with TestDisk.
TestDisk is a program you can install in Ubuntu, and TestDisk can easily restore the boot sector in an NTFS partition from the backup, or even rebuild an NTFS boot sector, TestDisk has their own page with illustrations, here is a link, NTFS Boot Sector Recovery.

Windows operating systems has the bootloader's code written there by default,so we can always chainload Windows by its boot sector. (Well, almost always).
Linux operating systems do not necessarily have any boot code in their first sectors, but a boot loader, (or rather the IPL for one), can be installed there by the user, and in my opinion that's a good idea.


Can a bootloader's IPL be installed in a partition?
The following code will install GRUB to the first sector of a Linux partition, when issued from a hard disk installed Ubuntu operating system.
Code:
herman@amdxz:~$ sudo grub-install -f  /dev/sda2
Where 'sda2' is the right partition number for the Linux partition you want GRUB installed on.

Note: this can be done without affecting the MBR or bootloaders on other partitions.
Unless that operating system also owns the bootloader installed to MBR, you would not be able to boot to that partition unless you use another boot manager or a bootloader to chainload it, (point to it).

A partition boot sector is not like a MBR in that it is followed by file system blocks so there is no place to embed GRUB's core.img unless it uses the one in the file system. That is less than optimal, since the file system can be moved, and therefore GRUB would need to be re-installed.

An alternative idea is to install LiLo to the first sector of a Ubuntu partition, rather than Grub, as it can provide you with an auxiliary means of booting my system, in case something goes wrong with my MBR-installed bootloader, GRUB.

The Windows FIXBOOT command writes Windows XP's boot loader code to the Windows boot sector. 




The partition table and partition numbering

                                                                         80 00
01 01 83 1f e0 ff 00 04  00 00 00 04 74 07 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
*                                                                                      
00 00 00 00 00 00 00 00  00 00 00 00 00 00

These are the four entries for my partition table.

The partition table makes more sense to most people when we view it with our partition editor software.
We may also use partition editing software to write changes to our partition table.

3parted
    partition 1                       partition 2                  partition 3                      partition 4

For a while, in times of olde, a disk could only have four partitions. The partition numbers 1,2,3 and 4 are reserved for the partitions which occupy an entry in the Master Boot Record's partition table.


Then, someone managed to discover a way to sub-partition one of these four primary partitions, but only one of the four primary partitions is allowed to be divided up in this way.

The sub-partitioned primary partition is called an 'extended' partition. It can have the number 1,2,3 or 4.

The partitions that are inside it are called 'logical' partitions.
They must be 'contiguous', (in a series). They can be separated by free space, but a primary partition is not allowed to be be placed in between logical partitions. 

4parted
      partition 1                   partition2                     partition 3                     partition 4
                                                                               
                                                                                partition 5
                                                                                partition 6
                                                                                partition 7
                                                                                partition 8
                                                                                partition 9

Because the numbers 1,2,3 and 4 are reserved for the four primary partitions (or three primary and one extended partition), the partition numbering for logical partitions always begins with number 5.
Even if there is only an extended partition and no other primary partitions, the logical partitions can never have a number lower than 5.
Logical partition numbering begins at five and counts upwards from there.
On an IDE disk, we can make as many as 63 logical partitions inside an extended partition. 

Each partition we add is given the next available partition number in the order that the partition are created in. They don't have to be numbered in disk order.
In other words, I could make partition number 1 first, and place it anywhere on my disk (furthest to the right for example).
The next partition I make will be given the number 2, and it can be anywhere, the next, number 3 can be anywhere, and number 4 can be located wherever there is space left over.

If I were to delete partition number 1, the number 1 would then be the lowest available partition number.

That means time I make a new primary partition, it will be given the number 1, because the number 1 is vacant, and it is the first available number.







Managing My Partitions with GParted

GParted Web Forums:
http://sourceforge.net/forum/forum.php?forum_id=396063

GParted General Documentation "LarryT's Docs":

 
http://gparted.sourceforge.net/larry/generalities/gparted.htm

How to resize partition, step by step

The livecd-howto
   
1gparted
fig 1 partioning
Most of us brought our computers home from the store with Windows already installed on one big primary partition like this, with Windows taking up the whole hard disk.
Most Windows users would call this their 'C' drive.  
It is also partition number 1.
In Linux it is designated /dev/hda1, or hda1 for short.
In Grub terms this is hard drive 0, partition 0, or (hd0,0).

2parted
partition 1partition 2 partition3
partition5

                                                                                                                                                                                                                           

Now I have installed Ubuntu. The default Ubuntu install makes a new primary partition which is assigned the next available partition number for primary partitions, which is number 2, or /dev/hda2.
In Grub's numbering scheme this will be (hd0,1).

The swap area (red), is inside another partition. The partition that the swap area is in is called an 'extended' partition. An extended partition is a special type of primary partition and it will be given the next available partition number for primary partitions which in this example will be number 3.

The swap area will be partition number 5.

Why did we skip the number 4?
Because the number 4 is reserved for primary partitions and we have not yet made four of those. Logical partitions always begin counting from 5.

Why is all this partition number stuff so important?
It isn't very important to most computer users until they decide to start playing around with their partitions.
If you don't know what you are doing, it would be easy to cause yourself a quite a lot of trouble by telling your disk partitioning software to perform operations that will change the number of one or more of your partitions.
Changing the partition number of an operating system may make some older operating systems unbootable.

Many new users will not know what to do and might even get impatient and frustrated and feel like formatting their entire disk and starting again.














   
A Birds's eye view of Windows XP

The boot.ini file in Windows XP is the file that controls the next part of the process for booting Windows. I will show you how find it and have a look at it from Ubuntu. You will need to have Ubuntu installed in your computer to do this, or you can use the Live CD and mount your Windows partition manually.

fig4mbr
                 fig 4 mbr

Open your hda1 partition  with this icon (above illustration) to see boot.ini and other files that are associated with booting Windows. 


fig 5 mbr
fig 5 mbr                  
Here's a view of what my Windows system looks like looking down on it.
 
I opened my boot .ini  with our text editor, 'gedit', too see what's inside. (below)
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect /NoExecute=OptIn
This is what the boot.ini file looks like.

fig 6 mbr
NTLDR, boot.ini, and ntdetect.com are the three most vital files needed for booting Windows XP.

If your partition number for the Windows partition ever happened to be accidentally changed, by messing around with disk partitioning software, for example, Windows won't boot. It just needs boot.ini to be edited with the new partition number to fix the problem. But, -- when Windows won't boot, you can't edit boot.ini, and you can't edit boot.ini to boot it, so you would be stuck...        Unless...

The best solution to the problem of finding your Windows unbootable after using disk partitioning software is to make your own Windows XP boot floppy disk.
A Windows XP boot floppy disk contains three vital files, boot.ini, ntdetect and NTLDR.
That would even get you out of trouble if you had Windows on NTFS, which is still considered dangerous to write to from Linux. However, you can edit the boot.ini on the floppy disk any time you like, and as often as you like, without hurting anything.  
How to create your own boot disk for Windows XP

As far as I know, the floppy disk must first be formatted in Windows, exactly the way the instructions say, so you might need to use another Windows XP computer.
I have not yet tried to make a CD like that, but it might also work, I don't know.

If your computer has no floppy disk drive, and you are lucky enough to have the FAT32 filesystem in Windows XP, and you are planning ahead, you can relax the file permissions for boot.ini, so that you can edit it from Linux.

To relax the security attributes for the boot.ini file, boot Windows XP,
1) Click Start
2) Click 'Run'
3) Type CMD in the 'Run' box,  
 Open:       CMD                            
4) Click the 'OK' button

Next. you can expect to see a black terminal with prompt like illustrated below:
Microsoft Windows XP [Version 5.1.2600]
<C> Copywrite 1985-2001 Microsoft Corp.

C:\Documents and settings\Herman >_
C:\Documents and Settings\Herman >_

5) type cd\ after this prompt.

C:\Documents and settings\Herman >cd\

C:\>_
C:\_                                           (New prompt looks like this)


C:\> attrib -s -h -r boot.ini
6) Type the above command,     C:\>attrib -s -h -r boot.ini     and press 'Enter'.

Then you can make changes to your partitions a little more safely, knowing that if you do accidentally have your Windows partition number changed, at least you can edit boot.ini from Linux and still boot it again.

7)
C:\>exit


8) To re-assert the security attributes for the file after you finish your partitioning work,
C:\>attrib +s +h +r boot.ini
Type the following command,     C:\>attrib +s +h +r boot.ini        and press 'Enter'.

C:\>exit
C:\>exit






 Installing a Boot Loader for Ubuntu (when installing with the 'Alternate' CD).

GRUB      the GRand Unified Bootloader

 
[!] Install the GRUB boot loader on a hard disk

The following other operating systems have been detected on this computer: Microsoft Windows XP Home Edition.

If all of your operating systems are listed above, then it should be safe to install the boot loader to the master boot record of your first hard drive. When your computer boots, you will be able to choose to load one of these operating systems or your new system.

Install the GRUB boot loader to the master boot record?
<Go Back>                                    <Yes>      <No>
                 fig 7 mbr
If you choose <Yes> ( to Install GRUB's IPL to MBR)
The wording on the panel illustrated above, is brief and practical. There isn't time or room for a page as big as this one to explain exactly what happens. 

All of GRUB doesn't really get installed on your 512 byte MBR, that's just a kind of an abreviated way of saying things to avoid taking the time to explain what really happens.

All bootloaders come in two or three stages.  The reason for this is because the space allowed in the MBR is so small, less than 446 bytes are allowed for the bootloader's code. No bootloader could possibly fit in such a tiny space. Instead, only the 'stage1' or 'IPL' (Initial Program Loader), which is the first part of any bootloader goes there. The job of the bootloader's 'IPL' or 'stage1' is to either point to the bootloader files in the operating system's partition or else point to the first sector of the partition, which in turn points to the bootloader's stage2 files.

Windows NTLDR works that way too, and so does Lilo.
Those both come in two stages, 'stage1' and 'stage2'.
'Stage1' fits in the MBR, and 'Stage2' lives in the operating system.
Grub comes in three stages. First, 'stage1' is the bit that fits inside the MBR, 'stage1_5' (optional) is written to the next fifteen sectors of the unused first track of the hard disk, and 'stage2' (the important part) is installed in a partition.
Normally, this will be the operating system's partition, (Ubuntu)  but it can be installed in a dedicated /boot partition if one has been made.

So really what this sign is asking is:
"Do you want the first 446 bytes of grub (stage1) written to the MBR ?"
'stage 1' will be copied to the master boot record if you choose 'Yes'.
This will overwrite the 'IPL' code for the bootloader you had installed before.

stage1_5 of GRUB, will also be written to the next 15 sectors following the MBR. The advantage of grub's stage1_5 is that it 'understands' many filesystems, and Grub can perform quite a number of useful tricks because of that. The first track of the hard disk is not formatted with any filesystem and so does not belong to any partition or operating system. It is normally empty and is left vacant for this sort of use.
In rare instances there can be other types of special programs installed there. There shouldn't be, but you should remember if you have installed any. You should have been notified if someone else installed something there, as it is unusual. Some older BIOSes disks needed 'disk manager' software to see larger hard disks than they were designed for, but those would be rare nowadays.
Some models of Toshiba Satellite Notebooks that have the Express Media Player are known to have difficulties with GRUB. LiLo is recommended for those instead.

stage2, the second stage boot loader is the part that does the real work. The second stage of a boot loader brings up our new grub menu (below) and later does the real work of loading an operating system's kernel.  




 Ubuntu, kernel 2.6.20-15-generic                        
 Ubuntu, kernel 2.6.20-15-generic (recovery mode)
 Ubuntu, memtest86+
 Other operating systems:
 Microsoft Windows XP Home Edition







    Use the | and | keys to select which entry is highlighted.
    Press enter to boot the selected OS, or 'e' to edit the
    commands before booting, or 'c' for a command-line.


     The highlighted entry will be booted in 10 seconds.


             fig 8 mbr
The user gets a chance to decide what operating system to load, Windows or Ubuntu, and any others when the GRUB menu shows on boot-up.  
If the user selects Windows, or a Linux system that doesn't have Grub (LiLo maybe), then GRUB's second stage, in /boot/grub , on the Ubuntu partition, points to the other operating system's partition's first sector and chainloads it. The term chainloading means it passes control to the other system's bootloader. If it's NTLDR, then NTLDR in turn loads Windows. 
If the user selects Ubuntu, or another Gnu/Linux operating system with Grub, then GRUB loads the kernel for it into the computer's memory and boots the computer with that operating system.

 
If you choose <No> ( to Install GRUB's IPL to a custom location)

[!] Install the GRUB boot loader on a hard disk

The following other operating systems have been detected on this computer: Microsoft Windows XP Home Edition.

If all of your operating systems are listed above, then it should be safe to install the boot loader to the master boot record of your first hard drive. When your computer boots, you will be able to choose to load one of these operating systems or your new system.

Install the GRUB boot loader to the master boot record?
<Go Back>                                 <Yes>      <No> 

                 fig 9 mbr
Choosing 'No' doesn't mean GRUB will not be installed, it just means you don't necessarily want to install GRUB's IPL to MBR and GRUB's stage1_5 in the next fifteen sectors. Maybe you want to install GRUB's IPL somewhere else?

[!!] Install the GRUB bootloader on a hard disk

You need to make the newly installed system bootable, by installing the GRUB boot loader on a bootable device. The usual way to do this is to install GRUB to the master boot record of your first hard drive. If you prefer, you can install GRUB elsewhere on the drive, or to another drive, or even to a floppy.

The device can be specified using GRUB's "(hdn,m)" notation, or as a device in /dev. Below are some examples:
- "(hd0)" or "/dev/hda" will install GRUB to the master boot record of your first hard drive (IDE);
- "(hd0,1)" or "/dev/hda2" will use the second partition of your first IDE drive;
-"(hd2,4)" or "/dev/hdc5" will use the first extended partition of your third drive (SCSI here);
-"(fd0)" or "/dev/fd0" will install GRUB to a floppy.

Device for boot loader installation

 (fd0)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 
<Go Back>                                              <Continue>
       fig 10 mbr
This panel comes next, you can type in a custom location on the dotted line to specify where exactly you do want GRUB to be installed.
                                           NOTE: Without the inverted commas!                                               
If you want GRUB's IPL installed to your second hard disk's MBR instead of your first one, type (hd1) or /dev/hdb here. Some computers have a BIOS that allows the user to easily choose which hard disk to boot. Mine does, click hard disk boot priority to see what I mean. Then you can either enter your BIOS to set which MBR to boot or use another system's GRUB to chainload your second hard disk's MBR.

If you want GRUB's IPL installed to the first sector of your Ubuntu partition, type (hd0,1) or /dev/hda2 here (where hd0,1 or /dev/hda2 is the correct designation for your Ubuntu partition.
That means you will have to chainload GRUB from another bootloader or boot manager like GAG Boot Manager in MBR or from a floppy disk or a CD.

We can install GRUB to floppy disk by typing (fd0) on the line. Grub works very well from floppy disks. You should make extra copies of the floppy disk in case the floppy gets corrupted somehow (like you spill coffee on it or your dog chews it up or something like that). Here is a link to a great website about 'dd' commands in Linux, it explains how to replicate floppy disks, and much more besides, http://www.linuxquestions.org/questions/showthread.php?t=362506
Or, if you are not comfortable with Linux commands yet, you can use the 'Alternate' install CD in 'rescue mode'

If you use 'Tab' to select <Continue>, you'll probably get a red warning screen.
You can choose <Go Back> if you want. That will bring you back to the panel show in fig 11 below again.


If you choose <Go Back> ( to Install LILO Boot Loader)

[!] Install the GRUB boot loader on a hard disk

The following other operating systems have been detected on this computer: Microsoft Windows XP Home Edition.

If all of your operating systems are listed above, then it should be safe to install the boot loader to the master boot record of your first hard drive. When your computer boots, you will be able to choose to load one of these operating systems or your new system.

Install the GRUB boot loader to the master boot record?
 <Go Back>                                 <Yes>      <No> 
            fig 11 mbr
 
[?] Ubuntu installer main menu

Choose the next step in the install process:

Choose language
Configure the keyboard
Detect and mount CD-ROM
Load debconf preconfiguration file
Load installer components from CD
Detect network hardware
Configure the network
Configure the clock
Detect disks
Partition disks
Install the base system
Set up users and passwords
Configure the package manager
Select and install software
Install the GRUB boot loader on a hard disk
Install the LILO boot loader on a hard disk          
Continue without a boot loader
Finish the installation
Change debconf priority
Check the CD-ROM(s) integrity
Save debug logs
Execute a shell
Eject a CD from the drive
Abort the installation
fig 12 mbr
This is the Ubuntu Installer Main Menu that I keep referring to.
If you want to install LILO boot loader, you just select that line and press 'enter', (of course, what else?).

Well there is the line titled 'Continue without a boot loader'.
I wouldn't recommend that one, I don't know why anyone would want to do that.  Well you could, but you would need to boot it with Super Grub Disk.
Or you would have to have Grub already installed in another operating system and know how to use GRUB from the Command Line to boot your new Ubuntu installation.
Then you would manually edit the /boot/grub/menu.lst in the other Linux operating system with an entry for Ubuntu.  Operating System Entries for Multiple Booting More Linux Systems.

In this example I have shown 'Install the Lilo boot loader on a hard disk', and below is the resulting panel from that selection.

[!] Install the LILO boot loader on a hard disk

The LILO program needs to be installed to make your new system bootable. By installing it onto your disk's Master Boot Record, LILO will take complete control of the boot process, but if you want to use a different boot manager, just install LILO on the new Ubuntu partition instead.

If unsure, install LILO into the Master Boot Record.

LILO installation target;

          /dev/sda: Master Boot Record
          /dev/sda2: new Ubuntu partition    
          Other choice (Advanced)

  <Go Back>                                             


                fig 13 mbr
This panel gives three options, as you can see.

LiLo is the polite Linux boot loader, it only writes to the MBR, and not to any other sectors in the first track of the hard disk.

LiLo makes a backup of your MBR before it installs there. The MBR backup will be called boot.####, (where # (hash symbols) represent a four digit number), and it will be stored in your /boot directory.

If you install LiLo to MBR, your OS should boot right up with LiLo directly off the MBR.

I have shown highlighted the one I want to use this time, '/dev/hda2: new Ubuntu partition.' This means the IPL for LILO will be installed in my first sector (boot block) of my new Ubuntu partition.
Since I'm not installing to MBR, I will need  some other boot loader or a boot manager to boot Lilo with, and Lilo will boot Ubuntu.
This other boot loader can be one with an IPL in the MBR already, that can be configured to boot Lilo and Ubuntu.
GAG Boot Manager is one I use, GAG can boot Lilo and Ubuntu from a GAG floppy disk, or from a GAG CD-ROM. More info on how to use GAG Boot Manager: GAG Page.
This option will not touch your MBR.
Or you can use a Super Grub Disk.


fig 14 mbr
                 fig 14 mbr
This is an illustration of the panel you'll see if you select 'Other choice (Advanced)' from the panel shown in fig13, above.
This allows a user to select a custom location to install LILO to, such as (fd0) perhaps. (Floppy disk). Or some other more exotic location.

For more about LiLo, please feel free to go to the LiLo Page of this web site.

============================================================







Links    

The Boot Process: http://www.linux-tutorial.info/modules.php?name=Tutorial&pageid=64
    
Here's a link to the Wikipedia page on boot loaders: http://en.wikipedia.org/wiki/Boot_sequence
    
Here's an excellent website which explains a lot about how Linux boot loaders (LILO and GRUB) work: 
http://www-128.ibm.com/developerworks/library/l-bootload.html?ca=dgr-lnxw01LILOandGRUB
    
And here's another good one:     http://www.syrlug.org/contrib/boot-loaders.html


barrier_board




Back to Top
    
Windows XP Boot Sector
sudo dd if=/dev/sdb bs=512 skip=63 count=1  | hexdump -C

1+0 records in
1+0 records out
512 bytes (512 B) copied00000000  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|
00000010  00 00 00 00 00 f8 00 00  3f 00 ff 00 3f 00 00 00  |........?...?...|
, 0.00705912 s, 72.5 kB/s
00000020  00 00 00 00 80 00 80 00  f8 f7 7d 00 00 00 00 00  |..........}.....|
00000030  00 00 0c 00 00 00 00 00  ff ba 0a 00 00 00 00 00  |................|
00000040  f6 00 00 00 01 00 00 00  45 71 ad f4 92 ad f4 5a  |........Eq.....Z|
00000050  00 00 00 00 fa 33 c0 8e  d0 bc 00 7c fb b8 c0 07  |.....3.....|....|
00000060  8e d8 e8 16 00 b8 00 0d  8e c0 33 db c6 06 0e 00  |..........3.....|
00000070  10 e8 53 00 68 00 0d 68  6a 02 cb 8a 16 24 00 b4  |..S.h..hj....$..|
00000080  08 cd 13 73 05 b9 ff ff  8a f1 66 0f b6 c6 40 66  |...s......f...@f|
00000090  0f b6 d1 80 e2 3f f7 e2  86 cd c0 ed 06 41 66 0f  |.....?.......Af.|
000000a0  b7 c9 66 f7 e1 66 a3 20  00 c3 b4 41 bb aa 55 8a  |..f..f. ...A..U.|
000000b0  16 24 00 cd 13 72 0f 81  fb 55 aa 75 09 f6 c1 01  |.$...r...U.u....|
000000c0  74 04 fe 06 14 00 c3 66  60 1e 06 66 a1 10 00 66  |t......f`..f...f|
000000d0  03 06 1c 00 66 3b 06 20  00 0f 82 3a 00 1e 66 6a  |....f;. ...:..fj|
000000e0  00 66 50 06 53 66 68 10  00 01 00 80 3e 14 00 00  |.fP.Sfh.....>...|
000000f0  0f 85 0c 00 e8 b3 ff 80  3e 14 00 00 0f 84 61 00  |........>.....a.|
00000100  b4 42 8a 16 24 00 16 1f  8b f4 cd 13 66 58 5b 07  |.B..$.......fX[.|
00000110  66 58 66 58 1f eb 2d 66  33 d2 66 0f b7 0e 18 00  |fXfX..-f3.f.....|
00000120  66 f7 f1 fe c2 8a ca 66  8b d0 66 c1 ea 10 f7 36  |f......f..f....6|
00000130  1a 00 86 d6 8a 16 24 00  8a e8 c0 e4 06 0a cc b8  |......$.........|
00000140  01 02 cd 13 0f 82 19 00  8c c0 05 20 00 8e c0 66  |........... ...f|
00000150  ff 06 10 00 ff 0e 0e 00  0f 85 6f ff 07 1f 66 61  |..........o...fa|
00000160  c3 a0 f8 01 e8 09 00 a0  fb 01 e8 03 00 fb eb fe  |................|
00000170  b4 01 8b f0 ac 3c 00 74  09 b4 0e bb 07 00 cd 10  |.....<.t........|
00000180  eb f2 c3 0d 0a 41 20 64  69 73 6b 20 72 65 61 64  |.....A disk read|
00000190  20 65 72 72 6f 72 20 6f  63 63 75 72 72 65 64 00  | error occurred.|
000001a0  0d 0a 4e 54 4c 44 52 20  69 73 20 6d 69 73 73 69  |..NTLDR is missi|
000001b0  6e 67 00 0d 0a 4e 54 4c  44 52 20 69 73 20 63 6f  |ng...NTLDR is co|
000001c0  6d 70 72 65 73 73 65 64  00 0d 0a 50 72 65 73 73  |mpressed...Press|
000001d0  20 43 74 72 6c 2b 41 6c  74 2b 44 65 6c 20 74 6f  | Ctrl+Alt+Del to|
000001e0  20 72 65 73 74 61 72 74  0d 0a 00 00 00 00 00 00  | restart........|
000001f0  00 00 00 00 00 00 00 00  83 a0 b3 c9 00 00 55 aa  |..............U.|



 The end of core.img
sudo dd if=/dev/sdb bs=512 skip=49 count=1  | hexdump -C

1+0 records in
1+0 records out
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
512 bytes (512 B) copied00000200
, 0.00963609 s, 53.1 kB/s