Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
I agree with yoron.
Just a few notes YI:
There are two things that might cause problems:
1) From fdisk's manpage:
if you use cfdisk or fdisk to change the size of a DOS partition table entry,
then you must also use dd to zero the first 512 bytes of that partition before
using DOS FORMAT to format the partition
I have found this to be necessary with all Windows-partitions, not only DOS6.
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.
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)
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
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.
Last edited by conn-fused; 01-20-2006 at 05:22 AM.
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.
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.):
p1: ext2, type 0x83 p2: fat16, type 0x83 (OP Configuration)
p1: ext2, type 0x83 p2: fat16, type 0x0B (Revised Config)
p1: fat16, type 0x0B p2: ext2, type 0x83 (Likely to Work)
p1: fat16, type 0x83 p2: ext2, type 0x83 (Test if partition type matters)
If anyone else has any other thoughts on what I can test, let me know. I think this will prove interesting.
mkfs.vfat 2.11 (12 Mar 2005)
No device specified!
Usage: mkdosfs [-A] [-c] [-C] [-v] [-I] [-l bad-block-file] [-b backup-boot-sector]
[-m boot-msg-file] [-n volume-name] [-i volume-id]
[-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs]
[-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors]
$ mkfs.ext2 -V
mke2fs 1.38 (30-Jun-2005)
Using EXT2FS Library version 1.38
$ cfdisk -v
Copyright (C) 1994-2002 Kevin E. Martin & aeb