• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

list Linux mounted volumes

 
Ranch Hand
Posts: 510
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what the java.io.File.listRoots method is for.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic