Jump to content

Formatting an external drive using different interfaces


Dave-H

Recommended Posts

@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, minimum1, maximum 32...The image will be created in the same folder as this batchand will be named PriLog.img32Writing MBR at offset 0 ...... done.... done.Writing the 512 bytes/sector bootsector BPB at offset 32768 ...BS512_Res=456BS512_SBef=64BS512_Sectors=65472BS512_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 4190208Base address of EPBR 4Kb is 33521664Press 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:

Link to comment
Share on other sites


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
Link to comment
Share on other sites

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.

:)

Link to comment
Share on other sites

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 mkprilogC:\MkPriLog>mkprilogplease input an approximated size in Megabytes for the FAT12 partition, minimum1, maximum 32...The image will be created in the same folder as this batchand will be named PriLog.img32Writing MBR at offset 0 ...... done.... done.Writing the 512 bytes/sector bootsector BPB at offset 32768 ...BS512_Res=456BS512_SBef=64BS512_Sectors=65472BS512_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 4190208Base address of EPBR 4Kb is 33521664Press any key to continue . . ..The image should have been created as PriLog.img, now you need tomanually dd it to the destination disk, a suitable command would be:dsfi.exe \\.\PhysicalDrive[n] 0 0 PriLog.imgMake 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 512bytes/sector interface to deploy the image.Once the image has been deployed you may need to disconnect and reconnect thedisk to have the FAT12 volume be recognized and mounted.Then you can go to Disk Manager and create a Primary partition, NTFS formattedextending 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 partitionThe partition would be better if Megabyte aligned.(or do it manually or use a suitable third-party tool) as the XP will align iton head/cylinder boundaries, whilst a MB-aligned partition will be faster onslow buses such as USB 2.0The partition and the NTFS filesystem MUST be created when the disk is connected asa 4kb sectored device, this is NOT negotiable.Once the second partition has been created, and I repeat, this MUST be donewith the device connected as 4kb sectored, you can run the mkdualdisk.cmdWhich will modify the disk and create the needed EPBR's.C:\MkPriLog>dsfi \\.\PhysicalDrive1 0 0 PriLog.imgOK, written 33554432 bytes at offset 0C:\MkPriLog>mkdualdisk"DUAL" disk found as \\.\PHYSICALDRIVE1Creating a temporary copy of the MBROK, 4096 bytes, 0.031s, MD5 = c5e2a6e6a72dd713bde01cef7939e4dd000001B8h: 44 55 41 4C DUAL000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 C0 FF 00 00000001DEh: 00 14 11 04 07 FE FF FF 00 00 01 00 00 0B 8D 0E000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00The disk was NOT recognized as being created with the known schemesPress 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.

:)

Link to comment
Share on other sites

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 Entry4SET sumSET by

jaclaz

Link to comment
Share on other sites

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 MkPriLogC:\MkPriLog>mkdualdisk"DUAL" disk found as \\.\PHYSICALDRIVE1Creating a temporary copy of the MBROK, 4096 bytes, 4.828s, MD5 = c5e2a6e6a72dd713bde01cef7939e4dd000001B8h: 44 55 41 4C DUAL000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 C0 FF 00 00000001DEh: 00 14 11 04 07 FE FF FF 00 00 01 00 00 0B 8D 0E000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Condition #1, PriLog=1Condition #1, PriLog=2Condition #1, PriLog=2Condition #1, PriLog=2Condition #1, PriLog=3Condition #1, PriLog=4Entry446=000000000F0000003F00000001000000Entry446_Length=1Entry446_LengthHex=00000001Entry446_Start=63Entry446_StartHex=0000003FEntry446_Type=0FEntry462=000000000100000040000000C0FF0000Entry462_Length=65472Entry462_LengthHex=0000FFC0Entry462_Start=64Entry462_StartHex=00000040Entry462_Type=01Entry478=0014110407FEFFFF00000100000B8D0EEntry478_Length=244124416Entry478_LengthHex=0E8D0B00Entry478_Start=65536Entry478_StartHex=00010000Entry478_Type=07Entry494=00000000000000000000000000000000Entry494_Length=0Entry494_LengthHex=00000000Entry494_Start=0Entry494_StartHex=00000000Entry494_Type=00sum462=65536by8=524288by8XP=523784The disk was NOT recognized as being created with the known schemesPress any key to continue . . .C:\MkPriLog>

Hope that helps!

:)

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

OK, now getting this -

