Jump to content











Photo
- - - - -

Using grub4dos to multiboot every version of windows from 1 hdd?


  • Please log in to reply
34 replies to this topic

#1 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 22 January 2018 - 09:41 AM

I'm new to this forum and grub4dos but I'm familiar with the concept and have used other bootloaders in the past.  I just a have a few questions before I set-off down a path and reach a dead end.

 

I'm trying to boot as many versions of Windows as possible from one HDD.  (don't worry I've spent the last 6 months playing around with hardware and I'm aware of the requirements/limitations).  I already have a system that boots DOS/Win98/WinXP/Win7 from 1 HDD.

 

My plan is to boot:

  • DOS (Win3.1)
  • Win95
  • Win98
  • WinME
  • WinNT
  • Win2K
  • WinXP
  • Vista
  • Win7
  • Win8
  • Win10

I don't want any of the OSes to "see" each other so I'll be hiding all other partitions when booting any one.

 

And I have a few questions...

 

  1. Is this feasible using map() and hide() then chainloding the bootloaders?
  2. Can I remap a logical partition to a primary and trick MS-DOS based windows into booting?  Does this also work with later versions of Windows once the protected mode OS takes over?
  3. My plan is to create all the partitions on the HDD already, then hide all but 1, install the OS so it thinks it's at (0,0). Not sure how this will work with logical partitions though.
  4. Is there any kind of graphical front end that can be used with grub4dos?
  5. If I get it all working can I swap grub4dos for BURG  (which can be made to look pretty) or does it not work like that?

Any pointers are welcome, this feels like it's going to be a massive PITA!  :D


Edited by Tmp2k, 22 January 2018 - 09:42 AM.


#2 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 22 January 2018 - 10:49 AM

The answer is Yes to almost all your questions.

 

It makes little sense (to me) to have "separated" multi-boot systems, but if you are happy with it, then by all means go for it.

 

Since you have an almost endless lists of different OS's (and corresponding partitions) the "old" way of hiding all the rest and unhide the one that you want to boot may lead to overcomplicate the settings (though it is doable of course), and I would suggest you to more simply use a set of grub4dos partnew commands, creating on the fly - for each OS - the relevant partition entry in the partition table.

 

The partnew (even if used only once) command will also update correctly the "sectors before" of the logical volume inside extended, thus allowing to boot from the volume "native" loader/bootmanager for the OS where it is needed. 

 

For DOS and Windows 9x/Me you can get away also with map --in-situ, however.

 

 

grub4dos has the same (if not "better") graphical features of BURG so, it don't see a reason why you would want to use BURG instead.  :dubbio:

BTW BURG is (was) a project by one of the early developers of grub4dos and AFAIK it is discontinued since several years, whilst grub4dos is actively maintained and continuously bettered/integrated with new functionalities.

 

Get latest grub4dos:

http://grub4dos.chen....6a-2017-12-23/

 

Take some time to read about the partnew command and the map --in-situ options in the README_GRUB4DOS.txt, then feel free to ask questions/advice.

 

:duff:

Wonko



#3 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 11 February 2018 - 03:11 PM

Thanks for the info, I've been havving a play around and it all makes sense. The one bit I can't figure out is how to use partnew properly.

So lets say I have a HDD as follows...

 

hd0,0  = recovery

hd0,4  = DOS

hd0,5  = Win95

...and so on

 

I've got the following command...

 

partnew --active (hd0,1) 0x00 (hd0,4)+1  

 

I'm really not sure how to reference the start sector or length that was just a guess.  It sort of works, but it says Cannot overwrite an independent partition.

 

Any ideas?



#4 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 11 February 2018 - 03:34 PM

Breaking it in pieces:

partnew <-the command

--active <- option to set the boot flag

(hd0,1) <- the second partition slot in the MBR

0x00 <- depending on what follows it means either literally a partition ID of 0x00 or an "autodetect" type, provided that it can be autodetected from the following argument

(hd0,4)+1 <- the "(hd0,4)+1" in this case has a "special meaning" and indicates "the whole extent of first volume inside extended".

 

So, everything seems fine :).

 

Hoping that you are using for the tests a VM of some kind, do the following:

1) boot to grub4dos

2) run the command cat --hex --skip=446 (hd0)0+1 <-this will print the partition table (and the "Magic Bytes")

3) make a screenshot

4) run the partnew command

5) make a screenshot (so that we have an exact error message)

6) run again cat --hex --skip=446 (hd0)0+1

7) make a screenshot (so that we can see what the partnew command changed - if anything - in the partition table)

8) upload *somewhere* the three scrrenshots and post a link to them

 

:duff:

Wonko



#5 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 11 February 2018 - 03:48 PM

Unfortunately, it's not a VM, here's the screenshot..  https://photos.app.g...ro9IkEkJNKFwlo1

 

 

Ignore the Hirens boot CD, that's just still in the menu.lst I copied as an example, it looks like no changes were made by partnew


Edited by Tmp2k, 11 February 2018 - 03:49 PM.


#6 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 11 February 2018 - 04:28 PM

Yep it is good as well :) , as long as you can take a picture of the screen.

 

But you will have to try again. 446, not 466 :whistling:

 

Anyway, assuming that you actually have a (hd0,0) (a primary partition) the second slot in the MBR will be taken by the extended partition (i.e. even if (hd0,1) does not exist, its place is already taken).

 

:duff:

Wonko



#7 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 11 February 2018 - 05:01 PM

So how do I arrange the existing partitions on the HDD so that I can use partnew to create a second primary partition from an existing partition elsewhere on the hdd?

I'll upload a screenshot later o,n I'm away from the PC at the moment. 



#8 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 11 February 2018 - 05:45 PM

So how do I arrange the existing partitions on the HDD so that I can use partnew to create a second primary partition from an existing partition elsewhere on the hdd?

I'll upload a screenshot later o,n I'm away from the PC at the moment. 

You use another slot, in your case you can use (hd0,2) or (hd0,3) as both are free. 

I know it can be confusing, in grub4dos syntax a "same" thing can mean slightly different things, in this case because of the way the whole stuff with volumes in Extended Partiton are created.

Normally:

(hd0,0) means first primary partition (on first disk)

(hd0,1) means second primary partition

(hd0,2) means third primary partition

(hd0,3) means fourth primary partition

(hd0,4) means first volume inside extended 

(hd0,5) means second volume inside extended

BUT the prerequisite for any volume inside extended to exist is that the Extended partition exists, and in order to exist this needs to occupy a slot in the MBR.

 

As a matter of fact the limit of MBR is that of maximum 4 Primary partitions OR maximum 3 Primary partitions + 1 Extended (the limit that only one Extended partition may exist is given by the OS, not by the MBR structure).

 

So in the case of the maximum 4 Primary partitions:

 

(hd0,0) means first primary partition (on first disk)

(hd0,1) means second primary partition

(hd0,2) means third primary partition

(hd0,3) means fourth primary partition

 

And in the case of  maximum 3 Primary partitions + 1 Extended

 

(hd0,0) means first primary partition (on first disk)

(hd0,1) means second primary partition

(hd0,2) means third primary partition

(hd0,3) means nothing, this partition doesn't really exist as a volume, it is just a pointer to a further MBR-like structure containing first volume inside extended

 

In your case:

 

(hd0,0) means first primary partition (on first disk)

(hd0,1) means nothing, this partition doesn't really exist as a volume, it is just a pointer to a further MBR-like structure containing first volume inside extended

(hd0,2) empty/does not exist

(hd0,3) empty/does not exist

 

When you use partnew the meaning for the target (i.e. to where it writes to) is slightly different, it represent an exact location within the MBR partition table:

(hd0,0) means the first slot in the MBR (on first disk)

(hd0,1) means second slot in the MBR (on first disk)

(hd0,2) means third slot in the MBR (on first disk)

(hd0,3) means fourth slot in the MBR (on first disk)

 

So right now you cannot write on the slot called (hd0,1) because it is not empty.

 

