FAT32 and MBR-Partitioned Disk Questions
Posted: Sun Jul 10, 2016 9:20 am
I have been working on having my FAT32 based bootloader support partitioned disks instead of just the partitionless FAT32 disk image I had been using prior. It proved to be problematic when I had trouble just finding a tool that could automatically create a partitioned disk image and manipulate it as necessary (flag partitions as bootable, manipulate a raw partition image, format a partition, etc.). I settled on guestfish, but I keep having problems with that too.
Their built-in partition formatting options at best let me use mkfs.vfat with FAT16 formatting (at least by looking at the hex editor), when I want to do FAT32. I then decided to run "mkfs.vfat -F 32 -h HIDDENSECTORS" on the raw partition image that I extracted from the disk image. I calculated HIDDENSECTORS by taking the number of sectors I specified for the disk image and subtracting "du -k $(PARTITIONIMG) --block-size=512" from it. However, it keeps overestimating the number of hidden sectors to the point that I have to manually fix it by hex editor.
Also, their part-set-bootable option, which is supposed to mark a partition as bootable, doesn't seem to work as advertised, forcing me to mark my FAT32 boot partition as bootable via hex editor.
I have found short-term solutions to all of these problems for the meantime, but I have two questions. First, is there any reason that you know of that my method of figuring out hidden sectors may overestimate the number of them? Second, does anyone have any suggestions for what tools to use for manipulating MBR disks?
Their built-in partition formatting options at best let me use mkfs.vfat with FAT16 formatting (at least by looking at the hex editor), when I want to do FAT32. I then decided to run "mkfs.vfat -F 32 -h HIDDENSECTORS" on the raw partition image that I extracted from the disk image. I calculated HIDDENSECTORS by taking the number of sectors I specified for the disk image and subtracting "du -k $(PARTITIONIMG) --block-size=512" from it. However, it keeps overestimating the number of hidden sectors to the point that I have to manually fix it by hex editor.
Also, their part-set-bootable option, which is supposed to mark a partition as bootable, doesn't seem to work as advertised, forcing me to mark my FAT32 boot partition as bootable via hex editor.
I have found short-term solutions to all of these problems for the meantime, but I have two questions. First, is there any reason that you know of that my method of figuring out hidden sectors may overestimate the number of them? Second, does anyone have any suggestions for what tools to use for manipulating MBR disks?