Microsoft Windows [Version 6.3.9600](c) 2013 Microsoft Corporation. All rights reserved.C:\windows\system32>cd\mkprilogC:\MkPriLog>mkprilogplease input an approximated size in Megabytes for the FAT12 partition, minimum1, maximum 32...The image will be created in the same folder as this batchand will be named PriLog.img32Writing MBR at offset 0 ...... done.... done.Writing the 512 bytes/sector bootsector BPB at offset 32768 ...BS512_Res=456BS512_SBef=64BS512_Sectors=65472BS512_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 4190208Base address of EPBR 4Kb is 33521664Press any key to continue . . ..The image should have been created as PriLog.img, now you need tomanually dd it to the destination disk, a suitable command would be:dsfi.exe \\.\PhysicalDrive[n] 0 0 PriLog.imgMake 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 512bytes/sector interface to deploy the image.Once the image has been deployed you may need to disconnect and reconnect thedisk to have the FAT12 volume be recognized and mounted.Then you can go to Disk Manager and create a Primary partition, NTFS formattedextending 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 partitionThe partition would be better if Megabyte aligned.(or do it manually or use a suitable third-party tool) as the XP will align iton head/cylinder boundaries, whilst a MB-aligned partition will be faster onslow buses such as USB 2.0The partition and the NTFS filesystem MUST be created when the disk is connected asa 4kb sectored device, this is NOT negotiable.Once the second partition has been created, and I repeat, this MUST be donewith the device connected as 4kb sectored, you can run the mkdualdisk.cmdWhich will modify the disk and create the needed EPBR's.C:\MkPriLog>dsfi \\.\PhysicalDrive1 0 0 PriLog.imgOK, written 33554432 bytes at offset 0C:\MkPriLog>mkdualdisk"DUAL" disk found as \\.\PHYSICALDRIVE1Creating a temporary copy of the MBROK, 4096 bytes, 0.032s, MD5 = dde5a655ffb6537e52cf7d354f811bdfNow the extent of the FAT12 partition is 8128We need to multiply this value by 8Offset 474=0x00,0xFE,0x00,0x00Now the extent of the FAT12 partition is 65024000001B8h: 44 55 41 4C DUAL000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 00 FE 00 00000001DEh: 00 82 03 00 07 FE FF FF 00 20 00 00 00 EB 8D 0E000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Condition #1, PriLog=1Condition #1, PriLog=2Condition #1, PriLog=2Condition #1, PriLog=2Condition #1, PriLog=3Condition #1, PriLog=4Entry446=000000000F0000003F00000001000000Entry446_Length=1Entry446_LengthHex=00000001Entry446_Start=63Entry446_StartHex=0000003FEntry446_Type=0FEntry462=00000000010000004000000000FE0000Entry462_Length=65024Entry462_LengthHex=0000FE00Entry462_Start=64Entry462_StartHex=00000040Entry462_Type=01Entry478=0082030007FEFFFF0020000000EB8D0EEntry478_Length=244181760Entry478_LengthHex=0E8DEB00Entry478_Start=8192Entry478_StartHex=00002000Entry478_Type=07Entry494=00000000000000000000000000000000Entry494_Length=0Entry494_LengthHex=00000000Entry494_Start=0Entry494_StartHex=00000000Entry494_Type=00sum462=65088by8=65536by8XP=65032The disk was NOT recognized as being created with the known schemesPress any key to continue . . .C:\MkPriLog>

