This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 19655

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: 917

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

My Website: [] Cool your mind:[] My Sally:[]
I agree. Here's the link:
subject: Formatting drive with java.
Similar Threads
Way to rope 'em Ian!
Finding the drive type
CD-ROM drive letter
Confusion about Java license...
Finding the drive type