• Post Reply Bookmark Topic Watch Topic
  • New Topic

list Linux mounted volumes  RSS feed

 
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,

Looking for Ideas on how to list/get all mounted volumes on any unix like platform.

thanks & happy holidays!
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about invoking the command in the underlying operating system using the Runtime.exec() method.

Somewhat like:



The mount command invoked without parameters list all the mounted volumes.
[ December 28, 2006: Message edited by: Edwin Dalorzo ]
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what the java.io.File.listRoots method is for.
 
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 for excellent replies

I tried but in linux i always get /
so i think ,this is not the right solution to go for.

however the solution proposed by Mr. Edwin seems interesting..i guess i should do some work to parse the results to extract the volumes & their paths ; but that's not very difficult i presume.

thanks.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in linux i always get /
so i think ,this is not the right solution to go for.


The list roots is to list partitions that are their own roots. For example, in Windows all drive letters are technically their own roots. In linux (as with all Unix) partitions are mounted -- there is only one root, the other mounted partitions can be accessed by travering from the root.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!