Please understand how some caveat may apply (particularly due to the different ways the different OS or even some particular tool running under them may access the info in the MBR and parse it), as an example you may have issues with partition "out of sequential order" and more generally (with the way you are currently using the feature) there is the possible risk of having the same volume mapped twice (because you have it written by the partnew command as primary partition BUT you have also it available as volume inside extended).

 

I would rather use once (for each volume) the partnew command to write it as primary (this will also correct once and for all the "sectors before"), jolt down the extents and later only use the partnew command with the extents (and expliciting the partition ID).

 

:duff:

Wonko



#9 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 11 February 2018 - 07:58 PM

I think I get what you're saying.  essentially if you have 1 primary plus n logicals you've always used up hd0,0  and hd0,1  in the context of the destination when using partnew.

I'll have a play around and see what I can come up with.

 

BTW, is there a way to use  hide or unhide  with all partitions?  e.g.  hide(hd0)  

 

Also is there a place to put commands in menu.lst that will always be executed regardless of menu choice?  So I don't have to repeat the same commands under each title



#10 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 11 February 2018 - 08:14 PM

Hmmmmm,  so I've used partnew to create a primary partition hd0,2 that points to  hd0,4   but DOS (on part 4) failed to boot.  I then tried booting to my recovery partition (MiniXP) and this did work but then bluescreened.  I have a feeling I've broken the part table or got some kind of endless loop going on?
 
Removed hd0,2 and I can boot MiniXP.
 
Here's the command I used..
 
partnew --active (hd0,2) 0x00 (hd0,4)+1
 
https://lh3.googleus...0=w1299-h974-no
 
 
Here's my disk setup, ignore "Disk 1"  this is hd1 and is not relevant at this point I'm only dealing with hd0. All those logical parts are hidden as is hd0,0 the RECOVERY part.
 
https://lh3.googleus...w=w1299-h974-no

#11 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 11 February 2018 - 08:43 PM

You have found some other kind of incompatibility, don't worry, it's normal when doing experiments.

 

You used the 0x00 (I suggested you to use it NOT), that either grub4dos interpreted as 0x0E, or maybe the partition ID is already 0x0E..

 

0x0E means "0e WIN95: DOS 16-bit FAT, LBA-mapped":

https://www.win.tue....on_types-1.html

 

DOS (before the 7.0 in Windows 95) knows nothing about 0x0E.

You probably need to use 0x06, i.e. "06 DOS 3.31+ 16-bit FAT (over 32M)" which is what the DOS up to 6.22 can understand.

 

Try using:

parttype (hd0,4)

it should give you 0xE

then run

parttype (hd0,4) 0x06

and try again booting.

 

:duff:

Wonko



#12 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 11 February 2018 - 08:52 PM

Also is there a place to put commands in menu.lst that will always be executed regardless of menu choice?  So I don't have to repeat the same commands under each title

 

Yes and no (if I get right the question).

 

If you have a SAME set of commands that you ALWAYS want to execute, you can have them in menu.lst before any "choice".

 

If you have DIFFERENT sets of commands, or if you prefer have entries that must NOT execute those settings, no, but you can use a grub4dos batch file.

 

If you post an example of your menu.lst it would be probably be easier to give you some hints, BTW, you could - instead of hiding the single volumes inside extended - making type 0x00 the actual Extended partition (of course after having had it as 0x05 to run the partnew command and of course re-setting to 0x05 at next boot before re-running the partnew command) 

 

:duff:

Wonko



#13 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 18 February 2018 - 07:04 PM

OK, so here's where I'm up to, after trying a few differnt methods. I want to find a way that will always leave the active OS part in the same location for NTLDR/BOOTMGR regardless of the number of logical drives inthe extended partition.

Partition layout after grub4dos has run..

[primary:recovery][extended:contains any number of logicals][primary:crated by partnew]

so the active OS is always hd0,2, but I'm guessing NTLDR and BOOTBGR counts the logical drives inside the extended part before the second primary part?

I like the idea of setting 0x0 on the extended partiton, this is a much neater solution. But what would I set it back to to restore it?

If I did set it to 0x0, would this cause NTLDR and BOOTMGR to ignore the logical drives?

Is there any way to run a command to see how NTLDR or BOOTMGR are enumerating partitions instead of trial and error?

Is there an option of usiing a 'dummy' partitoin? and replacing this with the partnew partion. e.g.

[primary:recovery][primary:dummy][extended:many logical drives]

Then after grub4dos..

[primary:recovery][primary:partnew mapped to logical][extended:many logical drives]

If this would work, what ID should I give the dummy parition and how to I overwrite it with part tnew, then set it back to a dummy state?

Edited by Tmp2k, 18 February 2018 - 07:25 PM.


#14 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 18 February 2018 - 08:10 PM

so the active OS is always hd0,2, but I'm guessing NTLDR and BOOTBGR counts the logical drives inside the extended part before the second primary part?

Not really.

 

NTLDR thinks in terms of ARCPATHs, those are counted enumerating first the Primaries, and only later the volumes inside extended.

 

This is unlike grub4dos (or GRUB/GRUB2) syntax, which uses - as we have seen - "fixed" positions.

 

It has to be seen what happens in your case[1], since there is this more complex way of numbering, see:

https://www.goodells...t/bootini.shtml

it is even possible  (though I doubt it) that different OS's (NT/2k/XP vs. Vista/7/8/10) may use a different algorithm (this happened  - just for the record - with drive lettering with DOS/9x/Me using a slightly different algorithm than NT/2K/XP).

 

You might find this useful:

https://www.boyans.n...hs/ArcPaths.htm

 

:duff:

Wonko

 

[1] It would make a lot of sense - in your case - to move the entry for the extended partition to the third or fourth slot, and use partnew rewriting over the second slot, i.e. (hd0,1) 



#15 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 18 February 2018 - 08:52 PM

I see. My whole suggesiton of the dummy partition was to simply push the extended partition to the 3rd slot. I've been using Acronis Disk Director and Partition Magic (from MiniXP) and these just auto-arrange the partitions, I can't see a way to force an empty slot.

So my goal is..

slot1 = primary/recovery
slot2 = empty/nothing
slot3 = extended/unknown number of logical drives
slot4 = not used

GRUB4DOS config

set slot3 partition ID to <the id for extended partition>

title <some version of windows>
partnew <map slot2 = some logical drive>
set slot3 to ID 0x0


NTLDR / BOOTMGR

Boot windows from disk(0)/part(2)

Would that work? and what partition editor shoudl I use to manualy choose what slots are used for the extended partition? Is it even possible to move slots, or will everyhitng need to be re-created :S

Edited by Tmp2k, 18 February 2018 - 08:58 PM.


#16 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 19 February 2018 - 02:53 PM

Would that work? and what partition editor shoudl I use to manualy choose what slots are used for the extended partition? Is it even possible to move slots, or will everyhitng need to be re-created :S

The good news are that you need not any fancy partition editor, you can do everything from within grub4dos, using the internal dd command.

 

The 4 slots are in the MBR (i.e. in the first sector of the hard disk) at offset (respectively) 446, 462, 478 and 494.

Each slot is 16 bytes in size. 

 

So, (example) to copy the second slot on third slot you would do:

dd if=(hd0)0+1 of=(hd0)0+1 bs=1 count=16 skip=462 seek=478

and then:

partnew (hd0,1) 0x00 0 0

to delete the contents of second slot.

 

BEFORE the above I would make sure to have a backup of the MBR, you never know.

You can use any of the DOS/Windows suitable tools, otherwise good way is to create (I would suggest on the recovery partition) from the whatever "real" OS you are currently booting a file 512 bytes in size, naming it MBRcopy.bin (one of the limitations of grub4dos is that it cannot create files on NTFS, and needs an additional external module to create one on FAT), then boot to grub4dos and run:

dd if=(hd0)0+1 of=(hd0,0)\MBRcopy.bin bs=512 count=1 

 

This little grub4dos batch here:

http://reboot.pro/to...l-for-grub4dos/

might be of use to check the situation before and after the dd commands moving (actually copying an pasting) the slot(s).

You want the "no wenv" version by Nando.

 

If you feel not confident enough to use dd, you can use the above batch to read current values, and partnew to write them to a different slot (partnew parameters are only the LBA values, partnew automatically calculates the CHS).

 

:duff:

Wonko



#17 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 03 March 2018 - 11:34 PM

I see what you're saying, although to be honest I've till not got my head around it fully, I think I need to spend more time working with the MBR for it to make perfect sense.

However I've managed it and I now have this setup..


slot1 = primary/recovery
slot2 = empty/nothing
slot3 = extended/unknown number of logical drives
slot4 = not used


After grub4dos works it magic I end up with...

slot1 = primary/recovery - hidden
slot2 = primary/copy of a logical drive contatining OS - active
slot3 = extended / lots of hidden logical drives
slot4 = not used

This works great for DOS/Win9x/Win2K/WinXP. Although WinXP is bluescreening, but it's after ntldr has started so I know it's booting fine.

However Win7 refuses to work.

As a test I setup a copy of Win7 on a differnt HDD and manually configured the partitions to:

slot1 = primary/hidden
slot2 = primary/OS

I then cloned this installation of Win7 to a logical drive in my complex setup, but it fails to boot with "Device inaccessible"

If I run the Windows Recovery Envornment and run bootrec /scanos it picks up 2 operating systems on Volume6 and Volume7 (these are the hidden logical drives)

Here's where it gets complicated, running diskpart and listing the parts gives the following..

Partition 1 Primary Start
Partition 0 Extended 62MB
Partition 3 Logical 62MB
Partition 4 Logical 20GB
Partition 5 Logical 40GB
Partition 142 Logical 60GB
Partition 142 Logical 60GB
Partition 7 Logical 80GB
Partition 8 Logical 100GB

There's a few things going on here. Part 2 and 6 are missing. Part 6 would be the Win7 logical drive and part 2 would be the primart part grub4dos created. Instead these are both numbered 142. Also it seems to have ignored the order in the partition tabel and just numbered them in the order they begin on the disk.

So what do I do? I can't even fix bootmgr becasue the volume I need to select is not listed when I do /scanos

#18 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 04 March 2018 - 08:50 AM

Well, why did you went the (more complex) cloning way?

 

You are missing a couple steps in the cloning. (and I am missing a couple details in your report? :unsure:).

Let's call the "main" hard disk Hard Disk 0 or HD0 and the second hard disk where you temporarily installed the Windows 7 Hard Disk 1.

You cannot really-really clone it, you need to take care of Disk Signature AND of partition offset in the Registry besides - most probably, a number of factors may be involved in this - correcting/rebuilding the BCD in order to boot from the "cloned" volume once deployed to HD0.

 

Why/what happened to the "slot1" on HD1?

Was it just a "dummy" partition to be able to put the actual OS install (both "boot" and "system" volumes merged into one) on slot2?

Or was it the "boot" volume (that MS stupidly calls "system" volume, i.e. containing the BOOTMGR and \boot\BCD) and you actually only "cloned" the volume in slot2, the "system" volume (that MS stupidly insists on calling "boot" volume)?

 

About the output of diskpart, I am not surprised if you have BOTH the Extended Partition and one of the volumes inside it re-mapped as primary in second slot that it gets mad.

 

It simply finds a disk structure that it cannot "resolve".

 

As hinted before, once you have re-mapped via grub4dos the logical volume of interest to a primary in slot 2, you can (should) change the partition type of the Extended partition (slot 3) to 0x00 (so that Windows won't see it, nor any of the logical volumes inside it).

Before doing this, have a look at the partition table checking whether the current partition type for the Extended partition is 0x05 or (more probably) 0x0F (I am assuming 0x0F ), so that you can later restore it to allow grub4dos to re-map another logical volume.

 

In a nutshell you should have at the most three "states" of the partition table:

1) Partition Type of Extended partition (slot 3) set to 0x0F AND partition Type (and addresses in it) of slot 2 set to 0x00 <- this is the "normal state" of the hard disk, with only the slot 1 (primary) and all the logical volumes inside extended partition accessible, in this condition Diskpart (run from a PE or from the recovery environment in slot 1) will enumerate partitions correctly. 

 

2) Correct Partition Type (and addresses in it) of slot 2 pointing to one of the volumes inside extended (remapped via grub4dos partnew command) AND Partition Type of Extended partition (slot 3) set to 0x00 <- this is the "operating condition" of the hard disk, booted to the *whatever* is a the moment in the volume mapped in slot 2, in this condition Diskpart (run from a PE or from the recovery environment in slot 1) will enumerate partitions correctly (but will only see the two primaries, the slot 1 and the remapped one to slot 2, if you remap to slot 2 the "Partition 6" above, this is the condition where you attempt to fix the booting of the Windows 7).

 

3)  Partition Type of Extended partition (slot 3) set to 0x0F AND Correct Partition Type (and addresses in it) of slot 2 pointing to one of the volumes inside extended (remapped via grub4dos partnew command) <- this should NEVER be the case outside the running of grub4dos or during experiments, as most tools (in *any* OS) related to disk partitioning will get confused by the double mapping of a same extent on disk, once as a primary and once as a logical volume inside Extended (depending on a number of factors - details of your installed systems - be very aware of the limits like the 128/137 Gb one and the lower ones each OS may have, as they often happen to "wrap around" addresses so that a write to disk may be destructive).

 

The whole idea is that at any given moment any OS (exception made for grub4dos) can "see" and access ONLY "its own" volume (and the hidden recovery in slot 1).

 

:duff:

Wonko



#19 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 06 March 2018 - 09:30 AM

Just a word of warning. I haven't tested this for many years now and things may have changed since then, but Windows DiskPart (can't remember what OS!) had a nasty habit of re-writing the partition table for you.

It used to load the MBR into memory and then re-order the partition table so that the 4 entries were in ascending order of Start Sector (presumably it also does some checks too). When you Exit DiskPart, it would write the re-ordered table back to the MBR, even if you made no changes to the partitions.



#20 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 06 March 2018 - 01:12 PM

Just a word of warning. I haven't tested this for many years now and things may have changed since then, but Windows DiskPart (can't remember what OS!) had a nasty habit of re-writing the partition table for you.

It used to load the MBR into memory and then re-order the partition table so that the 4 entries were in ascending order of Start Sector (presumably it also does some checks too). When you Exit DiskPart, it would write the re-ordered table back to the MBR, even if you made no changes to the partitions.

Exactly :thumbsup: :

 

 

3)  Partition Type of Extended partition (slot 3) set to 0x0F AND Correct Partition Type (and addresses in it) of slot 2 pointing to one of the volumes inside extended (remapped via grub4dos partnew command) <- this should NEVER be the case outside the running of grub4dos or during experiments, as most tools (in *any* OS) related to disk partitioning will get confused by the double mapping of a same extent on disk, once as a primary and once as a logical volume inside Extended (depending on a number of factors - details of your installed systems - be very aware of the limits like the 128/137 Gb one and the lower ones each OS may have, as they often happen to "wrap around" addresses so that a write to disk may be destructive).

 

The whole idea is that at any given moment any OS (exception made for grub4dos) can "see" and access ONLY "its own" volume (and the hidden recovery in slot 1).

 

and, to give another example, there is the known case of Vista (or later) diskpart misbehaving when changing active partition (on volumes aligned to track):

http://reboot.pro/to...itioning-issue/

 

 

 

:duff:

Wonko



#21 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 15 August 2018 - 08:51 PM

It's been a while but I picked this project back up again.  I've changed my partition structure slightly to the following...

[primary:recovery] [extended:lots of logical drives] [primary: link to logical drive created by g4d] [not used] 

 

I now have many versions of windows booting successfully but I just have one strange problem I can't seem to sort.  Using the above system I can boot to MS-DOS 6.22 as long as the logical drive partition is within the 1st 1023cyls of the drive (8GB).  So I've slimmed down the recovery part to 1GB and created a few 1GB parts for early versions of windows.

 

However, I can only get the 1st logical part to boot under DOS. This is at 1GB - 2GB.  I can't get the next part at 2GB-3GB to boot. I get INVALID BOOT DISK.  Do you have any suggestions?

 

Here's my menu.lst, this is the version that works, but imagine another 2 entries at the top of that list.  Windows 1 and Windows 2, these being the first 2 logical drives, then all the partitions would be 2 higher. e.g. Windows 3.1 is (hd0,6). All these early windows parts are MS-DOS 6.22 FAT16, in fact the same partition that already works, just cloned 3 times.


#timeout 15
default /default
write (md)0x220+1 !BAT\necho -n -P:0000 $[0107] EVOWin \0 && initscript (md)0x220+1


#hide all parts
hide (hd0,0)
hide (hd1,0)

#delete cloned part
partnew (hd0,2) 0 0 0

#restore extended part
parttype (hd0,1) 0x0F


gfxmenu /gfxboot/message

title Windows 3.1
partnew --active (hd0,2) 0x06 (hd0,4)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1

title Windows 95
partnew --active (hd0,2) 0x00 (hd0,5)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1


title Windows 98
partnew --active (hd0,2) 0x00 (hd0,6)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1


title Windows ME
partnew --active (hd0,2) 0x00 (hd0,7)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1

title Windows 2000
partnew --active (hd0,2) 0x00 (hd0,8)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1

title Windows XP
partnew --active (hd0,2) 0x00 (hd0,9)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1


title Windows Vista
partnew --active (hd0,2) 0x00 (hd0,10)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1


title Windows 7
partnew --active (hd0,2) 0x00 (hd0,11)+1
parttype (hd0,1) 0x00
root (hd0,2)
chainloader +1


title Windows 10
parttype (hd0,1) 0x00
root (hd1,0)
unhide
makeactive
map (hd1) (hd0)
chainloader /bootmgr

title \n

title Recovery
root (hd0,0)
makeactive
unhide (hd0,0)
unhide (hd1,0)
chainloader /HBCD/XP/XP.BIN

title MemTest86+\n
find --set-root /HBCD/Boot/memtest.gz
map --mem /HBCD/Boot/memtest.gz (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
map --floppies=1





#22 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 16 August 2018 - 10:57 AM

Try using (instead of partnew) the map-in-situ approach for DOS:

******************************************************************************
***                   About the new map option --in-situ                   ***
******************************************************************************

--in-situ is used with hard drive images or hardrive partitions. With an
in-situ map, we can typically use a logical partition as a primary partition.

In-situ map is a whole drive map. It only virtualize the partition table and
the number of hidden sectors in the BPB of the DOS Boot Record.

While disk emulation may encounter various problems with win9x, the in-situ map
works fine with win9x.

Note that --in-situ will not change the real partition table.

Example:

	map --in-situ (hd0,4)+1 (hd0)


:duff:

Wonko



#23 Tmp2k

Tmp2k

    Newbie

  • Members
  • 19 posts
  • Location:Manchester
  • Interests:Software Dev, Retro Computing
  •  
    United Kingdom

Posted 17 August 2018 - 02:16 PM

So if I use map --in-situ (hd0,4)+1 (hd0) then dos will think that there is is just 1 partition on hd0 and that partition will be whatever the 1st logical drive is.

 

The effect is temporary and next time I boot up I don't need to "put anything back to how it was" in the top of my menu.lst file?

 

How do I flag the newly mapped partition as active as I don't think the logical drives are flagged as active already?



#24 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 17 August 2018 - 03:19 PM

So if I use map --in-situ (hd0,4)+1 (hd0) then dos will think that there is is just 1 partition on hd0 and that partition will be whatever the 1st logical drive is.

 

Yep. :)

 

The effect is temporary and next time I boot up I don't need to "put anything back to how it was" in the top of my menu.lst file?

 

Yep. :)

 

How do I flag the newly mapped partition as active as I don't think the logical drives are flagged as active already?

Good question, but I have a better one :w00t: :

Is it actually *needed* that the partition is active?

 

:duff:

Wonko



#25 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 17 August 2018 - 03:23 PM

Type
Help map
in the grub4dos console.
It mentions flags and id type??
Could a flag of 0x80 mark it active?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users