Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Formatting an external drive using different interfaces


  • Please log in to reply
118 replies to this topic

#101
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Ok, I have checked several possible approaches, of them only two passed the tests (aiming to have something reproducible and extendable/modifiable without size constraints, queer behaviours or more generally producing less compatible results).

The partitioning schemes consist in either a Primary partition with a small FAT12 volume + the "rest of the disk" in a (huge) NTFS logical volume inside extended (which I cleverly called "PriLog") or in two logical volumes inside extended, the first being the small FAT12 volume and the second the huge NTFS volume (which I expectedly called TwoLog).

The second one did not make it after a pass of Occam's Razor as it involved a double-double EPBR (too complex and more prone to errors) while offering NO advantages (if not that of using only one MBR partition table entry, something not really an issue for the specific use of a dual USB/eSATA connection of an external disk) whilst the PriLog may offer "direct" bootability (at least on 512 bytes/sector interface) and when booting the switch may be offered by - say - a simple, small grub4dos batch.

There is a brief ReadMe.txt in the attached archive that should be READ (and READ CAREFULLY) before using the batches, which are however HEAVILY commented, so that it should be not difficult to understand the behaviour/functioning of the thingy.

Use of them is of course experimental, and even more obviously :w00t: it is potentially dangerous :ph34r:, though I tried my best to add as many checks as possible (may be even too many of them).

They seem to work fine in my XP on a (simulated/virtual) disk mounted as either 4kb or 512 bytes/sector device, but I need feedback on how it behaves on Vista (and later).

I am adding also a simple Excel spreadsheet from which it may be easier to understand the scheme, basically we make a (fake) Extended Partition only one sector in size that magically ;) contains either the whole disk (on 512 bytes/sector device) or only the logical (NTFS) huge volume (on 4kb/sector device, at least this is what Windows Disk Manager thinks :whistle:.

jaclaz

Attached Files




How to remove advertisement from MSFN

#102
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

Thanks jaclaz.

I've collected all the necessary files into a folder and I'll be experimenting with this tomorrow!

:)

The contents of your spreadsheet mean absolutely nothing to me I'm afraid, way over my head!

:lol:

I'll let you know how it goes.


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#103
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

Hi again jaclaz!

Been trying this out using Windows 8.1 and the USB interface, which is the correct one for 4k sectors I hope.

 

You say in the readme "To run the mkdualmode.cmd, you need to have already deployed the prilog.cmd image to the target disk".

I assume that "mkdualmode.cmd" is the same file as "mkdualdisk.cmd" which is what you've actually called it.

 

The other thing is that I think you need to tell people how to actually do that.

I ran the command "C:\MkPriLog\dsfi \\.\ Physicaldrive1 0 0 PriLog.img", which seemed to work, but I had to look back in this thread to remind me how to do it!

 

I now have my drive reported in Disk Management as two partitions, a 256 MB FAT one, and a 931.26 GB one which I've formatted as a primary partition.

There are also two drives in "My Computer", a 31.6 MB one, and a 931 GB one.

 

I'm now a bit stuck, as the readme says to now copy dsfi.exe, as4kbNTFS.bss, as512NTFS.bss, elevate.exe, and Switcher.cmd, presumably to the 31.6 MB drive.

Where exactly are the two *.bss files?

Should they have be included from the start or should they have been generated, and if so where?

 

Cheers, Dave.

:)


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#104
dencorso

dencorso

    Iuvat plus qui nihil obstat

  • Supervisor
  • 6,186 posts
  • Joined 07-April 07
  • OS:98SE
  • Country: Country Flag

Donator

<Somewhat Off-Topic:>

 

I actually think that's right out or order, selling on a hard drive with someone else's data still on it without re-formatting it, or at least deleting the partitions.

I will be contacting the person i bought it from to tell them this.

There was nothing sinister on it I'm glad to say, but even so I think this it's wrong on principle!

 

What reply did you get? Were you able to contact the original owner, too?



#105
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Yep, I must have changed names while developing the batches :blushing:, the correct file name is "mkdualdisk.cmd" of course, I'll edit/correct the readme.txt.

 

When you run mkprilog.cmd, at the end it should display:

The image should have been created as Prilog.img, now you need to
manually dd it to the destination disk, a suitable command would be:
dsfi.exe \\.\PhysicalDrive[n] 0 0 Prilog.img

Make sure that you use the RIGHT Disk Number [n], do check in Disk Manager.
The disk can be mounted indifferently through the 4kb or the 512
bytes/sector interface to deploy the image.

Once the image has been deployed you may need to disconnect and reconnect the
disk to have the FAT12 volume be recognized and mounted.
Then you can go to Disk Manager and create a Primary partition, NTFS formatted
extending on all the available space on disk (or on just a portion of it).
It is "better" to use a Vista (or later) OS to create the NTFS partition
The partition would be better if Megabyte aligned.
(or do it manually or use a suitable third-party tool) as the XP will align it
on head/cylinder boundaries, whilst a MB-aligned partition will be faster on
slow buses such as USB 2.0
The partition and the NTFS filesystem MUST be created when the disk is connected as
a 4kb sectored device, this is NOT negotiable.
Once the second partition has been created, and I repeat, this MUST be done
with the device connected as 4kb sectored, you can run the mkdualdisk.cmd
Which will modify the disk and create the needed EPBR's.

 

 

Now :), check the drive letter assigned in Disk Manager to the 256 MB FAT (or assign to it one), you will see how that that same drive letter in "My Computer" is assigned to the 31.6 MB FAT partition (the size of the FAT partition comes from the choice you made in mkprilog.cmd, where you are asked to provide a size for the partition between 1 and 32 Mb).

The batch create however an image with only one partition, the first one, primary (on the left in Disk Manager) which is a (smallish) FAT(12)  one and the second one (on the right in Disk Manager) which is a (largish) NTFS partition that you create manually in DIsk Manager, which is later trasformed by the riunning of mkdualdisk.cmd into a Logical Volume inside Extended so guess to which partition I refer with:

Once the mkdualmode.cmd has been run successfully, you need to copy to the first (FAT12) primary partition ...

 

:unsure:

 

I know that the choice of using dark blue for primary partition and of light blue for logical volumes and a tiny light green border around the Extended partition is not the best choice in the world to distinguish something visually, but you should sue MS for this ;).

 

I cannot refer to the partition as having a given size, as it depends on the choice you make when running mkprilog, and the size of the "other" partition of course depends from the size of the disk and/or from the size of the partition you created manually in Disk Manager, I thought, that order (first), filesystem used (FAT12) and nature of partition (primary) was clear enough, but I am open to any suggestion to make this more clear. 

 

The .bss files should have been generated in the same folder where mkdualmode.cmd was run, i.e. C:\MkPriLog\ in your case, and where should be also the dsfi.exe, elevate.exe and Switcher.cmd, maybe I could call this "tool folder" to better make it clear?

 

The file as4kbNTFS.bss and as512NTFS.bss are created by "mkdualdisk.cmd" when it displays:

 

Creating a copy of the 4kb bytes/sector NTFS bootsector
And modifying it to become the 512 bytes/sector NTFS bootsector

 

 

I may add a couple more lines f text so that it becomes:

 

 

Creating a copy of the 4kb bytes/sector NTFS bootsector and saving it as C:\MkPriLog\as4kbNTFS.bss
And modifying it to become the 512 bytes/sector NTFS bootsector, saving it as C:\MkPriLog\as512NTFS.bss

 

:unsure:

 

jaclaz


Edited by jaclaz, 23 January 2015 - 01:03 PM.


#106
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

@dencorso

<Somewhat Off-Topic:>

What reply did you get? Were you able to contact the original owner, too?

You'll love this!

What I got back was -

"it was my grandsons (sic) hard drive the turnip obviously forgot to delete it, appologies (sic)"!

Well at least the seller knew where the drive had came from, which is more than most eBay sellers know I'm sure, selling on stuff supplied by third parties.

:lol:

 

@jaclaz

I've deleted the partitions and tried again.

The problem is that when you run mkPriLog.cmd, you get this -

please input an approximated size in Megabytes for the FAT12 partition, minimum
1, maximum 32...
The image will be created in the same folder as this batch
and will be named PriLog.img

32
Writing MBR at offset 0 ...
... done.
... done.
Writing the 512 bytes/sector bootsector BPB at offset 32768 ...
BS512_Res=456
BS512_SBef=64
BS512_Sectors=65472
BS512_SpF=32
... done.
... done.
Writing the 4096 bytes/sector bootsector BPB at offset 262144...
... done.
Writing FAT tables incipit ...
... done.
Base address of EPBR 512 is 4190208
Base address of EPBR 4Kb is 33521664
Press any key to continue . . .

On pressing another key, now I know they're there I can see the rest of the instructions come up, but then the command prompt window immediately closes, giving you no time to read them!

:lol:


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#107
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

On pressing another key, now I know they're there I can see the rest of the instructions come up, but then the command prompt window immediately closes, giving you no time to read them!

:lol:

You mean you ran the mkPriLog.cmd by double ckicking on it? :w00t: :ph34r:

 

I guess I'll have to add a final PAUSE to it, since the idea that batches, particularly when experimenting, should ALWAYS, ALWAYS, ALWAYS run from an open command prompt in which you navigate to the directory where the batch is and then you type it's name and hit the [ENTER] key is something that simply doesn't go through as a message, not even getting to an experienced member like you are.

 

And before you ask, the switcher.cmd is an exception to the above general rule and CAN be run by double clicking on it, as it was designed for it.

I guess I will have to review the other two batches making sure that they can be run also by double clicking on them having all their functionalities.  :unsure:

 

jaclaz


Edited by jaclaz, 23 January 2015 - 02:01 PM.


#108
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

Ah, right!

:lol:

I have to say that I do think that most people will expect to be able to run the cmd files by double clicking on them, at least in the final version.

 

Should I be using elevated command prompts or normal ones for this BTW?

My command prompt shortcuts run elevated prompts by default.

:)


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#109
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

OK, I've tried again stating for scratch using elevated prompts, which may or may not be necessary.

 

Everything went fine until i ran mkdualdisk, at which point I got -

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\windows\system32>cd\

C:\>cd mkprilog

C:\MkPriLog>mkprilog
please input an approximated size in Megabytes for the FAT12 partition, minimum
1, maximum 32...
The image will be created in the same folder as this batch
and will be named PriLog.img

32
Writing MBR at offset 0 ...
... done.
... done.
Writing the 512 bytes/sector bootsector BPB at offset 32768 ...
BS512_Res=456
BS512_SBef=64
BS512_Sectors=65472
BS512_SpF=32
... done.
... done.
Writing the 4096 bytes/sector bootsector BPB at offset 262144...
... done.
Writing FAT tables incipit ...
... done.
Base address of EPBR 512 is 4190208
Base address of EPBR 4Kb is 33521664
Press any key to continue . . .
.
The image should have been created as PriLog.img, now you need to
manually dd it to the destination disk, a suitable command would be:
dsfi.exe \\.\PhysicalDrive[n] 0 0 PriLog.img
Make sure that you use the RIGHT Disk Number [n], do check in Disk Manager.
The disk can be mounted indifferently through the 4kb or the 512
bytes/sector interface to deploy the image.
Once the image has been deployed you may need to disconnect and reconnect the
disk to have the FAT12 volume be recognized and mounted.
Then you can go to Disk Manager and create a Primary partition, NTFS formatted
extending on all the available space on disk (or on just a portion of it).
It is "better" to use a Vista (or later) OS to create the NTFS partition
The partition would be better if Megabyte aligned.
(or do it manually or use a suitable third-party tool) as the XP will align it
on head/cylinder boundaries, whilst a MB-aligned partition will be faster on
slow buses such as USB 2.0
The partition and the NTFS filesystem MUST be created when the disk is connected
 as
a 4kb sectored device, this is NOT negotiable.
Once the second partition has been created, and I repeat, this MUST be done
with the device connected as 4kb sectored, you can run the mkdualdisk.cmd
Which will modify the disk and create the needed EPBR's.

C:\MkPriLog>dsfi \\.\PhysicalDrive1 0 0 PriLog.img
OK, written 33554432 bytes at offset 0

C:\MkPriLog>mkdualdisk
"DUAL" disk found as \\.\PHYSICALDRIVE1

Creating a temporary copy of the MBR
OK, 4096 bytes, 0.031s, MD5 = c5e2a6e6a72dd713bde01cef7939e4dd

000001B8h: 44 55 41 4C DUAL
000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00
000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 C0 FF 00 00
000001DEh: 00 14 11 04 07 FE FF FF 00 00 01 00 00 0B 8D 0E
000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The disk was NOT recognized as being created with the known schemes
Press any key to continue . . .

Pressing a key just goes back to the command prompt.

 

I had formatted a primary partition on the drive as per the instructions.

:)


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#110
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Good (which means bad in this case) :w00t:.
The "recognition" of the disk happens through a "five point voting system":
 
 

::Let's make a few checks
::If mkprilog was used:
::first partition must be type 0F, start at offset 63 and be 1 sector in length
SET PriLog=0
IF "%Entry446_Type%%Entry446_Start%%Entry446_Length%"=="0F631" SET /A PriLog+=1
::second partition must be type 01 and start at offset 64 and it's start+length should
::be 8 times the start of third partition (if formatted MB aligned) or 8 times the
:: start of the third partition - 63
::if formatted head/cylinder aligned
IF "%Entry462_Type%%Entry462_Start%"=="0164" SET /A PriLog+=1
SET /A by8=%Entry478_Start%*8
SET /A by8XP=(%Entry478_Start%-63)*8
SET /A sum462=%Entry462_Start%+%Entry462_Length%
IF %by8%==%sum462% SET /A PriLog+=1
SET /A sum462=%Entry462_Start%+%Entry462_Length%
IF %by8XP%==%sum462% SET /A PriLog+=1
::third partition must be type 07
IF "%Entry478_Type%"=="07" SET /A PriLog+=1
::fourth partition must be type 00
IF "%Entry494_Type%"=="00" SET /A PriLog+=1

IF %Prilog% geq 5 (
ECHO The disk was recognized as created with the Prilog scheme
SET NTFS_StartHex_MBR=%Entry478_StartHex%
SET NTFS_Start_MBR=%Entry478_Start%
SET NTFS_LengthHex_RAW="0x%Entry478_LengthHex:~6,2%,0x%Entry478_LengthHex:~4,2%,0x%Entry478_LengthHex:~2,2%,0x%Entry478_LengthHex:~0,2%"
GOTO :skipTwolog
)

...

 

ECHO The disk was NOT recognized as being created with the known schemes&PAUSE&GOTO :EOF
:skipTwolog

One or more of the five checks fails, from the output you posted they all seem to verify :unsure:, try (using Notepad ;)) a line after each "SET /A PriLog+=1" *like:

ECHO Condition #1, Prilog=%Prilog%

And, just before the "IF %Prilog% geq 5 (" a couple lines to see the values involved in the check:

SET Entry4
SET sum
SET by

jaclaz



#111
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

OK, done that.

This is what I'm now getting -

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\windows\system32>cd\

C:\>cd MkPriLog

C:\MkPriLog>mkdualdisk
"DUAL" disk found as \\.\PHYSICALDRIVE1

Creating a temporary copy of the MBR
OK, 4096 bytes, 4.828s, MD5 = c5e2a6e6a72dd713bde01cef7939e4dd

000001B8h: 44 55 41 4C DUAL
000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00
000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 C0 FF 00 00
000001DEh: 00 14 11 04 07 FE FF FF 00 00 01 00 00 0B 8D 0E
000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Condition #1, PriLog=1
Condition #1, PriLog=2
Condition #1, PriLog=2
Condition #1, PriLog=2
Condition #1, PriLog=3
Condition #1, PriLog=4
Entry446=000000000F0000003F00000001000000
Entry446_Length=1
Entry446_LengthHex=00000001
Entry446_Start=63
Entry446_StartHex=0000003F
Entry446_Type=0F
Entry462=000000000100000040000000C0FF0000
Entry462_Length=65472
Entry462_LengthHex=0000FFC0
Entry462_Start=64
Entry462_StartHex=00000040
Entry462_Type=01
Entry478=0014110407FEFFFF00000100000B8D0E
Entry478_Length=244124416
Entry478_LengthHex=0E8D0B00
Entry478_Start=65536
Entry478_StartHex=00010000
Entry478_Type=07
Entry494=00000000000000000000000000000000
Entry494_Length=0
Entry494_LengthHex=00000000
Entry494_Start=0
Entry494_StartHex=00000000
Entry494_Type=00
sum462=65536
by8=524288
by8XP=523784
The disk was NOT recognized as being created with the known schemes
Press any key to continue . . .

