Wednesday, December 17, 2008

Of Flash drives and Windows XP...Part II

Part I can be found here.

This part contains the workarounds !

How to fool Windows into thinking that the removable drive is a local disk :

This solution has been copied from here

I am posting the solution here too, just because its difficult to find the solution on that page :P.

Nearly all USB flash drives pretend to have a removable media (even it's a lie), so Windows detects them as 'removable'. On drives with a removable media Windows 2000 and higher supports only one partition.
Finally it's a single bit in the device's device descriptor, the removable media bit (RMB). If you take away the RMB then Windows sees the drive as 'local disk' and multiple partitions work.
The Removable Media Bit can be changed either in the drive's hardware or by a Windows filter driver.
Changing in the hardware works with some flash drives by means of the tool Lexar BootIt.

But this works only with some pen-drvies. It DID NOT work for me.

The second way to do this ...

A filter driver for removing the RMB has been made by Hitachi for their Microdrives (Compatct Flash cards with a mini harddrive):

xpfildrvr1224_320.zip

By modifying the included INF file the filter driver can be used with any other 'removable' drive.
For the device detection there are the lines in section [cfadisk_device]:

[cfadisk_device]
%Microdrive_devdesc% = cfadisk_install,IDE\DiskIBM-DSCM-11000__________________________SC2IC801

"IDE\DiskIBM-DSCM-11000__________________________SC2IC801" is the device ID of one of the supported Microdrives.

In analogy to these lines we add one line for each 'removable' USB drive we want to turn into an USB hard drive. The ID is found in the Windows device management: Expand 'Disk drives', right click your USB drive, select Properties. On the tab "Details" under XP the item "Device instance ID" is already selected. Click on the ID in the List and press Ctrl+C, this copies the ID into the Windows Clipboard and can be pasted somewhere else with Ctrl+V.
XP shows the tab "Details" only when the environment variable DEVMGR_SHOW_DETAILS=1 is set:
DevMgr_Show_1.reg download and doubleclick the file, then relogon to take effect.

Sample:
USBSTOR\DISK&VEN_LEXAR&PROD_JUMPDRIVE&REV_1.30\K326441127040&0
We need the fat part:

[cfadisk_device]
%Microdrive_devdesc% = cfadisk_install,USBSTOR\DISK&VEN_LEXAR&PROD_JUMPDRIVE&REV_1.30

In the last line of the INF file we change "Hitachi Microdrive" into something nice as "RemovableToFixed".

In the device manager again right-click the USB drive, "Update driver...", then "No, not this time" -> Next -> "Install from a list or..." -> Next -> "Don't search." -> Next -> "Have Disk" -> browse to the INF file here. Now "RemovableToFixed" should be in the list -> Next -> Confirm the two warnings -> Finish.
Now the drive is re-detected, actually as USB hard drive. The drive can be partitioned, and all the existing partitions are visible and usable.

Now, this solution works with all the USB flash drives. But the problem is that since this method requires installing a custom driver, the pen-drive is detected as a local disk only on the machine that uses that driver. All the other machines detect it as a removable drive. This essentially defeats the purpose of using a pen-drive !!

Re-arrangement of partitions :

This hasn't been copied from anywhere :P.

What i realized was that only the 1st physical partition was being assigned a letter. So i re-arranged the partitions within the flash drive as follows :

1) 2111 MB NTFS (for general use)
2)1024 MB ext2 ( for persistence)
3)700 MB FAT32, bootable.

This made the NTFS partition visible from Windows and i could use my flash drive as if it were a ~2 GB pen-drive.

Looking back, I actually liked this solution, since, whenever I use my pen-drive in the college, the viruses wont be able to mess up the FAT32 bootable partition ! and when I use Linux, all 3 partitions are being mounted anyway. The flip side was that sharing data between the partitions was impossible with Windows XP.....

So as it turned out, there is no concrete solution to using Flash drives with multiple partitions with Windows XP....just some workarounds, each with its pros and cons....

So what do you do if you wanna use a Flash drive with multiple partitions ? .....Use Linux :-)

2 comments:

  1. the rearrangement part is the best solution ... and u cant change much data on the 700mb partition as it has the ubuntu cd data...so i guess sharing data is out of the question...and yes the viruses part is imp...however more than 3 partitions and we are windowed in a way :P

    anyways .. good post..

    PS:: nice way to make people visit 2 posts for the same thing :P :D

    ReplyDelete
  2. @CDK
    i had composed only 1 post, but it turned out to be tooo long....so i broke it into 2

    ReplyDelete