Jump to content

Formatting an external drive using different interfaces


Dave-H

Recommended Posts

OK, back again.

I tried this first in Windows XP, simply because that was the OS I was in at the time, and it seemed to work as far as making the small partition with the necessary files on it.

I then realised that I really should have been doing it in Windows 8.1 (being as we're in the 8.1 forum if for no other reason) and changed OS and tried again.

Strangely, it doesn't seem to work in 8.1.

Putting the same command in from the same folder as I did on XP, I now just get an error message -

 

W:\Temp Folder>dsfi \\.\Physicaldrive5 0 0 dualmode.img
\\.\Physicaldrive5 - The system cannot find the file specified.

 

I've tried everything to try and find what the problem is, even tried copying the files to a different folder and trying, but with the same result.

I'm not sure what it's saying it can't find, is it the image file, or is it the drive itself?

Disk 5 is there in Disk Manager OK as 931.51 GB of unallocated space, as it was in XP.

Any ideas?

 

BTW I assume missing the "l" out of your command line was just a typo!

Perhaps you should correct it for the future.

:)

Link to comment
Share on other sites


Yep, missing "l" is a typo  :blushing: corrected in the original post.

 

I don't think that Windows 8/8.x manages PhysicalDrives in any way differently from previous OS versions, at least up to Windows 7 dsfo/dsfi has no issues that I know of. :unsure:

 

Unless there is some kind of issues with UAC, disk protection or *whatever*.

 

Maybe you need to take the disk offline in order to be able to deploy the image to it?

http://www.eightforums.com/tutorials/53106-disk-set-offline-online.html

 

In any case, you can deploy the image under XP and then test the result in Windows 8/8.1, the dsfi commands in the Switcher.cmd do not access the \\.\PhysicalDrive, but the (mounted) volume through it's drive letter, and they should not suffer from the same issue.

 

jaclaz

 

 

 

 

 

 

 

Link to comment
Share on other sites

Why anyone would want to use anything but the latest version of 7-zip on a .7z file is a mistery to me

 

I'm thinking not everyone understands the context behind the set of versions offered by the 7-Zip web site.  There's what appears to be "released" code (9.20) and there's what appears to be "beta" code.  When you realize virtually everything there has always been at pretty much "beta" level, then it becomes more obvious that the latest beta would be the most functional.

 

And without asking around, it's not clear whether the "latest beta" is likely to be less stable than the "released" version either.  Personally, I haven't found any downside to using 9.36.  I didn't realize a 9.38 was made available a week ago.

 

-Noel

Link to comment
Share on other sites

Well I just had to go into Device Manager while trying to troubleshoot another problem, and found that there was a "generic volume" listed in the "other devices" section, with no drivers installed.

I tried updating its drivers, and it found and installed a driver, and the entry disappeared.

Tried the dsfi command again, and this time it apparently worked.

I removed and replaced the disk (eSATA) and Disk Management is now showing a 98MB primary partition, but with no drive letter.

The rest of the drive is still shown as Unallocated.

 

There are no extra drives in the Explorer view.

:)

 

EDIT: Just tried rebooting, no difference.

If I try to do anything with the 98MB partition in Disk Management, an error message pops up saying -

 

"The operation did not complete because the Disk Management console view is not up to date. Refresh the view by using the refresh task. If the problem persists close the Disk Management console, then restart Disk Management or restart the computer."

 

Neither option makes any difference.

:no:

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

Try again on the XP.

Re-deploy the image under XP.

 

What happens when you run the switcher.cmd?

 

Which output do you get?

 

On windows 8.x:

 

What happens when you run the mountvol command?

 

The Switcher.cmd is made with the scope to be run exclusively from the smallish volume that should be *always* mounted and always have a drive letter assigned, if this is not the case, try assigning a drive letter manually with mountvol or in the disk manager.

 

jaclaz

Link to comment
Share on other sites

Before going over to XP, I deleted the 98MB partition in Disk Management.

It disappeared and was replaced with a 12MB partition, marked as "Free Space" (coloured green).

I've deleted that as well, and I'll now try again in XP.

:)

