Grub4dos batch file allows booting Linux from beyond 15th partition
Greetings, all. I am a Windows XP refugee who has been trying out numerous Linux distributions over the last couple years or so in search of a potential Windows replacement. I really don't see enough compelling new features from Microsoft to convince me to upgrade to newer Windows versions with their accompanying DRM bloat and, now, baked-in spyware.
To get the best feel for performance, I prefer to install an OS on actual hardware rather than in a VM. With hard drive partitions being occasionally created, deleted, and shuffled around, the most robust method of installing Linux that I have found is to take a live Linux CD image that boots with isolinux, use isohybrid --partok (part of syslinux) to add a partition-bootable boot sector to it, then dd the image to an equivalent-sized HD partition. An additional partition can be used for persistence, and of course every linux distro can use the same swap partition. I've been calling this my "IsoFrugal" installation method, although that may not be the proper term for it.
Grub4dos has been my favorite boot manager for some time now, and has no problem recognizing these "ISO-9660-formatted" partitions (although grub4dos calls them "iso9600", which I'm guessing is a typo). The live Linux CDs' isolinux boot configs are easily translatable into grub4dos menu entries, or you can simply chainload into the image partitions for "fresh as new" bootups, then use cat /proc/cmdline to see how you got there.
Unfortunately, as my hard drive began to fill with new partitions, I soon reached a point where newer live Linux HD installs would fail to boot. Some research revealed that many Linux distros cannot boot from beyond the 15th partition on a hard drive because current Linux disk drivers are based upon the old SCSI standard, which does possess a 15 partition limit even though SATA does not.
Some poking around in gparted showed that a partition's "bootability" depends on its order in the extended partition table chain, not its physical location on the hard drive, so I thought it should be possible to make any partition bootable (i.e. at or below partition 15) by reordering the links in the extended partition chain without actually messing with the partitions themselves. So... I've spent the last couple months learning the nuances of grub4dos batch file programming and came up with one possible solution.
I only wrote this batch file because I needed to solve a problem for myself, but I thought that maybe other people might find it useful as well. You decide. The Help portion of the file is posted here so that you can get an idea of how this thing works. If there's any interest, I'll post the whole enchilada. If nothing else, it might be useful as a grub4dos batch file tutorial.
!BAT goto :start :about echo pareo.g4b - PARtition REOrder grub4dos batch file echo -e \ Allows booting Linux from beyond the 15th partition on a drive. echo 2015-09-03 v1.0 Original release by Mythenadia. echo exit :help echo The Problem: Some Linux kernels cannot boot|automount|see beyond a drive's echo 15th partition even though modern SATA/USB drives possess no such legacy SCSI echo drive limitation. echo echo The Workaround: Perform an on-the-fly reordering of logical partitions in a echo grub4dos boot menu to ensure that all partitions needed for booting a linux echo installation fall within this partition 15 boundary. echo echo Pareo works by rearranging the links between Extended Boot Records (EBRs) to echo change the apparent order of logical partitions. Pareo does not touch the echo partitions themselves or the EBR links to them. echo echo Syntax - as used from a grub4dos boot menu or command line: echo echo -e \ pareo.g4b (Drive,Source) Destination [-u|-d] [-v|-t] echo echo -e \ pareo.g4b -a|-h echo echo Options: echo echo -u = Up-only. Move Source partition only if it is < Destination partition. echo -e -d = Down-only. Move Source partition only if it is \> Destination partition. echo -e \ Default is move Source partition regardless of direction. echo echo -v = Verbose mode. Displays lots of extra info. Useful for debugging. echo -t = Test mode. Like verbose, but writes nothing to Drive. echo -e \ Default is Quiet mode. Displays only success or error message. echo echo -a = Display About info. echo -e \-h = Display both About info and Help. echo echo Remember: Grub4dos uses the old grub legacy partition numbering scheme, echo -e \ so sda10 in Linux will be (hd0,9) in grub4dos. echo echo Example 1 - Move sda23 to sda15: echo echo -e \ pareo.g4b (hd0,22) 14 echo echo Example 2 - If the current root partition is above Linux partition 8, echo -e \ move it there verbosely: echo echo -e \ pareo.g4b %^@root% 7 -d -v echo echo Example 3 - See what changes would be made to your drive if you were to move echo -e \ (hd1,34) to (hd1,13) without actually doing so: echo echo -e \ pareo.g4b (hd1,34) 13 -t echo echo When moving a partition down (Destination partition < Source partition), all echo partitions from Destination thru Source-1 will be moved up by one. Likewise, echo -e when moving a partition up (Destination partition \> Source partition), all echo partitions from Source+1 thru Destination will be moved down by one. echo echo Limitations: echo echo Both Source and Destination must be >= 5. echo Moving grub4dos partition 4 - the first logical partition - is tricky because echo its EBR location is fixed at the physical beginning of the extended partition. echo I deemed it not worth the extra coding effort to include this special case. echo echo Based on rbase=0x300, I'm guessing that pareo can reorder partitions out to echo somewhere in the 224-512 range. This, of course, could be increased by echo setting rbase to, say, 0x19000 along with using separate rbase values for EBR echo sector content and EBR sector address storage buffers. echo exit :start if $%1==$-a call :about && exit if $%1==$-h goto :help exit