How partition USB flash drive?

  • Thread starter Thread starter ME2
  • Start date Start date
M

ME2

I have a 4G USB flash drive that I want to divide into two partitions
in order to try to make the USB bootable then. According to Google
researching, USB flash drives cannot be partitioned if the drive is
identified as removable media, which it is. It also says the only
way to partition a USB flash drive is to flip a 'removable bit' so
that the drive is recognized as fixed media instead which then can be
partitioned like any normal hard drive. The suggested Lexar 'bootit'
doesn't do it - for me anyhow. Anyone care to suggest a different
method to try for this?

Thank you

me
 
I have a 4G USB flash drive that I want to divide into two partitions
in order to try to make the USB bootable then. According to Google
researching, USB flash drives cannot be partitioned if the drive is
identified as removable media, which it is. It also says the only
way to partition a USB flash drive is to flip a 'removable bit' so
that the drive is recognized as fixed media instead which then can be
partitioned like any normal hard drive. The suggested Lexar 'bootit'
doesn't do it - for me anyhow. Anyone care to suggest a different
method to try for this?

Thank you

me

Well, I gave it a try.

From Linux, I used fdisk (the partitioning tool).

1) Boot a Linux LiveCD. Use the 10.04LTS one for now,
as Unity (tablet interface) on the newer version is a pain.

http://www.ubuntu.com/download/ubuntu/download

2) Once the desktop is up, open a Terminal.

http://www.serversidemagazine.com/images/php53-vde/ubuntu-open-terminal.jpg

3) Use this command, to list devices. "sudo" is the equivalent of
"Run as Administrator" and allows direct access to hardware devices.

sudo ls /dev

4) I see things like sda, sda1, sda2, sda3, sda4 and that is my first hard drive.
I see sdb, sdb1, sdb2, sdb3, sdb4 and that is my second hard drive with four
primary partitions.
I see sdc, sdc1 and that appears to be my USB flash 8GB.

Now, use "fdisk" to do the re-partitioning of sdc. You can see that, if
you managed to select the wrong drive, you'd make a royal mess. That's why,
if you cannot figure out which drive is which, stop here!

sudo fdisk /dev/sdc

5) The steps would be.
a) Remove all previous partitions, using partition delete.
b) Create one new partition. I made mine 200 cylinders, which
is around 1.5GB or so. A cylinder, with standard default
geometry, is around 8MB each. Times 200 gives you around 1.5GB.
You wouldn't want to go past 2GB if doing FAT16.
c) Change the partition type. I think I set mine to "6" for my
new primary partition #1. "6" is FAT16, with a 2GB upper limit.
d) Verify everything looks good with the "print" command, which
prints the new table.
e) Then use the "write" command, which writes the new partition table,
tells the kernel it's been updated, and then quits the fdisk command.

6) Now, back in the Terminal again, you can format the thing FAT16.

sudo mkfs.vfat -F 16 -l BURP /dev/sdc1

7) Now, go to "Places" menu at the top of the screen, try "Computer" and
all your partitions should be shown, including the new "BURP" partition.
Clicking on "BURP", should show an empty partition. The purpose of
clicking on the partition in this menu, is to get it mounted for free,
without typing a terminal command. It should be mounted under /media.

8) Now, go back to Terminal again, and attempt to make an empty text file.

touch /media/BURP/mytest.txt

If the file exploration window is still open, you might see the new
empty text file appear in there.

9) OK, now you can go to the upper right, and select "reboot" as your
restart option. Ubuntu will unmount "BURP" partition, sync and flush
so it's safe, and then shutdown and reboot.

Now, you're back in Windows, and should have a 1.5GB partition on your
oversized USB flash.

*******

When I worked out the steps, I tried to create two FAT16 partitions.
But Windows doesn't like it. I tried to create BURP and FART, two
FAT16 partitions, each 200 cylinders. I put a test text file in each one.
In Windows Disk Management, this is what Windows can see. It realizes the
second partition exists, but refuses to mount it. So removable media appears
to only support the one working partition. Which is fine for the
odd experiment, but not very practical. This is a screenshot of
Disk Management, showing my flash stick. Notice that although BURP
and FART both worked in Linux, in Windows, only BURP shows up. The
partition table knows there is a FART, but won't allow you to use it.

http://img823.imageshack.us/img823/4461/dm4flash.gif

And this does no good, if a tool wants to "redefine" the entire flash,
as it will erase the flash, run into a device larger than 2GB and
freak out. Doing this to a flash, only helps if the tool will
work within the confines of a single partition (like, work with
the BURP it finds).

HTH,
Paul
 
Well, I gave it a try.

From Linux, I used fdisk (the partitioning tool).

1) Boot a Linux LiveCD. Use the 10.04LTS one for now,
as Unity (tablet interface) on the newer version is a pain.

http://www.ubuntu.com/download/ubuntu/download

2) Once the desktop is up, open a Terminal.

http://www.serversidemagazine.com/images/php53-vde/ubuntu-open-terminal.jpg

3) Use this command, to list devices. "sudo" is the equivalent of
"Run as Administrator" and allows direct access to hardware devices.

sudo ls /dev

4) I see things like sda, sda1, sda2, sda3, sda4 and that is my first hard drive.
I see sdb, sdb1, sdb2, sdb3, sdb4 and that is my second hard drive with four
primary partitions.
I see sdc, sdc1 and that appears to be my USB flash 8GB.

I got this far - I see sdb1,sdb2, sdb3, sdb4 and sdc, sdd,sde,sdf,
sdg, plus sdg1, sdg2, and sdg3. This was with a different flash drive
in - an 8 gb'er.
Those were the only sd'ers. My XP machine has only one 300GB hard
drive, containing three partitions.
I don't know how you identified your flash drive. Would mine be the
sdg series?
I need to be sure for sure.
Thanks
 
I got this far - I see sdb1,sdb2, sdb3, sdb4 and sdc, sdd,sde,sdf,
sdg, plus sdg1, sdg2, and sdg3. This was with a different flash drive
in - an 8 gb'er.
Those were the only sd'ers. My XP machine has only one 300GB hard
drive, containing three partitions.
I don't know how you identified your flash drive. Would mine be the
sdg series?
I need to be sure for sure.
Thanks

Storage devices can be either HDA or SDA. With the SDA ones being nominally
"SCSI" but corresponding to any device that used a SCSI driver. The same thing
happens in Windows, in that when a hardware person invents a new kind of storage
device, they write a "SCSI" driver with CDB (control data block) instead of
writing a custom driver. The notion of SCSI, means a SCSI stack already
present in the OS can be used. And then, only the interface glue between
decoding a CDB and driving the hardware is needed. The OS "sends down" a CDB,
as if a SCSI drive was present, and the driver sends back an answer based on
the command in there.

http://tldp.org/HOWTO/Partition/devices.html

What I can find confusing, is I can boot a couple different distros of Linux
here, and have one refer to a drive as HDA and another refer to a drive as
SDA. Which means the hardware can't be supported in exactly the same way.

*******

A quick search, suggests a half-finished piece of software called
gnome-device-manager.

In your terminal, if you type that command, it'll tell you the
software isn't installed, and that you need to run a certain
command to get it installed. In my case, it said the necessary
command would be:

sudo apt-get install gnome-device-manager

Ubuntu has several repositories with software packages in it. You may
also be told you need to enable "Universe" or "Multiverse" repository.
If neither of these are needed, it would mean the package is a
more frequently installed package that Ubuntu considers part of their
core set. You have to go into Synaptic Package Manager, tick the boxes
for those, if a package needs one of the other repositories. But in
this case, none of that appears to be necessary.

The installer will prompt for permission to do the job, and then
after maybe 30 seconds, it should be done.

Next, you type that command into your terminal session.

gnome-device-manager

