Monday, August 11, 2008

bootlace.com produces Error: Invalid partition table. Must specify --floppy explicitly for floppy.

I wrote a script to drive parted to prepare an USB disk bootable. When my script tried to install grub4dos with bootlace.com, it produced this error message:
Error: Invalid partition table. Must specify --floppy explicitly for floppy.

BOOTLACE writes GRLDR BOOT RECORD to MBR or to the boot area of a file system.
Usage: bootlace.com [OPTIONS] DEVICE_OR_FILE
Options: --read-only, --floppy[=N], --boot-prevmbr-first, --boot-prevmbr-last,
--no-backup-mbr, --force-backup-mbr, --mbr-enable-floppy, --mbr-disable-floppy,
--mbr-enable-osbr, --mbr-disable-osbr, --duce, --time-out=T, --hot-key=K,
--preferred-drive=D, --preferred-partition=P, --sectors-per-track=S, --heads=H,
--start-sector=B, --total-sectors=C, --install-partition=I, --lba, --chs,
--fat12, --fat16, --fat32, --vfat, --ntfs, --ext2
DEVICE_OR_FILE: Filename of the device or image. For DOS, a BIOS drive number
(in hex 0xHH or decimal DDD format)can be used to access the drive.
I was wondering what was wrong and it took me several hours in finding the answer on google. However I could not find an answer to this problem.

Then I deleted the partition which was created by my script and created the partition again with gparted. Viola! sudo ./bootlace.com /dev/sdb returned a success message to me. I noted down the start and end sectors of the working partition and compared them with the one which was created by my script. I found the start secter is 63 on the working partition while the bad one which was created by my script is 1. This is the culprit that my script assigned the first track to a primary partition and it is the reason why bootlace complained about it. MBR is always on the first track, and there are 64 sectors per track. I have learned it in a Computer Architechture lesson in University several years ago. I should have recalled it earlier.

The solution: sudo parted --script /dev/sdb mkpart primary ntfs 63s #{size}
The above line is the modified command in my script. The start sector has been modified from 0 to 63, and bootlace.com is happy to install grub4dos for me now.

No comments: