File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Formatting drive with java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Formatting drive with java." Watch "Formatting drive with java." New topic

Formatting drive with java.

Carlton Hanna

Joined: Jul 29, 2009
Posts: 6
I'm running java on a ubuntu server, is there a way I can have java format a disk drive(/dev/sd*) to ext3?
Rob Spoor

Joined: Oct 27, 2005
Posts: 20271

You can use ProcessBuilder and Process to call an external command. See
And while you're at it, read the Javaworld article "When Runtime.exec() won't".

How To Ask Questions How To Answer Questions
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 1118

using java for systems programming is a bad idea,

In simple words, java cant do it, It can invoke another program to do it as Rob Prime said,
But if you think that java can write "0" and "1" to the disk directly and do the formatting work, you are mistaken.

Since you mention server,
what is your aim?
- is it to remotely send a command to this server that triggers a partition format ?
- is it to format itself after some timely schedule ?

both the above options can be solved by using the underlying OS: Ubuntu

I agree. Here's the better link:

I agree. Here's the link:
subject: Formatting drive with java.
It's not a secret anymore!