Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to format a memory stick for moving data between Windows 7 and a non-networked Ubuntu server (Precise).

I'm not sure that either of the two ways I've tried are correct, even though I can read from and write to the drive on both machines.

I get a very weird looking partition listing from fdisk if I format the drive on Windows (using the Disk Management tool), but it seems to be OK in terms of reading and writing on Linux and Windows.

Image showing the output of fdisk for a windows formatted drive enter image description here

and cfdisk reports

FATAL ERROR: Bad primary partition 1: Partition begins after end-of-disk.

If, as advocated [here][FormatBigVfatDisks], I use cfdisk to create a full-disk primary partition of type b (or fdisk to create a partition that starts at block two-thousand and something) and then issue

sudo mkfs.vfat -n some_label /dev/sdf1

then Windows won't recognize the file system (after aeons of thinking about it).

Linux and Windows will happily read and write a 2GB dive if I make that same partition, but then issue:

sudo mkfs.vfat -I -n some_label /dev/sdf

but this makes that full-disk partition show as free-space in cfdisk and fdisk and Windows doesn't like the 16GB drive.

I've tried using parted too, but Windows is never happy with any partitions I create on Linux.

I'm concerned that, whilst the drive seems to work, I may discover that the data isn't being transferred faithfully.

I'm using SanDisk Cruzer drives of various ages, flavors and sizes.

Is the correct way to format on windows and ignore the problems that cfdisk and fdisk have or is there another correct way in which everyone is happy with the drive?

Reference: Formatting big external disks so that they can be read and written in all operating systems: Windows, Linux, and Mac

share|improve this question
    
Have you tried using "HP USB Format" tool instead of diskmgmt.msc? –  GENiEBEN Dec 11 '13 at 22:40
1  
use gparted, create NTFS disk, use it in windows. Another way is simply delete everything from it (no partition at all), then partition it in windows with compmgmt.msc or HP USB Tool, then use it in Windows and linux. –  72DFBF5B A0DF5BE9 Dec 11 '13 at 22:45
    
@GENiEBEN I haven't and I don't seem to be able to find a reputable source for it either. –  jah Dec 11 '13 at 23:26

1 Answer 1

up vote 3 down vote accepted

Windows will often use external media, such as USB flash drives, in an unpartitioned way -- that is, there's no partition table and the filesystem is written to the whole disk. If your disk is set up in this way, you should use /dev/sdf directly, as in:

mount /dev/sdf /mnt

You could use mkfs, fsck, and other tools in a similar way. You can use blkid to verify this, as in blkid /dev/sdf. If it tells you that /dev/sdf is a FAT (or some other) filesystem, then my hypothesis is correct.

If the disk has no data you want to preserve and you want to create a fresh filesystem on it, you can either do so on the whole disk or you can use fdisk, parted, or some other tool to create a fresh (empty) partition table. In fdisk, you'd do this with the o command at the main menu. This will wipe the existing "partitions" (which are probably just fdisk's desperate attempt to interpret the first sector of a FAT filesystem) and create a new empty partition table. You'd then use n to create a new partition, save the changes with w, and use mkfs or mkdosfs outside of fdisk to create a fresh filesystem on /dev/sdf1.

Note that Windows only recognizes the first partition on a USB flash drive that contains a partition table. Thus, if you want more than one partition, be sure that the first one is the one that will be accessible from Windows.

share|improve this answer
    
That mess reported by fdisk (see the screenshot in the question) can be corrected by zeroing the drive with dd if=/dev/zero of=/dev/sdf or shred -n 0 -z /dev/sdf before creating a partition. –  jah Dec 12 '13 at 13:43
    
Create a partition with fdisk /dev/sdf (using the defaults presented in interactive mode) of type b (Windows95) (make it type c (Windows95 (LBA)) for a 16GB drive - this is what Windows does) and format it using either mkfs.vfat /dev/sdf1 or in Windows with the Disk Management tool (which reports the file system as 'RAW' when the drive is first plugged-in). Both ways will result in a drive which fdisk reports consistently. Note that this results in a partition which is not 'whole disk' and so /dev/sdf1 is the one to mount. –  jah Dec 12 '13 at 13:43
    
I couldn't confirm your hypothesis @Rod Smith because this drive is not now 'whole disk': sudo blkid /dev/sdf reports nothing at all, but sudo blkid /dev/sdf1 does report TYPE="vfat". Thank you very much for your answer, I now have working drives I have confidence in. –  jah Dec 12 '13 at 13:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.