Question

What is the best way to format an usb drive (> 32Gb) with Java on Windows?

I tried to use the format function:

Process p = Runtime.getRuntime().exec("CMD /C format f: /FS:FAT32 /Q /X /Y");

But the size of the drive is limited to 32Gb. My usb drive is larger than 100Gb.

Could I do it using JNI or will I be limited with the 32Gb?

Is there any library to do it? I've found fat32-lib but it doesn't seem to be reliable and there is no documentation.

Thanks

Was it helpful?

Solution

Try this :

http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm

This is a 3rd party tool for formatting FAT32 drives beyond 32 GB limit. It has both command line and GUI modes.

Exceeding 32 GB limit for FAT32 drives is not possible through the native "format" command on windows.

OTHER TIPS

If you keep using format, I don't think you'll be able to avoid the 32 GB limit that Microsoft imposes on FAT32 on all WinNT-based OSes (Win2K+) :

FAT16 and FAT32 do not scale well. As the volume gets bigger, the file allocation table gets bigger, which dramatically increases the amount of time it takes Windows 2000 to compute how much free space is on the boot volume when the system is restarted.

For this reason, you may not create a FAT32 volume larger than 32 GB using the Format utility. However, the Windows 2000 Fastfat driver enables you to mount and fully support a FAT32 volume larger than 32 GB.

You might be able to avoid this limitation using another implementation of FAT32 but I'm not sure one exists for Windows (I didn't find one googling a bit). Or you could use pre-WinNT Windows such as Windows 98 or Millenium Edition but I don't think it would be a good idea.

Try this,

Process p = Runtime.getRuntime().exec("CMD /C format f: /FS:NTFS /Q /X /Y");

It will sove your issue..NTFS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top