LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-04-2009, 06:52 AM   #1
kaushalsingh
LQ Newbie
 
Registered: Oct 2009
Posts: 24

Rep: Reputation: 15
how to see master boot record


i don't know much about it is it possible to see the master boot record in linux console
i need the command to view the mbr in console ...
how we can see the master boot record entry in console of linux?
 
Old 12-04-2009, 07:09 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The MBR is defined as the first sector of the drive. (Sector = 512 bytes)

It can be viewed using dd---e.g.:

Code:
dd if=/dev/sda bs=512 count=1 | hexdump -C
 
Old 12-04-2009, 07:16 AM   #3
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by kaushalsingh View Post
i don't know much about it is it possible to see the master boot record in linux console
i need the command to view the mbr in console ...
how we can see the master boot record entry in console of linux?
You can see a hexdump of the MBR by using the following command, as the root user:

Code:
hd -n 512 /dev/sda
(replace /dev/sda with /dev/hda if your system only has this)

You should get an output like:

Code:
00000000  eb 48 90 d0 bc 00 7c fb  50 07 50 1f fc be 1b 7c  |.H....|.P.P....||
00000010  bf 1b 06 50 57 b9 e5 01  f3 a4 cb bd be 07 b1 04  |...PW...........|
00000020  38 6e 00 7c 09 75 13 83  c5 10 e2 f4 cd 18 8b f5  |8n.|.u..........|
00000030  83 c6 10 49 74 19 38 2c  74 f6 a0 b5 07 b4 03 02  |...It.8,t.......|
00000040  ff 00 00 20 01 00 00 00  00 02 fa 90 90 f6 c2 80  |... ............|
00000050  75 02 b2 80 ea 59 7c 00  00 31 c0 8e d8 8e d0 bc  |u....Y|..1......|
00000060  00 20 fb a0 40 7c 3c ff  74 02 88 c2 52 be 7f 7d  |. ..@|<.t...R..}|
00000070  e8 34 01 f6 c2 80 74 54  b4 41 bb aa 55 cd 13 5a  |.4....tT.A..U..Z|
00000080  52 72 49 81 fb 55 aa 75  43 a0 41 7c 84 c0 75 05  |RrI..U.uC.A|..u.|
00000090  83 e1 01 74 37 66 8b 4c  10 be 05 7c c6 44 ff 01  |...t7f.L...|.D..|
000000a0  66 8b 1e 44 7c c7 04 10  00 c7 44 02 01 00 66 89  |f..D|.....D...f.|
000000b0  5c 08 c7 44 06 00 70 66  31 c0 89 44 04 66 89 44  |\..D..pf1..D.f.D|
000000c0  0c b4 42 cd 13 72 05 bb  00 70 eb 7d b4 08 cd 13  |..B..r...p.}....|
000000d0  73 0a f6 c2 80 0f 84 ea  00 e9 8d 00 be 05 7c c6  |s.............|.|
000000e0  44 ff 00 66 31 c0 88 f0  40 66 89 44 04 31 d2 88  |D..f1...@f.D.1..|
000000f0  ca c1 e2 02 88 e8 88 f4  40 89 44 08 31 c0 88 d0  |........@.D.1...|
00000100  c0 e8 02 66 89 04 66 a1  44 7c 66 31 d2 66 f7 34  |...f..f.D|f1.f.4|
00000110  88 54 0a 66 31 d2 66 f7  74 04 88 54 0b 89 44 0c  |.T.f1.f.t..T..D.|
00000120  3b 44 08 7d 3c 8a 54 0d  c0 e2 06 8a 4c 0a fe c1  |;D.}<.T.....L...|
00000130  08 d1 8a 6c 0c 5a 8a 74  0b bb 00 70 8e c3 31 db  |...l.Z.t...p..1.|
00000140  b8 01 02 cd 13 72 2a 8c  c3 8e 06 48 7c 60 1e b9  |.....r*....H|`..|
00000150  00 01 8e db 31 f6 31 ff  fc f3 a5 1f 61 ff 26 42  |....1.1.....a.&B|
00000160  7c be 85 7d e8 40 00 eb  0e be 8a 7d e8 38 00 eb  ||..}.@.....}.8..|
00000170  06 be 94 7d e8 30 00 be  99 7d e8 2a 00 eb fe 47  |...}.0...}.*...G|
00000180  52 55 42 20 00 47 65 6f  6d 00 48 61 72 64 20 44  |RUB .Geom.Hard D|
00000190  69 73 6b 00 52 65 61 64  00 20 45 72 72 6f 72 00  |isk.Read. Error.|
000001a0  bb 01 00 b4 0e cd 10 ac  3c 00 75 f4 c3 00 00 00  |........<.u.....|
000001b0  00 00 00 00 00 00 00 00  00 00 00 e0 00 00 80 01  |................|
000001c0  01 00 83 fe ff ff 3f 00  00 00 39 b1 d4 01 00 fe  |......?...9.....|
000001d0  ff ff 83 fe ff ff 78 b1  d4 01 d9 20 06 00 00 fe  |......x.... ....|
000001e0  ff ff 83 fe ff ff c9 83  af 03 66 79 1a 06 00 fe  |..........fy....|
000001f0  ff ff 05 fe ff ff 2f fd  c9 09 92 8d d7 08 55 aa  |....../.......U.|
00000200
Notice that the last two bytes are '55' and 'aa' respectively - this will be present as the last two bytes of the MBR for all little-endian systems, like x86, while it will be reversed ('aa' then '55') for big-endian systems. If you don't see this, you aren't looking at the master boot record.

John G
 
Old 12-04-2009, 07:17 AM   #4
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Quote:
i don't know much about it is it possible to see the master boot record in linux console
Almost all disk manipulating commands are capable of reading the mbr.

Quote:
i need the command to view the mbr in console ...
how we can see the master boot record entry in console of linux?
In the console, here is what you need do if you wanted to:

a) First we obtain a copy of the MBR; remembering that this table is the first 512 bytes of the disk, this we do: (be sure you are root):

root@host--# dd if=/dev/sda of=/root/mymbr bs=512 count=1 <Enter>

b) To read what is there you only read the 'mymbr' file in the root directory do this while as root:

root@host--# file /root/mymbr <Enter> (Do not use 'cat', just 'file')

See. You can read how partitions are accorded with their starthead sectors throughout the hardisk. This is the table that boot loader reads from in locating the partitions.

Hope this helps.

Good luck.

Last edited by malekmustaq; 12-04-2009 at 07:24 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
master boot record goldeneagle1234 Linux - Newbie 2 11-09-2008 08:58 AM
Master Boot Record hvywght Linux - Newbie 14 04-20-2008 07:30 PM
master boot record help sfr7 Linux - Laptop and Netbook 10 04-25-2004 08:52 AM
Master Boot Record linuxuser05 Linux - General 3 01-11-2004 06:57 PM
master boot record alaios Linux - General 1 04-22-2003 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration