Formatting a USB partition for use with Windows
I have an LG 512MB USB key, divided into three partitions. The first two are ext2 and have a bootable installation of Debian. The third is an msdos partition. I was hoping that I could use this partition to carry files for those times when I'm forced to work with Windows machines at work.
Unfortunately, Windows claims the whole disk is unformatted. It offers me a chance to format it but I decline. We all know how clumsy Windows is ... not understanding ext2, it'd probably erase the first two partitions too. So my question is this: How can I use Linux or Windows to make the third partition (and only the third partition) on my USB key readable on a Windows machine? Thanks! |
do a partition from XP (unformat your usb first)
Use Fat32. Then do the rest unformated partition/s from linux. and mount your Fat32 partition. I think that would work... |
I agree with yoron.
Just a few notes YI: There are two things that might cause problems: 1) From fdisk's manpage: Code:
if you use cfdisk or fdisk to change the size of a DOS partition table entry, 2) Windows wants C:\ to be the very first partition . sometimes it works having C:\ as second-or-later, but my advice is to avoid it. Linux is completely unsensitive as to where partitions are placed (only /boot might have to be primary, and/or before cyl 1024.) |
Thanks guys, these are helpful posts, but is there any way I can format the third partition as FAT32 without loosing the data on the first two partitions?
If there isn't, could I get some advice on using dd with the usb to make images of these two partitions so I can restore them? Please keep in mind, if you think I should use the dd route, that the first partition I want to preserve is a /boot partition, and so should probably go at the start of the usb key. Can I actually format the key to FAT32 and then change the start point of the partition? I was under the (possibly false) impression that only the end points of partitions could be altered, but then I am pretty new to working with partitions like this. |
One more thought. What about vfat? Can Windows understand that? Then maybe a simple "mkfs.vfat /dev/sda3" will solve my problems.
|
How were the partitions created and formated?
What did you use to format the msdos partition? What is the partition ID type for your msdos partition? Post the output of the command fdisk -l /dev/sda (that is a small L and you must be root, change sda for the actual device ID if different) |
OK, here's what I did:
parted /dev/sda "mklabel msdos mkpart primary 0 14 mkpart primary 15 383 mkpart primary 384 -0" shred -n 1 -v /dev/sdd2 cryptsetup -y create rootfs /dev/sdd2 mkfs.ext2 /dev/mapper/rootfs mkfs.ext2 /dev/sda2 sync ; sync mkfs.msdos /dev/sda3 That's only the slightest of variations on the instructions in the following article here (in case anyone else is interested): http://www.debian-administration.org/articles/179 I think that answers your first question. As to your second, I did nothing after "mkfs.msdos /dev/sda3". I was under the impression that making the filesystem formatted the partition. Apparently it does not. But in that case, why can I read my ext2 partitions after "mkfs.ext2 /dev/whatever"? Third: looks like 83 to me ... which is not what I'd have expected. See for yourself in the fdisk output you requested (below): Disk /dev/sda: 519 MB, 519700480 bytes 255 heads, 63 sectors/track, 63 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 2 16033+ 83 Linux /dev/sda2 3 49 377527+ 83 Linux /dev/sda3 50 63 112455 83 Linux |
The mkfs utility does format the filesystem.
Windows does not recognize sda3 because the partition ID type is non DOS i.e. 83 instead of 06 or 0xb. Formating does not modify the ID type. Use cfdisk or fdisk etc to change the ID type. This will not effect existing data. |
Thanks michaelk ... I should have remembered to change the ID.
BTW, I've decided to go with vfat instead of msdos (for long filename support). I presume only 0xB (Win95 Fat32) will do for that, but if I'm wrong please post a correction in case anyone else decides that want to follow the procedure we've laid out here. |
Have you tried qtparted? I *think* this can format partitions as fat32..
|
0x0B should work for vfat (aka fat16). If you really want fat32, you'd need to specifically add '-F 32' to the mkfs.vfat options.
|
Matir: OK, I've tried "mkfs.vfat" and "mkfs.vfat -F 32" with the partition ID set to "b" (0x0b) and tested both combinations on a laptop running XP. In both cases, it insists that the USB key is not formated. I also tried "mkfs.vfat" with partition ID "6" (0x06), to no avail.
Is it possible that XP can't deal with a USB key that has a non-FAT32 partition before a FAT32 one at all? Does anyone else have an empty USB key, an XP and a Linux they can test this with? (ie maybe it's just my key?) Blimbo: No, I haven't run across qtparted before; thanks for the tip. I'll track down a copy and put my results into this post. |
Well, if you haven't found anything, I can test it when I get home this evening. I've done mixed fat/non-fat USB drives before, but the fat partition has always been first.
|
Does XP recognize sda3 as a DOS partition with an ID type of 0xb? If so then use XP to format it as FAT32.
|
Seeing that there has been nothing conclusive so far, I am going to test some different arrangements using a cheap 256MB jumpdrive I have here.
In an effort to make this well-documented, I invite commentary as I perform the tests. I will be partitioning and formatting the jumpdrive with standard linux tools, whose versions I will list below. I will test the drive using Windows XP Professional SP2. I will test the following arrangements (p1=partition 1, etc.):
If anyone else has any other thoughts on what I can test, let me know. I think this will prove interesting. :) Software versions: Code:
$ mkfs.vfat |
All times are GMT -5. The time now is 03:58 AM. |