Page 1 of 1

Can you change the device# to match Windows Disk Manager's?

Posted: Sat Apr 07, 2012 8:52 am
by rliuap
I just tested the command line utility and it works great!

Only thing that makes it a little hard to use is the device numbers (they look like 4 digits random numbers). Each time I have to run the command line utility with the "l" switch to find out the number first, which is not convienent for use in a batch script (I believe the main purpose for a command line is that it can be used in a script without user intervention).

Can you (Mr. Page) change that to match the disk numbers in Windows Disk MAnagement? Because these numbers are commonly used and available from Windows Disk Management.

I guess that should not be too hard to do but correct me if I am wrong!

Other than that it is a great utility!

Re: Can you change the device# to match Windows Disk Manager

Posted: Sun Apr 08, 2012 3:31 pm
by Alex
Hello,

First of all, I'm not Mr. Page. ;) It's just called Alex's page (like homepage). The 4 digit number is determined by Windows, but stays the same for a device on a single computer. The numbers from Windows disk managed are also not unique. They depend on how many devises are installed or plugged in currently. I can try to offer these numbers as well in the next version.

Re: Can you change the device# to match Windows Disk Manager

Posted: Sun Jul 15, 2012 12:22 am
by rliuap
After repeatedly testing, I found the device numbers listed by the program (command line) are not consistant. The numbers change randomly each time when I plugged in a USB drive. You may verify this by running "usbitcmd l /d" each time you plug in a USB drive. Here is how I tested:

When I plugged in the first USB drive (formatted with a non-supported file system by Windows such as ext2. The program does not show its drive letter, althought Windows 7 does assign it a drvie letter E: in Explorer that reports the drive as unformatted), I got a device number 2204 as shown below:

C:\Windows\system32>usbitcmd l /d

USB Image Tool 1.58
COPYRIGHT 2006-2011 Alexander Beug
http://www.alexpage.de

Device | Friendly Name | Volume Name | Volume Path | Size
------------------------------------------------------------------------------
2204 | Kingston DataTraveler G3 | | | 3822 MB



After I plugged in second USB drive (of the same ext2 format) and ran the program again, I got a new device number (2400) added to the list (the second drive got drive letter F: in Windows Explorer but still reported as unformatted). Although I am not absolutely sure which number represents which drive, I can assume the new number represents the seconcd drive (F:). So far so good:

C:\Windows\system32>usbitcmd l /d

USB Image Tool 1.58
COPYRIGHT 2006-2011 Alexander Beug
http://www.alexpage.de

Device | Friendly Name | Volume Name | Volume Path | Size
------------------------------------------------------------------------------
2204 | Kingston DataTraveler G3 | | | 3822 MB
2400 | Kingston DataTraveler G3 | | | 3822 MB



The interesting things happened after I plugged in the third USB drive (it was still the same type of the Kingston drives but formatted with FAT, a file system that Windows supports). When I ran "usbitcmd l /d" again, it showed the third drive on the first line with a drive letter G:(see the output below).

However, the thing that really bothered me is that the third dirve (G:) I just plugged in is now taking over the device number (2204) that was initially assigned to the first drive (E:); and the first and the second drives have been now each assigned a new number (2376 and 2572) respectively. The number 2400 that was originall assigned to the second drive (F:) is now gone (disappeared)! I have now no way to tell which of the two new numbers is representing for the first drive (E:) and which is for the second drive (F:) because each of the two drives now has a new device number with no drive letter being showed. But I know for sure the third drive is now represented by number 2204 (the number that had been for the first drive) because it is the only drive the program shows its drive letter (G:) and it was supposed so since it was formatted with FAT.

The problem of this behavior of the program is that I got lost to identify the first and the second drive by their device numbers. Now I would like to create an image off the first drive and apply that image to the second drive but I do not know which drive is the first drive I plugged in and which one is the second. What should I do?

C:\Windows\system32>usbitcmd l /d

USB Image Tool 1.58
COPYRIGHT 2006-2011 Alexander Beug
http://www.alexpage.de

Device | Friendly Name | Volume Name | Volume Path | Size
------------------------------------------------------------------------------
2204 | Kingston DataTraveler G3 | | G:\ | 3822 MB
2376 | Kingston DataTraveler G3 | | | 3822 MB
2572 | Kingston DataTraveler G3 | | | 3822 MB



Again, Alex I strongly recommend you use Windows disk numbers to represent drives (or at least provide a mapping between Windows disk numbers and your numbers). Windows disk numbers are unique and consistant (at least they do not change as you plug/unplug other drives. It might change when you unplug and replug in the drive. In fact, in my other tests, a drive unplugged would be reassigned the same disk number when replugged in if the number is still available). The device numbers used in your program changes randomly as you plug in more drives (as proved above) and it is very hard to keep track of those numbers in real time unless you run the list command every time you plug or unplug a drive, which makes the program hard to use and limits its popularity (it is however a really nice program!).

I will keep yelling on this until you make the change :x !

Thanks a lot for your nice work ;) !

Re: Can you change the device# to match Windows Disk Manager

Posted: Sun Jul 15, 2012 12:57 pm
by Alex
Yes, these number may not be consistent and were not intended to be. I just use them as Windows provides them. I don't know which numbers exactly you mean by Windows disk numbers. If you mean those, that are assigned in device management, they are just numbers from zero to 1, 2, 3 ... ? So the flash drive, that gets plugged in first would get number 3 for example, but when you plug in anouther flash drive frist, it would get the number 3 as well. I could make a hash out of device and serial number, which would be unique enough, I suppose.

Re: Can you change the device# to match Windows Disk Manager

Posted: Sun Jul 15, 2012 3:20 pm
by rliuap
Yes, I meant the disk numbers from Windows Disk Managment. Those numbers are widely and foremost used by Windows APIs and other applications (like DD for Windows, Flashnul and so on) to identify disks. They are unique (by that I mean there are no two disks sharing the the same number at the same time and your numbers are also unique in terms of this); and consistent (by that I mean a disk number will never change during the same Windows session as long as the disk is connected. Your numbers change as more drives are plugged in as shown in my last post, which makes it hard to keep track of those numbers). Yes, a disk may get the same disk number (for example, 3) previouly used by another disk but this only happens when the other disk is no longer present (disconnected), which does not cause any problems other than releasing the number for reuse, just like a drive letters can be reassigned to another drive if the drive previously used the same drive letter is no longer connected.

You mentioned a couple of times that your numbers are provided by Windows. I tried searching the registry and Googling online and was unable to find where these numbers come from or how they are generated. Maybe you can post a clue.

I do not think making a hash out of device and serial number (to make it unique enough) will help. Your numbers are already unique (there are no two disks sharing the same number at the same time as with Windows disk numbering). The problem is that they are not consistent during the same Windows or even during the same application session and you do not know the changes unless you run the list command. Even though you know the numbers have changed, you may still get lost on which number represent which drive if the program does not show drive letters due to unrecoganized file systems like in my ext2 case previously posted, while one of the main purposes of using imaging software (like usbitcmd) is to duplicate dirves with unknown or unrecoganized file systems.

You had mentioned in your first reply to my post that you could try to offer these (Windows disk) numbers as well in the next version. Are you still planning so? Can that be technically done? I am in hope with that (a simple mapping between Windows disk numbers and your numbers will clear everything up)!

Again, my point is: an ID assigned to a disk should not change as long as the disk is connected, just like a drive letter should not change as long as the drive is connected.

Thank you for your quick reply!

Re: Can you change the device# to match Windows Disk Manager

Posted: Sun Jul 15, 2012 3:33 pm
by Alex
Technically it can be done. Internally I already use this number, so I will add it for the next version.

Re: Can you change the device# to match Windows Disk Manager

Posted: Tue Jul 17, 2012 1:37 am
by rliuap
That would be great and I will look forward for it! In fact, it would be more flexible if users could use disk numbers for device mode, drive letters or your device numbers for non-device mode to identify the drives.

Thanks!

Re: Can you change the device# to match Windows Disk Manager

Posted: Thu Feb 21, 2013 9:43 pm
by Alex
implemented with version 1.60 (command line tool)