EDIT: Just booted into XP, and the 68KB drive is still there in Explorer, with the four files still on it, although it isn't listed at all in Disk Management, which shows the drive as I left it in 8.1, completely unallocated!

I'll delete it and start again.

:)

EDIT: OK, my next problem is how do I remove a drive that isn't visible in Disk Management?!

EDIT: OK, deleted it using DISKPART!

:yes:

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

Right, have run the dsfi command again, and got two entries in Explorer as expected.

One is a 68KB drive I: and contains the four files.

The other is J: and is reported as un-formatted.

 

Looking in Disk Management the drive now has a 98MB partition marked as drive J: which is a logical drive filling an extended partition, and the rest is Unallocated.

Does that sound as expected?

 

I ran the switcher.cmd and got this -

The disk has been mounted as 512 bytes/sectorThis batch has determined that the first partition on disk withDiskSignature=050C9655has assigned the following VolumeID/Drive Letter:Volume{5607c183-98f3-11e4-8268-00304879f908}=I:While the second partition has the following:Volume{5db4a84f-98d7-11e4-8267-00304879f908}=J:In order to make J: accessible you need to fix the bootsector.You need to type YES to confirm:

Typing "yes" and pressing enter just makes the prompt close, but nothing seems to have changed.

:)

EDIT: Just went back into 8.1, and the new drives are not visible in Explorer.

More worryingly, the Disk Management is showing the drive differently (with the same eSATA interface).

It's showing a 98MB primary partition with no drive letter, with the rest unallocated.

This matches what Windows XP displayed in terms of partition sizes, but not type.

This may mean that this will not work on multi-boot systems, as the different operating systems will see the drive differently.

:(

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

You are trying to do too many things at once, following not the given procedure.

Run the batch.

If you are asked to type YES, type YES.

If you type "yes", the batch will do NOTHING.

You were asked to type "YES" (not "yes").

Try running the batch again.

Type YES if prompted

Then try running it again (the idea is that the batch can be run as many times as you want and if the volume is already with the "right" geometry it will confirm it, while if it is not it will prompt you to switch to the "other" geometry.

 

It is possible that Windows 8.x (for it's own reasons) would not automatically assign a drive letter to the first or the second partition (or both), at least the first time that the disk is connected hence:

 

 

 


On windows 8.x:
 
What happens when you run the mountvol command?
 

 

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

Ah, sorry jaclaz, I wasn't expecting that the commands would be case sensitive!

:blushing:

Done it again using upper case and everything seems to have worked fine with both machines in XP.

I can now access the 98MB partition through either interface just by running the switcher command when I change from one to the other.

:thumbup

Now off to try it in Windows 8.1........

:)

EDIT: OK, back again.

With the machines booted into 8.1, everything is fine on the USB interface (which is how I left it) with both drives and their contents accessible.

On the eSATA interface however I can access the drive with your files on it, but when I run the switcher command and enter "YES" I get an "access is denied" message so I can't switch modes to see the other drive, which reports unformatted.

:no:

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

Good. :)

So the issue here seems to be that either Windows 8.x *somehow* locks the volume or that the dsfi.exe command does not work in Windows 8.x (and this could be due to other reasons), or maybe there is the need to run them as Administrator because the command is UAC (or *whatever*) protected? :unsure:

 

Can you try using another dd-like tool?

 

The general idea behind the batch is to overwrite first 4096 bytes of the second volume, which is on \\PhysicalDriven at LBA 2048) when mounted on a 512 bytes/sector) or at LBA 256 (when mounted on a 4096 bytes/sector) and is in both cases sector 0 of the \\.\LogicalDrive or aboslute offset in bytes 1048576 with either of:

 

as512.bss <- if the disk is seen as 512 bytes/sector
as4kb.bss <- if the disk is seen as 4096 bytes sector

 

So, for the tests, if you make a folder on your "main" drive, say C:\mytemptest and copy to it those two files, you can try the following commands:

on eSATA (where the disk is seen as 512) dsfi \\.\<drive letter> 0 0 as512.bss

on USB (where the disk is seen as 4096) dsfi \\.\<drive letter> 0 0 as4kb.bss

The above are the actual commands that the batch attempts to execute and should give you the same "access denied" error, but try them from a command prompt in "elevated" mode, maybe that is the issue.

Alternative commands are:

 

on eSATA (where the disk is seen as 512) dsfi \\.\Physicaldriven 1048576 0 as512.bss

on USB (where the disk is seen as 4096) dsfi \\.\Physicaldriven 0 1048576 as4kb.bss

Or try with dd for windows:

http://www.chrysocome.net/dd

the syntax will be:

on eSATA (where the disk is seen as 512)

dd if=c:\temptest\as512.bss of=\\.\<drive letter> bs=512

dd if=c:\temptest\as512.bss of=\\.\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} bs=512 <- use dd --list or mountvol to get the Volume x's

dd if=c:\temptest\as512.bss of=\\?\Device\Harddiskm\Partitionbs=512 <- use dd --list or to get the m, n

 

on USB (where the disk is seen as 4096) 

 

dd if=c:\temptest\as4kb.bss of=\\.\<drive letter> bs=4096

dd if=c:\temptest\as4kb.bss of=\\.\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} bs=4096 <- use dd --list or mountvol to get the Volume x's

dd if=c:\temptest\as4kb.bss of=\\?\Device\Harddiskm\Partitionbs=4096 <- use dd --list or to get the m, n

 

jaclaz

Link to comment
Share on other sites

I ran "dsfi \\.\I: 0 0 as512.bss" in an elevated command prompt when in the J: drive where your files are, and it worked, and I can now access drive I: and its contents are intact.

:thumbup

So, it looks as if it's just that the switcher command needs administrative powers.

Right clicking on the switcher.cmd file and selecting "Run as administrator" seems to work fine.

You don't seem to have to do this when using the USB interface.

:yes:

So, can we say now that this is a success?!

:)

EDIT: Spoke slightly too soon.

Going back to the eSATA interface, if I run switcher.cmd as an administrator, it is OK until I enter "YES" to switch the drive back, but I then get -

"dsfi is not a recognised command". I've tried selling dsfi to be always run as an administrator, but that made no difference.

Entering the command line from an already open administrative prompt still works.

 

EDIT: In fact I've just spotted the obvious, running switcher.cmd as an administrator does not open an administrative command prompt, it opens a normal one!

:no:

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

Good :thumbup.

So it is just a matter of detecting if the OS needs Admin privileges to run the dsfi command, and if they are needed, *somehow* elevate the privileges.

 

I am not at all familiar with that UAC nonsense, but I'll have a look around, surely a suitable solution exists :yes:.

 

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

Making a new post so that Dave-H has more chances to notice it (as opposed to editing previous one).

 

Ok.

Get this:

http://code.kliu.org/misc/elevate/

extract the elevate.exe from \elevate-1.3.0-redist.7z\bin.x86-32\ and copy it to the "J:" drive (the very small FAT12 drive).

Edit the Switcher.cmd as follows:

Near the beginning change (add a line):

IF NOT EXIST %~dp0as512.bss GOTO :Missing
IF NOT EXIST %~dp0as4kb.bss GOTO :Missing
IF NOT EXIST %~dp0dsfi.exe GOTO :Missing

IF NOT EXIST %~dp0elevate.exe GOTO :Missing

 

Near the end, change this:

IF "YES"=="%Confirm%" dsfi \\.\%SecondDriveLetter% 0 0 %Source% &GOTO :Check

 

to:

IF "YES"=="%Confirm%" (

dsfi \\.\%SecondDriveLetter% 0 0 %Source%

IF %ERRORLEVEL% equ 0 GOTO :Check

elevate.exe -c -w dsfi \\.\%SecondDriveLetter% 0 0 %Source%

GOTO :check

)

 

jaclaz

Link to comment
Share on other sites

Still getting "Access is denied" I'm afraid.

:no:

I am using the 64bit version of elevate.exe BTW.

 

Looking at what you've written, is this not just running dsfi with elevated permissions?

I'm not sure that's the problem, I think it's the actual disk access that needs higher permissions, not the dsfi command.

:)

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...