C:\MkPriLog>

Hope that helps!

:)


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#112
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Yep :thumbup , though I did not specified it :blushing: I had expected something more along the lines of:

 

Condition #1, PriLog=1
Condition #2, PriLog=2
Condition #3, PriLog=2
Condition #4, PriLog=2
Condition #5, PriLog=3
Condition #6, PriLog=4

 

Condition #1 is OK:

::first partition must be type 0F, start at offset 63 and be 1 sector in length

Condition #2 is OK:

::second partition must be type 01 and start at offset 64 

Condition #3 AND #4 Fail :w00t: :ph34r: while either #3 or #4 should have succeeded:

::... and it's start+length should

::be 8 times the start of third partition (if formatted MB aligned) or 8 times the
:: start of the third partition - 63
::if formatted head/cylinder aligned

Condition #5 is OK:

::third partition must be type 07

Condition #6 is OK:

::fourth partition must be type 00

 

Let's see what is the issue in #3/#4, the one that applies in XP is #4 and is tested OK here (but due to the different/virtual environment in which I experimented it may well need to be corrected as well, on further tests, so for the moment we need to check just #3:

The partition you created starts 

Entry478_Start=65536

Immediately after the FAT12 partition

Entry462_Start=64

Entry462_Length=65472
sum462=65536

and not, as expected :unsure:, at 65536/8=8192

 

The issue lies actually in the "other" batch, mkprilog, due to the limitations of the virtual disk driver I am using to test, I need to create the second NTFS partition with the disk mounted as 512 b/s and run it with the /testonly switch, while you are (obviously) doing everything in 4Kb/s.

 

In a nutshell, we need to find a way to set temporarily the Entry462_Length to 1/8th of what it is now to allow you to create the NTFS partition in Disk Manager at the "right" address.

 

Temporarily, you need to edit mkprilog.cmd, these lines:

 

::Second partition entry NumLBA
SET /A MBRNumLBA2=%Imgsize%/512-%MBRStartLBA2%
CALL :decwrite %Base_addr%+0x01DA %MBRNumLBA2% 4

 

 

should become:

 

::Second partition entry NumLBA
SET /A MBRNumLBA2=%Imgsize%/4096-%MBRStartLBA2%
CALL :decwrite %Base_addr%+0x01DA %MBRNumLBA2% 4

 

and add a line to mkdualdisk.cmd here:

 

 

SET Imgname=temp.mbr
ECHO.

 

 

should become:

 

 

 

SET Imgname=temp.mbr
ECHO.

::let's assume that mkprilog created the right 4096 bytes sector MBRNumLBA2
FOR /F "tokens=*" %%A IN ('dumphex /S462 /L16 /nc %Imgname% 2^>nul') DO (
SET Entry462=%%A
SET Entry462=!Entry462:~10,48!
SET Entry462=!Entry462: =!
SET Entry462_LengthHex=!Entry462:~30,2!!Entry462:~28,2!!Entry462:~26,2!!Entry462:~24,2!
SET /A Entry462_Length=0x!Entry462_LengthHex!
)
ECHO Now the extent of the FAT12 partition is %Entry462_Length%
ECHO We need to multiply this value by 8
SET /A Entry462_Length=%Entry462_Length%*8
CALL :decwrite 0x01DA %Entry462_Length% 4
ECHO Now the extent of the FAT12 partition is %Entry462_Length%

 

 

These two edits should allow you to go further in the creation of the dual mode disk.

In the meantime I will think about a way to pass the value wanted needed from mkprilog.cmd to mkdualdisk.cmd in a more "proper" or "sensible" way.

 

jaclaz

 

 



#113
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

OK, now getting this -

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\windows\system32>cd\mkprilog

C:\MkPriLog>mkprilog
please input an approximated size in Megabytes for the FAT12 partition, minimum
1, maximum 32...
The image will be created in the same folder as this batch
and will be named PriLog.img

