Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List all Linux mounted volumes

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Is there a way to get the list of all mounted volumes on a linux system ?

I tried File.listRoots() on Linux but it gives me only "/" .

thank you for helping.
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is because on a unix type system all mounted volumes still fall under root somewhere, so there is only one "root". To get the mounted volumes you can use the command df -k in Runtime.exec (you may wish to use df -lk so that nfs mounted volumes where the nfs server is not responding does not cause the command to hang).
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

can you tell me what is the first parameter (command/shell ?) i should use in Runtime.exec() ?

I would appreciate you post complete code statement for Runtime.exec().

thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.getRuntime().exec("df") would do just fine. You'd have to read the output, of course; search the Ranch archives for zillions of Runtime.exec() examples for that.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you i will give that a try.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic