aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Formatting drive with java." Watch "Formatting drive with java." New topic
Author

Formatting drive with java.

Carlton Hanna
Greenhorn

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
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

You can use ProcessBuilder and Process to call an external command. See http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/ref-guide/s1-filesystem-ext3-create.html
And while you're at it, read the Javaworld article "When Runtime.exec() won't".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
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: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
 
subject: Formatting drive with java.
 
Similar Threads
CD-ROM drive letter
Way to rope 'em Ian!
Finding the drive type
Confusion about Java license...
Finding the drive type