32
Writing MBR at offset 0 ...
... done.
... done.
Writing the 512 bytes/sector bootsector BPB at offset 32768 ...
BS512_Res=456
BS512_SBef=64
BS512_Sectors=65472
BS512_SpF=32
... done.
... done.
Writing the 4096 bytes/sector bootsector BPB at offset 262144...
... done.
Writing FAT tables incipit ...
... done.
Base address of EPBR 512 is 4190208
Base address of EPBR 4Kb is 33521664
Press any key to continue . . .
.
The image should have been created as PriLog.img, now you need to
manually dd it to the destination disk, a suitable command would be:
dsfi.exe \\.\PhysicalDrive[n] 0 0 PriLog.img
Make sure that you use the RIGHT Disk Number [n], do check in Disk Manager.
The disk can be mounted indifferently through the 4kb or the 512
bytes/sector interface to deploy the image.
Once the image has been deployed you may need to disconnect and reconnect the
disk to have the FAT12 volume be recognized and mounted.
Then you can go to Disk Manager and create a Primary partition, NTFS formatted
extending on all the available space on disk (or on just a portion of it).
It is "better" to use a Vista (or later) OS to create the NTFS partition
The partition would be better if Megabyte aligned.
(or do it manually or use a suitable third-party tool) as the XP will align it
on head/cylinder boundaries, whilst a MB-aligned partition will be faster on
slow buses such as USB 2.0
The partition and the NTFS filesystem MUST be created when the disk is connected
 as
a 4kb sectored device, this is NOT negotiable.
Once the second partition has been created, and I repeat, this MUST be done
with the device connected as 4kb sectored, you can run the mkdualdisk.cmd
Which will modify the disk and create the needed EPBR's.

C:\MkPriLog>dsfi \\.\PhysicalDrive1 0 0 PriLog.img
OK, written 33554432 bytes at offset 0

C:\MkPriLog>mkdualdisk
"DUAL" disk found as \\.\PHYSICALDRIVE1

Creating a temporary copy of the MBR
OK, 4096 bytes, 0.032s, MD5 = dde5a655ffb6537e52cf7d354f811bdf

Now the extent of the FAT12 partition is 8128
We need to multiply this value by 8
Offset 474=0x00,0xFE,0x00,0x00
Now the extent of the FAT12 partition is 65024
000001B8h: 44 55 41 4C DUAL
000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00
000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 00 FE 00 00
000001DEh: 00 82 03 00 07 FE FF FF 00 20 00 00 00 EB 8D 0E
000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Condition #1, PriLog=1
Condition #1, PriLog=2
Condition #1, PriLog=2
Condition #1, PriLog=2
Condition #1, PriLog=3
Condition #1, PriLog=4
Entry446=000000000F0000003F00000001000000
Entry446_Length=1
Entry446_LengthHex=00000001
Entry446_Start=63
Entry446_StartHex=0000003F
Entry446_Type=0F
Entry462=00000000010000004000000000FE0000
Entry462_Length=65024
Entry462_LengthHex=0000FE00
Entry462_Start=64
Entry462_StartHex=00000040
Entry462_Type=01
Entry478=0082030007FEFFFF0020000000EB8D0E
Entry478_Length=244181760
Entry478_LengthHex=0E8DEB00
Entry478_Start=8192
Entry478_StartHex=00002000
Entry478_Type=07
Entry494=00000000000000000000000000000000
Entry494_Length=0
Entry494_LengthHex=00000000
Entry494_Start=0
Entry494_StartHex=00000000
Entry494_Type=00
sum462=65088
by8=65536
by8XP=65032
The disk was NOT recognized as being created with the known schemes
Press any key to continue . . .

C:\MkPriLog>

:) 


Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#114
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Typo :blushing: (actually missing operands :w00t:) in the proposed edit, this (part of the lines added to mkdualdisk.cmd):

ECHO Now the extent of the FAT12 partition is %Entry462_Length%
ECHO We need to multiply this value by 8
SET /A Entry462_Length=%Entry462_Length%*8


Should really be:

ECHO Now the extent of the FAT12 partition is %Entry462_Length%
ECHO We need to multiply this value  by 8, once increased by 64, and then subtract 64
SET /A Entry462_Length=(%Entry462_Length%+64)*8-64

 

 

jaclaz 


Edited by jaclaz, Yesterday, 10:02 AM.


#115
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

OK, after the modification everything seemed to go through OK.

No UAC prompts (USB connected Windows 8.1)!

:thumbup



Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\windows\system32>cd\mkprilog

C:\MkPriLog>mkdualdisk
"DUAL" disk found as \\.\PHYSICALDRIVE1

Creating a temporary copy of the MBR
OK, 4096 bytes, 4.813s, MD5 = dde5a655ffb6537e52cf7d354f811bdf

Now the extent of the FAT12 partition is 8128
We need to multiply this value by 8, once increased by 64, and then subtract 64
Offset 474=0xC0,0xFF,0x00,0x00
Now the extent of the FAT12 partition is 65472
000001B8h: 44 55 41 4C DUAL
000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00
000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 C0 FF 00 00
000001DEh: 00 82 03 00 07 FE FF FF 00 20 00 00 00 EB 8D 0E
000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Condition #1, PriLog=1
Condition #1, PriLog=2
Condition #1, PriLog=3
Condition #1, PriLog=3
Condition #1, PriLog=4
Condition #1, PriLog=5
Entry446=000000000F0000003F00000001000000
Entry446_Length=1
Entry446_LengthHex=00000001
Entry446_Start=63
Entry446_StartHex=0000003F
Entry446_Type=0F
Entry462=000000000100000040000000C0FF0000
Entry462_Length=65472
Entry462_LengthHex=0000FFC0
Entry462_Start=64
Entry462_StartHex=00000040
Entry462_Type=01
Entry478=0082030007FEFFFF0020000000EB8D0E
Entry478_Length=244181760
Entry478_LengthHex=0E8DEB00
Entry478_Start=8192
Entry478_StartHex=00002000
Entry478_Type=07
Entry494=00000000000000000000000000000000
Entry494_Length=0
Entry494_LengthHex=00000000
Entry494_Start=0
Entry494_StartHex=00000000
Entry494_Type=00
sum462=65536
by8=65536
by8XP=65032
The disk was recognized as created with the Prilog scheme

Creating a temporary copy of the NTFS partition bootsector
OK, 4096 bytes, 0.016s, MD5 = 449a1256e3e767410c50d27131c80921

Press any key to continue . . .

Creating a copy of the 4kb bytes/sector NTFS bootsector
And modifying it to become the 512 bytes/sector NTFS bootsector
Offset 11=0x00,0x02,0x08
Offset 28=0x00,0x00,0x01,0x00
Offset 40=0xF8,0x57,0x6F,0x74
OK, 4096 bytes, 0.000s, MD5 = e60735c779a4b11d0b454ba626c6a42b

Press any key to continue . . .
Creating a copy of the 4kb bytes/sector EPBR
and writing to it the values for the NTFS volume
OK, 4096 bytes, 0.000s, MD5 = fc86b746e3b8c6f0108aaf1a1ac6271a
Offset 450=0x07
Offset 454=0xC1,0x1F,0x00,0x00
Offset 458=0x00,0xEB,0x8D,0x0E

Creating a copy of the 512 bytes/sector EPBR
and writing to it the values for the NTFS volume
OK, 4096 bytes, 0.016s, MD5 = 620f0b67a91f7f74151bc5be745b7110
Offset 4034=0x07
Offset 4038=0xC1,0xFF,0x00,0x00
Offset 4042=0x00,0x58,0x6F,0x74

Press any key to continue . . .


If you are on Vista or later you may need to authorize three times
the writes to disk (UAC prompt)

Press any key to continue . . .
OK, written 4096 bytes at offset 0
OK, written 4096 bytes at offset 29672
OK, written 4096 bytes at offset 258048

C:\MkPriLog>

Will try the actual switching process later on and report back on that.

:)


Edited by Dave-H, Yesterday, 01:13 PM.

Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#116
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

OK, after the modification everything seemed to go through OK.

No UAC prompts (USB connected Windows 8.1)!

:thumbup...

 

Will try the actual switching process later on and report back on that.

:)

Good. :)

