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.
and cfdisk
reports
FATAL ERROR: Bad primary partition 1: Partition begins after end-of-disk.
If, as some advocate, 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 recognise 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, flavours 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?
Answer
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.
No comments:
Post a Comment