:) 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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\mkprilogC:\MkPriLog>mkdualdisk"DUAL" disk found as \\.\PHYSICALDRIVE1Creating a temporary copy of the MBROK, 4096 bytes, 4.813s, MD5 = dde5a655ffb6537e52cf7d354f811bdfNow the extent of the FAT12 partition is 8128We need to multiply this value by 8, once increased by 64, and then subtract 64Offset 474=0xC0,0xFF,0x00,0x00Now the extent of the FAT12 partition is 65472000001B8h: 44 55 41 4C DUAL000001BEh: 00 00 00 00 0F 00 00 00 3F 00 00 00 01 00 00 00000001CEh: 00 00 00 00 01 00 00 00 40 00 00 00 C0 FF 00 00000001DEh: 00 82 03 00 07 FE FF FF 00 20 00 00 00 EB 8D 0E000001EEh: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Condition #1, PriLog=1Condition #1, PriLog=2Condition #1, PriLog=3Condition #1, PriLog=3Condition #1, PriLog=4Condition #1, PriLog=5Entry446=000000000F0000003F00000001000000Entry446_Length=1Entry446_LengthHex=00000001Entry446_Start=63Entry446_StartHex=0000003FEntry446_Type=0FEntry462=000000000100000040000000C0FF0000Entry462_Length=65472Entry462_LengthHex=0000FFC0Entry462_Start=64Entry462_StartHex=00000040Entry462_Type=01Entry478=0082030007FEFFFF0020000000EB8D0EEntry478_Length=244181760Entry478_LengthHex=0E8DEB00Entry478_Start=8192Entry478_StartHex=00002000Entry478_Type=07Entry494=00000000000000000000000000000000Entry494_Length=0Entry494_LengthHex=00000000Entry494_Start=0Entry494_StartHex=00000000Entry494_Type=00sum462=65536by8=65536by8XP=65032The disk was recognized as created with the Prilog schemeCreating a temporary copy of the NTFS partition bootsectorOK, 4096 bytes, 0.016s, MD5 = 449a1256e3e767410c50d27131c80921Press any key to continue . . .Creating a copy of the 4kb bytes/sector NTFS bootsectorAnd modifying it to become the 512 bytes/sector NTFS bootsectorOffset 11=0x00,0x02,0x08Offset 28=0x00,0x00,0x01,0x00Offset 40=0xF8,0x57,0x6F,0x74OK, 4096 bytes, 0.000s, MD5 = e60735c779a4b11d0b454ba626c6a42bPress any key to continue . . .Creating a copy of the 4kb bytes/sector EPBRand writing to it the values for the NTFS volumeOK, 4096 bytes, 0.000s, MD5 = fc86b746e3b8c6f0108aaf1a1ac6271aOffset 450=0x07Offset 454=0xC1,0x1F,0x00,0x00Offset 458=0x00,0xEB,0x8D,0x0ECreating a copy of the 512 bytes/sector EPBRand writing to it the values for the NTFS volumeOK, 4096 bytes, 0.016s, MD5 = 620f0b67a91f7f74151bc5be745b7110Offset 4034=0x07Offset 4038=0xC1,0xFF,0x00,0x00Offset 4042=0x00,0x58,0x6F,0x74Press any key to continue . . .If you are on Vista or later you may need to authorize three timesthe writes to disk (UAC prompt)Press any key to continue . . .OK, written 4096 bytes at offset 0OK, written 4096 bytes at offset 29672OK, written 4096 bytes at offset 258048C:\MkPriLog>

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

:)

Edited by Dave-H
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 \\.\PHYSICALDRIVE5OK, NTFS volume is mounted to drive J:and it uses a 512 bytes/sector interfaceCurrent NTFS bootsector is NOT the 512 bytes/sector one.Do you want to switch to the 512 bootsector? [Y/N]yIf you are on Vista or later you may need to authorize the copy (UAC prompt).OK, written 4096 bytes at offset 0Press 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.

 

post-84253-0-59259700-1422229228_thumb.j

Drive J: appears as an unformatted drive in Explorer.

Edited by Dave-H
Link to comment
Share on other sites

Well, the first issue is then related to Mountvol needing to be run elevated, which we should be able to fix by going from 

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%\ || elevate.exe MOUNTVOL %FirstFree% \\?\%SecondVolumeID%\
GOTO :mountcheck

But it is well possible that there is either an error in other parts of the batch or that the bootsector earlier created (for whatever reasons) has wrong values or has been deployed to a wrong address :w00t::ph34r: though this latter is improbable as the output of the batch is "as expected".

 

What happens if you run again the switcher.cmd?

In theory it could be run any number of times and prompt to  switch only if "the other" bootsector is found.

 

What happens if you put the whole disk offline and then bring it up online again?

It is possible that this additional step is needed to "refresh" the view?

 

Or maybe we are in this condition, where the bootsector is locked by the OS:

http://reboot.pro/topic/8200-grubinstexe-write-failed-vista-ntfs-bootsector/

but it shouldn't happen for the bootsector.

 

Or maybe it is better to revert the logic of the batch, right now it attempts to mount the volume assigning to it a driveletter and then deploys the bootsector, possibly it would be smarter/better to make sure that the volume is not mounted, deploy the bootsector and only then attempt to mount it.

 

However, one thing at the time, let's first check if by any chance there is an issue with the bootsectors.

Try running:
fc /b as4kbNTFS.bss as512NTFS.bss

and post the output.

 

As well, get the "current" bootsector from the "J:" drive, that would be:

dsfo \\.\J: 0 4096 mycurrent.bss

 

and fc it against either of the two saved bootsectors.

 

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...