Jump to content











Photo
- - - - -

Grub4dos batch file allows booting Linux from beyond 15th partition


  • Please log in to reply
5 replies to this topic

#1 Mythenadia

Mythenadia
  • Members
  • 5 posts
  •  
    United States

Posted 04 September 2015 - 02:40 AM

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



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15071 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 September 2015 - 07:04 AM

Nice :thumbup: , but WHERE is the actual batch? :unsure:

 

 

:duff:

Wonko



#3 Mythenadia

Mythenadia
  • Members
  • 5 posts
  •  
    United States

Posted 04 September 2015 - 10:07 PM

Here's the entire pareo v1.0 grub4dos batch file.

 

http://www11.zippysh...kPC4p/file.html

 

Couldn't figure out how to upload a file attachment here, so I used one of those free file sharing sites.

 

Use the -t option to have it tell you what it would change without actually doing so.

 

You might also want to test it first in a VM just to be safe.

 

 



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15071 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 September 2015 - 07:11 AM

Here's the entire pareo v1.0 grub4dos batch file.
 
http://www11.zippysh...kPC4p/file.html
 
Couldn't figure out how to upload a file attachment here, so I used one of those free file sharing sites.
 
Use the -t option to have it tell you what it would change without actually doing so.
 
You might also want to test it first in a VM just to be safe.

Thanks. :thumbsup:
By default attachments are turned off for new members, you need to have (if I recall correctly) 50 posts or be approved specifically by an Admin.

I am attaching a copy to this post so that hopefully it won't get lost.

:duff:
Wonko

Attached Files



#5 Mythenadia

Mythenadia
  • Members
  • 5 posts
  •  
    United States

Posted 19 September 2015 - 10:01 PM

pareo.g4b updated to version 1.1.

 

2015-09-19 v1.1 Highest RAM sector usage decreased from (md)0x4FF to (md)0x47F to avoid potential conflict with BIOS usage from (md)0x480 to (md)0x4FF.  This reduces the maximum partition number from 510 to 383.  Also added changelog to the file.

 

http://www89.zippysh...aUPNX/file.html



#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15071 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 20 September 2015 - 09:09 AM

Attached  :good:

 

:duff:

Wonko

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users