(This is a follow-up to "What is the partition id / filesystem type for UDF?")

I know two ways to format a hard drive as UDF:

  • Windows Vista or later: "format x: /fs:UDF" (don't use /q ! )
  • Linux: "mkudffs --media-type=hd --blocksize=512 /dev/sdx"

The problem is that the 'other' OS does not recognize the disk as formatted at all: it simply refuses to mount it, no matter what commands I try.

How can I format a hard drive as UDF so that both Windows and Linux will be able to use it?

EDIT: updated the commands, now the result should work in either OS.

link|improve this question

The command you give works great on Linux. I formatted on Karmic, and can read and write under both Windows 7 and Karmic. – Matt Joiner Dec 29 '09 at 13:44
Do not forget to zero the MBR first (dd if=/dev/zero of=/dev/sdx bs=512 count=1), to avoid confusion with any leftover partition table (since UDF does not use the first sector). – CesarB Jan 2 '10 at 2:59
Thanks Skolima, this is great. Bye bye FAT32. I only need to be careful to stick to UDF version 2.01 and to 512 block size and I have the perfect hard disk partition shared across Linux and Windows. – MarcH Dec 29 '11 at 23:46
for some strange reason you also need to create the partition from Windows. Not necessarily format it there but create it. – MarcH Dec 30 '11 at 1:05
show 1 more comment
feedback

7 Answers

up vote 5 down vote accepted

It turns out that using the /q switch on Windows was the culprit: it enables 'quick format', i.e. the formatting process continues in background with every write made to the disk. Once it finishes, the drive is handled by Linux just fine.

link|improve this answer
On the other hand, formatting with Linux' mkudffs seems to sucessfully complete in seconds. – MarcH Dec 29 '11 at 23:41
feedback

How did you reconcile your discovery in the previous question (that the UDF filesystem should be created on the whole disk, not a partition) with that Windows command ("format x: /fs:UDF")? In my attempts, Windows only gives drive letters to partitions.

As far as formatting for compatibility, I think the key is in the block size. Since most hard drives and USB flash sticks have a block size of 512 bytes, I've had the most compatibility when I create the FS that block size. I think format.com is using that block size, and mkudffs has a command switch for changing the block size. I could only get OS X and Windows to mount the filesystem when I used 512 byte blocks. Older versions of Linux assumed a block size of 2048, but you can always mount with "-o bs=512".

The whole disk vs partition issue still causes compatibility problems. Windows won't mount when I format the whole disk, and OS X doesn't look beyond the partition's type number when determining its filesystem, forcing me to mount it manually. Linux didn't care, as long as I gave it the appropriate device name (sda vs sda1).

In summary, the most compatible setup I've found is a singe partition of type 06(FAT16), formatted with UDF at block size 512. Works automatically on Windows, and a small bit of manual intervention on Linux and OS X.

link|improve this answer
2  
I've tried another experiment. This time I used a USB flash stick instead of a hard drive. Formatted with "mkudffs --media-type=hd --blocksize=512 /dev/sda", works without hassle on Linux, OS X, and Vista. Too bad Windows seems to allow partitionless formats on USB sticks but not hard drives. – Simon Oct 9 '09 at 18:22
You definitely want to keep the same block size to avoid prematurely wearing the flash memory, see: lwn.net/Articles/428584 – MarcH Dec 29 '11 at 1:22
feedback

Don't use UDF. I would have chosen either FAT32 or NTFS file system, which is visible from both linux and windows.

link|improve this answer
2  
How is UDF different in this regard? Is it not visible from Linux or Windows? – Gerald Combs Aug 20 '09 at 22:29
2  
FAT32 has a 4GB file size limit and does not store POSIX permissions. NTFS does not store POSIX permissions. I do need those features, and only UDF provides them. Besides, it is faster than NTFS. – skolima Aug 24 '09 at 17:01
feedback

UDF was designed for optical media, perhaps that's the problem?

link|improve this answer
3  
For initial revisions (before 1.5) this is true. However, later versions (those available in Linux and Windows Vista) are also meant to be used with random-rewrite media like hard drives. – skolima Aug 17 '09 at 17:08
feedback

What versions of Windows and Linux are you using? No matter what I try, I can't get both Windows (Vista) and Ubuntu (9.04) to recognize the drive - each can format it fine, but the other can't read it then.

link|improve this answer
Windows 7 and Windows Vista, didn't yet check with Windows XP but it should show the drive as read only. On Linux - latest kernel and udftools from both Gentoo and Ubuntu worked fine. However, if the drive wasn't unmounted properly, Linux won't detect it. – skolima Sep 14 '09 at 6:42
feedback

Whadya mean do not use UDF? I am trying to reformat a USB drive to use with a Sony home theater and so far it is looking like UDF is the format used.

By default the format x: /fs:UDF command made my drive 200MB - how do I change that?

link|improve this answer
feedback

Well, score one for file system compatibility. Formatting from Windows 7 didn't work for OS-X, but formatting from Linux worked well. It still suffers from the not-blessed-by-Apple speed cap on OS-X though.

I can't wait for Ubuntu to implement the features I need to work on my Mac...

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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