bugGNU GRUB - Bugs: bug #19410, Unable to Create Logical Partition...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #19410: Unable to Create Logical Partition with "partnew" Command

Submitted by:  Steve Burtchin <sburtchin>
Submitted on:  Sun 25 Mar 2007 09:27:08 AM UTC  
 
Category:  Disk & Partition Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  Steve Burtchin
Open/Closed:  Closed Release:  0.97
Release:  None Reproducibility:  Every Time
Planned Release:  None

Sat 15 Dec 2007 09:47:10 PM UTC, comment #3: 

We've moved to GRUB 2 as a development platform. Please can you check if this bug still applies there, and if it does, reopen it?

Thanks

Robert Millan <robertmh>
Project Administrator
Mon 16 Apr 2007 03:44:41 AM UTC, comment #2: 

Added ChangeLog and attached patches in Unified Diff format for ChangeLog, /stage2/builtins.c and /docs/grub.texi.

ChangeLog is repeated here for reference:

2007-04-11  Steve Burtchin  <sburtchin@woh.rr.com>

        * stage2/builtins.c (eptedit_func): New function based mostly on
        code derived from functions PARTNEW_FUNC and PARTTYPE_FUNC.
        * stage2/builtins.c (builtin_eptedit): New variable.
        * stage2/builtins.c (builtin_table): Added pointer to
        BUILTIN_EPTEDIT
        * docs/grub.texi (eptedit): Added entry to "Commands usable anywhere"
        index, and added node for eptedit.

This function has been exhaustively tested.  I have been using it without ever a problem on my 100GB Maxtor HDD for several months now.  All of the "_Other Potential Uses for "eptedit"_" in my original post are practical with possible exception of the last one (even that can be done with a few caveats -- see following).

As promised, here are the results of my "partitioning a HDD" testing: The attach file LogicalCreationTest.lst was used to test partitioning a disk from scratch.  The test HDD is a Fujitsu 6GB with 833 cylinders.  It was zero filled with Active@Killdisk prior to testing.  I found that eptedit will write information to the 'Current' slot of any EPT as long as the sector signature is present and any valid filesystem type is already there (it only needs the sector signature to create the first logical partition).  eptedit will write information to the 'Next' slot of any EPT as long as the sector signature is present and any valid filesystem type is present in the 'Current' slot.  While testing on my small disk, it was NOT necessary to reset the BIOS information with geometry prior to writing a 'Next' slot (I think this applies only to disks > 1024 cylinders).  In conclusion, eptedit always found the correct sector for writing EPT data.  There are other ways to partition disks, so I don't have any immediate plans to persue this further, but if anyone is interested, it should be very easy to make it work.

Is there anything else I need to do?

What do I have to do to get the "eptedit" function into GRUB 2. Is it stable enough yet that I can test it on my working computer? How do I get involved with GRUB 2 development?

(file #12495, file #12496, file #12497, file #12498)

Steve Burtchin <sburtchin>
Mon 16 Apr 2007 02:25:28 AM UTC, comment #1: 

FOR REFERENCE: Attaching diff files containing patches for both of my changes combined (see also bug #19389: "partnew" Command Writes Unexpected/Errant CHS Values) if anyone wants to look at both together --- because they do compliment eachother.

(file #12492, file #12493, file #12494)

Steve Burtchin <sburtchin>
Sun 25 Mar 2007 09:27:08 AM UTC, original submission:  

First: The problem described in this bug report has been solved (by creating the "eptedit" function) and thoroughly tested by me on my Compaq Deskpro EN. For reference see How To Write Extended Partition Tables from GRUB?.

Second: I would have thought this to be a feature request, but . . . from the GRUB Legacy Patch Submission Policy:

"If your system is technically impossible to be booted only with existing features and your patch addresses that problem, it is a bugfix."

So maybe this is a bugfix - ??? - I'll let someone else decide that.

Third: If GRUB Legacy maintainers want to classify this as a new feature, I will gladly volunteer my time to become a maintainer for the "eptedit" function.

Why I Need to Create Logical Partitions

The attached files "PriMastr.png" and "SecMastr.png" show the partition layouts for the three HDD's used in my flexible multiboot system.  What is obvious is that there are much more than four Primary partitions defined for each of the internal HDD's.  The highlighted Primary partitions are standard.  The others can be swapped for the standard ones to address specific boot situations.  Note also, that this multiboot includes at least two 'non-LBA aware' operating systems, and that the standard Extended partition continues past the 1024th cylinder.  The Extended partition on the second HDD also contains three Logical partitions dedicated as 'scratchpads' for sharing data between all operating systems, so it is essential that these three Logical partitions are visible to all of them.  The only way this is possible without risking the potential for data corruption, is to define a smaller Extended partition for the 'non-LBA aware' operating systems.  I also want to have the DOS5 and Win3.1 partitions contained within the Extended partition, rather than defined as Primary partitions, because this makes it much more convenient for making image backups (as opposed to creating a custom boot configuration to image each OS partition).

How It Will Be Used (Mostly, but see "Other Potential Uses")

The attached file "mbr2std.png" shows what the MPT of the second HDD should look like when booting most of the 'LBA aware' OS's.  In this situation, the file "b15_std.png" shows the EPT that should be found at LBA 7680960.

The attached file "mbr2dos5.png" shows what the MPT of the second HDD should look like when booting MS-DOS 5.0, and the file "mbr2Win3.png" shows what the MPT of the second HDD should look like when booting Windows 3.1.  In these situations, the file "b15_old.png" shows the EPT that should be found at LBA 7680960.  Note that the DOS5 and Windows 3.1 partitions are defined as both Primary and Logical partitions in this configuration.  I could have redefined the start of the Extended partition for these two OS's, but the documentation was made simpler by just hiding the Logical definitions (this seems to have no ill effects).

The most significance differences between these two situations is the size of the Extended partition, and the EPT at LBA 7680960.  The "partnew" command is used to fix the MPT.  The "eptedit" command is used to zero out the second slot of the EPT at LBA 7680960 for booting MS-DOS 5.0 and Windows 3.1, and to put the data back into this EPT for booting the 'LBA aware' OS's.  See the file "MenuItms.txt" for excerpts from my "menu.lst".

You may be wondering why the "geometry" function is called within my "menu.lst" file.  In the process of testing this new function, I discovered another bug: GRUB apparently forgets at least some of the geometry information.  When the "eptedit" function performs validation checks on some of the input parameters, a check against invalid information in memory results in "Error 18".  Issuing the "geometry" command refreshes the geometry information for the disk, and avoids the error.  I could easily avoid the error by not performing input data validation, but I don't like hiding problems.

The Patch

The syntax is like this:

eptedit PART SLOT TYPE BCYL BHEAD BSEC ECYL EHEAD ESEC RSEC TSEC

Most parameters are easily calculated or obtained with freeware utilities.  "SLOT" can be "C" (current) or "N" (next).  "PART" and "TYPE" are as for the "parttype" function.

Most of the new "eptedit" function is based on code borrowed from the "parttype" and "partnew" functions.  See the attached "builtins.c" file.

Other Potential Uses for "eptedit"

  1. "eptedit" can be used to avoid the DOS/Win9x "last logical partition" bug.  These os's must see the last logical partition as FAT/FAT16/FAT32 or data corruption could result.  If you wish to format the last logical partition as something else, then the same solution can be applied such that DOS/Win9x see a shorter extended partition ending in one of these recognized file systems.
  1. If you want to thoroughly hide a Logical partition (rather than just changing the filesystem type), you could use "eptedit" to edit the 'Next' slot of the previous EPT to jump past it.  Then it would appear to be unpartitioned space within the Extended partition.
  1. I have found that some Microsoft operating systems can get confused in certain situations when there are too many Logical partitions.  By jumping over one or more Logical partitions as explained previously, the number can be effectively reduced.  I had to do this with manual disk edits the last time I migrated to new HDD's.  I could have saved a lot of tedious work if I had had "eptedit" at that time.
  1. Many older operating systems cannot see past 128GiB.  Having an Extended partition stradling this limit can lead to filesystem corruption with these older OS's.  "eptedit" could be used for them in the same way that I use it now to prevent DOS5 and Win3.1 from seeing past the 1024th cylinder.
  1. Another situation deals with data recovery.  If the partition tables happen to become corrupted, fixing these errors can be the first and best step to data recovery.  There are tools for doing this, but a much quicker approach would be to add a "Restore All Partition Tables" selection to the GRUB menu.  This is easily scripted in "menu.lst" using a combination of "partnew" and "eptedit" commands.
  1. I have not tested this yet, but I think it should be possible to parition a HDD from a bootable GRUB floppy or CD by using a combination of "partnew" and "eptedit" commands - just by pressing <Enter>!  The required "menu.lst" is very easy to create (see Re: How To Write Extended Partition Tables from GRUB? - sburtchin Feb 1, 2007; 11:51pm).  I will post back my test results.

What Next?

I will agree to maintain the "eptedit" function if that is necessary.

I should write the information for the GRUB Manual.  What file do I edit for that?

Can someone help me get started writing ChangeLog? Is there a template or standard format I have to follow?

What other files do I need to attach to this bug report?

What do I have to do to get the "eptedit" function into GRUB 2.  Is it stable enough yet that I can test it on my working computer?  How do I get involved with GRUB 2 development?

Steve Burtchin <sburtchin>

 

Attached Files
file #12495:  ChangeLog.ee.diff added by sburtchin (1KiB - text/x-diff - Revised patches are in Unified Diff format)
file #12496:  grub.texi.ee.diff added by sburtchin (2KiB - text/x-diff - Revised patches are in Unified Diff format)
file #12497:  builtins.c.ee.diff added by sburtchin (7KiB - text/x-diff - Revised patches are in Unified Diff format)
file #12498:  LogicalCreationTest.lst added by sburtchin (2KiB - text/plain - Revised patches are in Unified Diff format)
file #12492:  ChangeLog.both.diff added by sburtchin (2KiB - text/x-diff - Revised patches are in Unified Diff format)
file #12493:  grub.texi.both.diff added by sburtchin (2KiB - text/x-diff - Revised patches are in Unified Diff format)
file #12494:  builtins.c.both.diff added by sburtchin (8KiB - text/x-diff - Revised patches are in Unified Diff format)
file #12291:  builtins.c added by sburtchin (122KiB - text/plain)
file #12287:  mbr2dos5.png added by sburtchin (4KiB - image/x-png)
file #12288:  mbr2Win3.png added by sburtchin (4KiB - image/x-png)
file #12289:  b15_old.png added by sburtchin (3KiB - image/x-png)
file #12290:  MenuItms.txt added by sburtchin (2KiB - text/plain)
file #12283:  PriMastr.png added by sburtchin (22KiB - image/x-png)
file #12284:  mbr2std.png added by sburtchin (4KiB - image/x-png)
file #12285:  SecMastr.png added by sburtchin (25KiB - image/x-png)
file #12286:  b15_std.png added by sburtchin (3KiB - image/x-png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by robertmh (Posted a comment)
  • -email is unavailable- added by sburtchin (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 18 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-12-15 robertmh Open/ClosedOpen => Closed
    2007-04-16 sburtchin Attached File- => Added ChangeLog.ee.diff, #12495
        Attached File- => Added grub.texi.ee.diff, #12496
        Attached File- => Added builtins.c.ee.diff, #12497
        Attached File- => Added LogicalCreationTest.lst, #12498
    2007-04-16 sburtchin Attached File- => Added ChangeLog.both.diff, #12492
        Attached File- => Added grub.texi.both.diff, #12493
        Attached File- => Added builtins.c.both.diff, #12494
    2007-03-25 sburtchin Attached File- => Added builtins.c, #12291
    2007-03-25 sburtchin Attached File- => Added mbr2dos5.png, #12287
        Attached File- => Added mbr2Win3.png, #12288
        Attached File- => Added b15_old.png, #12289
        Attached File- => Added MenuItms.txt, #12290
    2007-03-25 sburtchin Attached File- => Added PriMastr.png, #12283
        Attached File- => Added mbr2std.png, #12284
        Attached File- => Added SecMastr.png, #12285
        Attached File- => Added b15_std.png, #12286
        Carbon-Copy- => Added adrian15

    Back to the top


    Powered by Savane 3.6