LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch
User Name
Password
Arch This Forum is for the discussion of Arch Linux.

Notices


Reply
  Search this Thread
Old 04-14-2018, 01:55 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
How do I figure out if I have an MBR partition type?


Hi: I made
Code:
# dd if=/dev/mmcblk0p1 of=pepe bs=512 count=1
where mmcblk0p1 is the linux partition (only one), and look at this:
Code:
[root@revenge ~]# hexdump -C pepe
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200
Does it mean I have a GPT partition type. At disk offset 0 I expected to find the MBR. Acording to parted I have a msdos partition table.

Last edited by stf92; 04-14-2018 at 02:06 PM.
 
Old 04-14-2018, 02:13 PM   #2
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Most likely. If i run that on my system (i'm using LILO/dos partition for MBR) i get this;

Code:
00000000  fa eb 21 01 b4 01 4c 49  4c 4f 18 02 b4 44 d2 5a  |..!...LILO...D.Z|
00000010  00 00 00 00 fc f3 a4 50  2a 46 04 00 81 00 80 60  |.......P*F.....`|
00000020  d7 3e f4 2f b8 c0 07 8e  d0 bc 00 08 fb 52 53 06  |.>./.........RS.|
...
...
etc
I believe you can use fdisk to check:
Code:
$ sudo fdisk -l /dev/sda | grep Disklabel
If it's a GPT partition type, you should see
Code:
Disklabel type: gpt
or dos/MBR will be:
Code:
Disklabel type: dos
 
Old 04-14-2018, 05:23 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
The MBR signature is the last two bytes. 0x55AA.
 
Old 04-14-2018, 05:32 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,777

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by michaelk View Post
The MBR signature is the last two bytes. 0x55AA.
But a GPT disk will also typically have a "protective" MBR to keep the disk from appearing empty to non-GPT-aware tools. That protective MBR will also have the magic "0x55 0xAA" in the last two bytes.

If you just run gdisk on the drive, it will immediately tell you what type of partition tables it finds there.
 
Old 04-14-2018, 05:50 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Parted definitely says it's a dos partition table. But how then is the first sector filled with zeroes?
 
Old 04-14-2018, 07:38 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,777

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by stf92 View Post
Parted definitely says it's a dos partition table. But how then is the first sector filled with zeroes?
Only the last 66 bytes contain the partition table and signature. The first 446 bytes can be anything, and are needed only for a primary boot loader.
 
Old 04-14-2018, 07:50 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Quote:
Originally Posted by rknichols View Post
But a GPT disk will also typically have a "protective" MBR to keep the disk from appearing empty to non-GPT-aware tools. That protective MBR will also have the magic "0x55 0xAA" in the last two bytes.

If you just run gdisk on the drive, it will immediately tell you what type of partition tables it finds there.
Your correct. It is the EE partition in the protective MBR that identifies it as a GPT I believe.
 
Old 04-15-2018, 10:58 AM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by rknichols View Post
Only the last 66 bytes contain the partition table and signature. The first 446 bytes can be anything, and are needed only for a primary boot loader.
Allright. But there is nothing at all (all zeroes) in the full 512 bytes!
 
Old 04-15-2018, 11:49 AM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,777

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by stf92 View Post
Allright. But there is nothing at all (all zeroes) in the full 512 bytes!
Then there is no DOS/MBR partition table present, regardless of what any tool might claim.
 
Old 04-15-2018, 12:06 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Doh... I was tired and couldn't see the forest for the trees and you even posted partition 1.

/dev/mmcblk0p1 is partition 1 and the first 512 should be empty.

/dev/mmcblk0 is the entire device where the MBR lives.

Try
Code:
dd if=/dev/mmcblk0 of=mbr.img bs=512 count=1
 
1 members found this post helpful.
Old 04-15-2018, 12:40 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,777

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
And, I overlooked that too. You don't typically expect to find a partition table within a primary partition.
 
Old 04-15-2018, 03:55 PM   #12
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by michaelk View Post
Doh... I was tired and couldn't see the forest for the trees and you even posted partition 1.

/dev/mmcblk0p1 is partition 1 and the first 512 should be empty.

/dev/mmcblk0 is the entire device where the MBR lives.

Try
Code:
dd if=/dev/mmcblk0 of=mbr.img bs=512 count=1
My mistake. Now I get my two partitions into the partition table. By the way:
Code:
00000180  47 52 55 42 20 00 47 65  6f 6d 00 48 61 72 64 20  |GRUB .Geom.Hard |
00000190  44 69 73 6b 00 52 65 61  64 00 20 45 72 72 6f 72  |Disk.Read. Error|
0000
Does this mean Grub made the MBR?
 
Old 04-15-2018, 04:08 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Yes, whatever tool used to partition the drive created the partition table and grub installed the boot loader.
 
  


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
Recover Partition which was type:fuseblk and mistakenly formatted to type vfat thilinakasun Linux - General 4 07-13-2013 01:03 PM
Error in MIME type-- can't display SVG figure mzh Linux - Server 3 01-12-2012 08:59 AM
[SOLVED] I cant figure out what this symbol is and how to type it (') Adol Linux - Newbie 6 02-25-2011 12:50 AM
mandriva dual boot filesystem type unknown,partition type 0x7 llearner Linux - Newbie 2 01-24-2010 02:03 PM
Dual Boot Vista Suse 10.2 error setting type of partition to type 82 jmp559 Linux - General 1 05-15-2008 06:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch

All times are GMT -5. The time now is 01:52 AM.

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