Problems reading the partition table from a GRUB floppy

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
thestew42
Member
Member
Posts: 38
Joined: Thu Jun 19, 2008 6:20 pm
Location: San Diego, CA

Problems reading the partition table from a GRUB floppy

Post by thestew42 »

I've been using a GRUB floppy image from James Molloy's site http://www.jamesmolloy.co.uk/downloads/floppy.img. I'm working on writing code to identify disks and partitions. I noticed that this floppy had an empty BPB in its boot sector so I'm assuming that this is an MBR and there should be a partition table (can I assume that all disks have an MBR? How do you determine if not?). The problem is that the partition table seems to be nonsense. The first byte in each entry is supposed to be the active byte, and since this is a GRUB floppy one of the partitions must be active, even so...none of the active bytes on this disk image are 0x80 or 0x00. The active bytes are:

Offset Value
0x1BE 0x24
0x1CE 0xF9
0x1DE 0x70
0x1EE 0xD7

So none of those are valid values for this byte. Additionally, the rest of the partition table (sector, cylinder, head numbers) doesn't seem to contain valid values. I would assume this disk is corrupt, but somehow it still boots and when I mount the image on Linux, there are no problems reading the file system. Also, I don't see how a corrupt disk image could be posted on a tutorial. This site describes how a GRUB MBR should look http://mirror.href.com/thestarman/asm/mbr/GRUB.htm which looks fine to me, but the image I'm using doesn't. What am I missing/doing wrong?

Thanks
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Problems reading the partition table from a GRUB floppy

Post by NickJohnson »

Floppies don't usually have an MBR, because they usually aren't partitioned. You can pretty much assume that all ATA disks have an MBR, but not floppies.
thestew42
Member
Member
Posts: 38
Joined: Thu Jun 19, 2008 6:20 pm
Location: San Diego, CA

Re: Problems reading the partition table from a GRUB floppy

Post by thestew42 »

Yeah that makes sense, but this floppy image has an empty BPB so I thought that it might be partitioned for some reason. So if there's no partition table and no information in the BPB, how am I supposed to determine how to read the file system? Like number of reserved sectors, sectors per cluster, etc.
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: Problems reading the partition table from a GRUB floppy

Post by Tosi »

I would format the floppy with what file system I wanted to use and then install the bootloader. Also I think the floppy from that tutorial might have an older version of GRUB.
thestew42
Member
Member
Posts: 38
Joined: Thu Jun 19, 2008 6:20 pm
Location: San Diego, CA

Re: Problems reading the partition table from a GRUB floppy

Post by thestew42 »

Ok, I just wanted to make sure I'm handling file systems correctly. It seems to me that if Linux has a way to handle this situation, I should be able to handle it as well. I'll just ignore it for now, it must not be very common. Thanks guys.
Post Reply