I am still thinking about the *need* of a suitable way to have the mechanism work, now that the issue has been found, in a more "consistent" way or if it is ok, as it seems, to leave the bootsector with the 4Kb value at the end of mkprilog.cmd and convert it to 512 byte value at the start of mkdualdisk.cmd. :unsure:

 

I could of course make sure about which value (the 512 or the 4 Kb) to write to the MBR by getting it from either bootsectors written in  the image, but in order to do so I would need to access (and thus make a temporary copy) of the one or the other, while till now, we make only a temporary copy of the MBR for the checks which is "more elegant" (provided that a half-@§§ed batch can be defined elegant).

 

In theory I could also "unify" the mkprilog.cmd and the mkdualdisk.cmd into a single batch, but I would need to "insert" between the two a set of diskpart commands, to create automagically the second NTFS partition, something that may (or may be not) a good idea, as it would greatly limit the freedom of the user, which may well decide to make instead of the huge NTFS partition spanning the whole disk - say - two more NTFS partitions, one only readable/accessible when on 512 b/s device and one only readable/accessible when on 4096 b/s device.

 

Anyway for the moment let's see if the "end result", as is, works fine.

 

jaclaz 


Edited by jaclaz, Yesterday, 01:36 PM.


#117
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

Sorry to report that the switching function isn't working.

:no:

I went over to the eSATA connected machine, ran the switcher from the files in the 31.6 MB drive, which appeared OK, and just got -

 

"Attempting to mount the the NTFS volume to drive J:", followed by "The parameter is incorrect".

 

This was just repeated over and over again until I shut down the command prompt.

 

I then went back to the USB connected machine, and ran the switcher again, with the same result (although it said drive H: instead of drive J:, as expected), so I've now lost access to the big partition completely!

 

Disk Management on the eSATA machine is showing it as unallocated, on the USB machine it's showing as a primary partition with no drive letter assigned.

If I try and look at its properties I get an error message about the Disk Management console view not being up to date, which doesn't go away if I refresh or restart it.

:(


Edited by Dave-H, Yesterday, 01:59 PM.

Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.


#118
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,005 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Good (I mean bad of course) :(.

We will need to troubleshoot the switcher.cmd.

 

On the USB machine you should be able to assign to it a drive letter manually, however.

 

In the switcher.cmd, edit this:

 

ECHO Attempting to mount the NTFS volume to drive %FirstFree%
MOUNTVOL %FirstFree% \\?\%SecondVolumeID%\
GOTO :mountcheck

 

to 

ECHO Attempting to mount the NTFS volume to drive %FirstFree%
MOUNTVOL %FirstFree% \\?\%SecondVolumeID%\

SET First

SET Second

SET Start

SET Mounted

SET As

PAUSE
GOTO :mountcheck

 

 

The issue is likely to be in the previous code that attempts to use WMI and/or REG.EXE  ....

 

 

jaclaz



#119
Dave-H

Dave-H

    Friend of MSFN

  • MSFN Sponsor
  • 959 posts
  • Joined 04-January 06
  • OS:98SE
  • Country: Country Flag

OK, running switcher from an elevated prompt on the eSATA machine I'm now getting -







Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>i:

I:\>switcher
"DUAL" disk found as \\.\PHYSICALDRIVE5

OK, NTFS volume is mounted to drive J:
and it uses a 512 bytes/sector interface

Current NTFS bootsector is NOT the 512 bytes/sector one.

Do you want to switch to the 512 bootsector? [Y/N]y
If you are on Vista or later you may need to authorize the copy (UAC prompt).
OK, written 4096 bytes at offset 0
Press any key to continue . . .

I:\>

It's still not actually mounting the other drive though.

:no:

I'm seeing this in Disk Management, which doesn't look too good.

 

Attached File  DiskManagement.jpg   113.41KB   0 downloads

Drive J: appears as an unformatted drive in Explorer.


Edited by Dave-H, Yesterday, 05:42 PM.

Triple boot Windows 98SE SP2.1a, Windows XP Professional SP3 32 bit, and Windows 8.1 Pro 64 bit.
Dual 3.16GHz X5460 Quad Core Xeons with 8GB RAM. Dual graphics cards ATI Radeon X850 and Nvidia Geforce 210. 1920x1080 32 Bit Colour with Large Fonts.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users