Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatting drive with java.

 
Carlton Hanna
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
salvin francis
Bartender
Posts: 1306
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic