How are DOS drive letters assigned to disk partitions?

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

How are DOS drive letters assigned to disk partitions?

Postby Laaca » Fri May 14, 2010 9:35 pm

Well, it is not question about USB but I think you faced this problem too.

I want to improve the fileselector in my program. The point is drive selecting dialog. Now it displays all DOS drives but I want to display the non DOS partitions too. (Like hda1, hda2, etc...). But I don't want to display this way the partitions with assigned DOS letter.

Firstly I wanted to read the serial number in all DOS drives via INT21h/AX=6900h and compare it with serial numbers in volume boot records of all found partitions.
Partitions without counterparts would be displayed as hda1...

But I overthought this approach - now I think it is not very reliable.
I think you had to face to this problem too. how to do it better?
(Note that I need to be working with logical partitions and with various external drivers like NTFSDOS or EXT2DOS and so on)
Laaca
 
Posts: 21
Joined: Sun Jul 05, 2009 10:36 pm

Re: How are DOS drive letters assigned to disk partitions?

Postby Bret » Sat May 15, 2010 2:04 am

I know others have tried to do this, but I'm not sure anyone has figured out a fool-proof way. Unfortunately, DOS does not provide a direct way to determine which physical disk a logical drive letter is on. That's actually a good thing about DOS, since it allows for things like network drives and RAM disks that don't have physical attributes at all.

One thing people have done in the past is to trap INT 13h, and the issue a DOS call to read something from the disk (like an INT 25h or INT 21h) and monitor what parameters are passed to INT 13h. Of course, this will only work if the DOS device driver issues an INT 13h call to access the disk, which all of the "standard" ones do. The current version of USBDRIVE does not do that, though I intend to make a future version that does (so the USB disks will work correctly with INT 13h-based disk caching programs). That could be a good first step, though.

To find the logical -> physical relationship for USBDRIVE-provided disks, you could compare a sector (or several sectors) of the disk accessed using INT 13h and compare the contents to the same sector(s) accessed using INT 25h (or some other INT 21h call that accessed the disk).

If you're wanting to do something with disks that don't have an INT 13h interface, I don't know what to tell you.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: How are DOS drive letters assigned to disk partitions?

Postby brandonmarkings » Thu Oct 27, 2011 1:57 am

I've tried to format my external hard drive about 3 times already, but I keep getting a "Format failed to complete" or "Format failed" message each time.

- My hard drive has a drive letter (M:) but has no file system. It shows up in My Computer, but each time I try to use the drive, it says, "(M:) is not formatted yet. Would you like to format it now?" It does a "Quick Format" but after about 45 minutes, the failed format message pops up.
- The second time I tried formatting, I used Window's Disk Management. I right clicked on my external hard drive and chose Quick Format but I ended up with the same result.
- For the third time, I tried doing so through DOS. I was relieved to see the progress bar reach 100%. However, after it told me to put in a new volume label, DOS gave me a message that said "Format failed."

There was actually a fourth attempt, but it stalled at 5% since I did a "regular format" so I just cancelled it. It was late and I didn't want to leave my computer on overnight.

I'm actually using an external enclosure that holds my old 40GB internal drive. I've searched for solutions online, but none happen to work for me. I'm trying to format to NTFS, by the way. If I format to FAT32, do you think I'll have better luck at formatting? I'm using Windows XP Home Professional SP3. Any tips and advice is really appreciated!
brandonmarkings
 
Posts: 5
Joined: Wed Oct 19, 2011 1:51 pm

Re: How are DOS drive letters assigned to disk partitions?

Postby Bret » Thu Oct 27, 2011 2:25 pm

What USB drivers are you using with DOS? Are you really using DOS, or are you just at an NTFS command prompt? They are NOT the same thing!

AFAIK, it's impossible to format anything into NTFS from DOS -- at least I don't know of a program that will do that. Also, at least if were my hard drive, I wouldn't use NTFS. That's just not a good idea on external, removable media -- even MS tells you not to do it.

Also, just to make sure we're using the correct terminology (since it actually matters in formatting), you don't format a hard drive. You format a partition on a hard drive. A hard drive can have many, many partitions, each of which can be formatted in a different way.

If you're really using DOS, you should be able to use my drivers, partition the disk using FDISK (or equivalent), and format the disk using FORMAT (or equivalent). I personally like to use Ranish Partition Manager instead of FDISK and FORMAT, since I think the screen is much easier to understand and it can both partition and format (FAT16 or FAT32) in one program.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM


Return to Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron