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
Problems reading the partition table from a GRUB floppy
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: Problems reading the partition table from a GRUB floppy
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.
Re: Problems reading the partition table from a GRUB floppy
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.
-
- 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
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.
Re: Problems reading the partition table from a GRUB floppy
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.