Under Mass Storage Drive, I can see one of my storage devices. That
is in a VM (virtual machine) I can run, while I'm still running Windows.
So there is a chance you can figure out the mapping, using that "pretend"
version of a Device Manager. They create programs like that, to match the
appearance of how some things work in Windows. It doesn't mean all
the control functions that exist in Windows, will be copied in there.
To do things like install drivers in Linux, there would still be
more terminal commands to execute. But in terms of "fun" applications,
give it a try and see if you can figure it out.

Linux has a bunch of commands, such as "dmesg", "lsusb" and the like.
But what I can't guarantee, is any one of those commands will give
enough info to positively identify the device. In my case, I know
my two hard drives have four partitions, and the USB stick, with only
one partition on it, stands out in comparison. I figure it out
by the process of elimination. But if I had two USB sticks plugged
in, that would be a mess.

Paul
 
Storage devices can be either HDA or SDA. With the SDA ones being nominally
"SCSI" but corresponding to any device that used a SCSI driver. The same thing
happens in Windows, in that when a hardware person invents a new kind of storage
device, they write a "SCSI" driver with CDB (control data block) instead of
writing a custom driver. The notion of SCSI, means a SCSI stack already
present in the OS can be used. And then, only the interface glue between
decoding a CDB and driving the hardware is needed. The OS "sends down" a CDB,
as if a SCSI drive was present, and the driver sends back an answer based on
the command in there.

http://tldp.org/HOWTO/Partition/devices.html

What I can find confusing, is I can boot a couple different distros of Linux
here, and have one refer to a drive as HDA and another refer to a drive as
SDA. Which means the hardware can't be supported in exactly the same way.

*******

A quick search, suggests a half-finished piece of software called
gnome-device-manager.

In your terminal, if you type that command, it'll tell you the
software isn't installed, and that you need to run a certain
command to get it installed. In my case, it said the necessary
command would be:

sudo apt-get install gnome-device-manager

Ubuntu has several repositories with software packages in it. You may
also be told you need to enable "Universe" or "Multiverse" repository.
If neither of these are needed, it would mean the package is a
more frequently installed package that Ubuntu considers part of their
core set. You have to go into Synaptic Package Manager, tick the boxes
for those, if a package needs one of the other repositories. But in
this case, none of that appears to be necessary.

The installer will prompt for permission to do the job, and then
after maybe 30 seconds, it should be done.

Next, you type that command into your terminal session.

gnome-device-manager

Under Mass Storage Drive, I can see one of my storage devices. That
is in a VM (virtual machine) I can run, while I'm still running Windows.
So there is a chance you can figure out the mapping, using that "pretend"
version of a Device Manager. They create programs like that, to match the
appearance of how some things work in Windows. It doesn't mean all
the control functions that exist in Windows, will be copied in there.
To do things like install drivers in Linux, there would still be
more terminal commands to execute. But in terms of "fun" applications,
give it a try and see if you can figure it out.

Linux has a bunch of commands, such as "dmesg", "lsusb" and the like.
But what I can't guarantee, is any one of those commands will give
enough info to positively identify the device. In my case, I know
my two hard drives have four partitions, and the USB stick, with only
one partition on it, stands out in comparison. I figure it out
by the process of elimination. But if I had two USB sticks plugged
in, that would be a mess.

Paul


Wow!

I figure if I pull the flash drive out of USB slot, its 'sd' entries
in 'ls /dev' should disappear. Likewise, if I reinsert it, they
should return. Sure enough, my 'sdg' entries did just that (sdg,
sdg1, sdg2, sdg5). Ergo, I assume I have found the right ones. XP
Computer Management shows the 8GB Sandisk flash drive as 'removable'
and has one partition - NTFS for 1GB drive N and a second for 7GB
which is said to be 'healthy', but is not labeled. If I could just
format and label the latter. BTW, Norton PMagic does not show the
flash drive at all.

This all seems quite a 'do' just to format partitions on a flash
drive. My USB external hard drive has presented no such problems. I
did not anticipate this.

Me
 
Wow!

I figure if I pull the flash drive out of USB slot, its 'sd' entries
in 'ls /dev' should disappear. Likewise, if I reinsert it, they
should return. Sure enough, my 'sdg' entries did just that (sdg,
sdg1, sdg2, sdg5). Ergo, I assume I have found the right ones. XP
Computer Management shows the 8GB Sandisk flash drive as 'removable'
and has one partition - NTFS for 1GB drive N and a second for 7GB
which is said to be 'healthy', but is not labeled. If I could just
format and label the latter. BTW, Norton PMagic does not show the
flash drive at all.

This all seems quite a 'do' just to format partitions on a flash
drive. My USB external hard drive has presented no such problems. I
did not anticipate this.

Me

So you're seeing what I'm seeing then. You can prepare multiple partitions
on the USB flash in Linux, and actually use them. In Windows, only the
first partition will mount. The other partitions can be "seen" (the Healthy
thing), but since they won't mount, are no good for Windows storage.

I think the reason I may have put a partition table on mine, was so I could
get it to be NTFS and be able to store a file larger than 4GB. At least,
on my larger USB flash stick. That's unnecessary for the small one. The small
stick, is for tools and experiments that are limited to FAT16.

Maybe then the answer is, to put a large shared storage as the first partition,
and any smaller partitions (that it doesn't make sense for Windows to see)
could be put after it ?

The "sdg5" implies a logical partition, inside an extended partition ?
When you install a Linux OS, they do crazy stuff like that.

Paul
 
So you're seeing what I'm seeing then. You can prepare multiple partitions
on the USB flash in Linux, and actually use them. In Windows, only the
first partition will mount. The other partitions can be "seen" (the Healthy
thing), but since they won't mount, are no good for Windows storage.

I think the reason I may have put a partition table on mine, was so I could
get it to be NTFS and be able to store a file larger than 4GB. At least,
on my larger USB flash stick. That's unnecessary for the small one. The small
stick, is for tools and experiments that are limited to FAT16.

Maybe then the answer is, to put a large shared storage as the first partition,
and any smaller partitions (that it doesn't make sense for Windows to see)
could be put after it ?

The "sdg5" implies a logical partition, inside an extended partition ?
When you install a Linux OS, they do crazy stuff like that.

Paul


Hi again Paul.

I am thinking part or all of the problem may be that the OS must be
made to think that the flash drive is not a removable drive, but is a
fixed drive. That's what I infer from what I read anyhow. There is a
program called 'bootit' (v1.07) that is supposed to provide the
ability to 'flip' a so-called 'removable bit'. Alas I cannot get it
to do that job. Or at least, it would appear so. And so I am still
stuck with two partitions on my 8GB Sandisk - namely 1G and 7G. The
first has a drive letter and is recognized by XP. The second has no
drive letter and is not recognized by XP of course.

Are you familiar with this feature? Have you dealt with it? Do you
know of another program other than 'bootit' that I might try?

Thanks again

Me
 
Hi again Paul.

I am thinking part or all of the problem may be that the OS must be
made to think that the flash drive is not a removable drive, but is a
fixed drive. That's what I infer from what I read anyhow. There is a
program called 'bootit' (v1.07) that is supposed to provide the
ability to 'flip' a so-called 'removable bit'. Alas I cannot get it
to do that job. Or at least, it would appear so. And so I am still
stuck with two partitions on my 8GB Sandisk - namely 1G and 7G. The
first has a drive letter and is recognized by XP. The second has no
drive letter and is not recognized by XP of course.

Are you familiar with this feature? Have you dealt with it? Do you
know of another program other than 'bootit' that I might try?

Thanks again

Me

See the section "Removable or what?". Uwe's solution is to use a filter driver.

http://www.uwe-sieber.de/usbstick_e.html

http://www.uwe-sieber.de/usbtrouble_e.html#partitioning

"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

It is 32 bits only, so it will not work on x64 editions of Windows."

There is additional text there, describing how to modify the .inf inside the ZIP.
The .inf needs to be modified, presumably so the driver can be applied
to your flash stick. The files in that package are pretty small (as all
the filter needs to do, is prevent Windows from seeing RMB).

Paul
 
Back
Top