Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6648209
Votes 1
Synopsis File needs method to enumerate underlying file systems
Category java:classes_io
Reported Against
Release Fixed
State 11-Closed, duplicate of 4313887, request for enhancement
Priority: 5-Very Low
Related Bugs
Submit Date 08-JAN-2008
Description
A DESCRIPTION OF THE REQUEST :
For a Windows system, File.listRoots() will provide a list of mounted partitions.  For a Unix or Linux system,File.listRoots() provides only one root, the root partition.  No information about other mounted partitions can be accessed.

JUSTIFICATION :
File.getTotalSpace(), File.getFreeSapce(), File.getUsableSpace() all proport to allow a user to manage his hard disk space.  For a windows machine, this is possible because File.listRoots() will actually provide the necessary information.  However, for Unix and Linux there is not way to find the drives to get this information.  So, for a Windows box, you can use these tools to explore and find a drive with the requisite space.  For Linux, this only reports the root partition and makes the system look like it has almost no hard drive space because you can't directly find the other hard drives where the partition is.

I am writing an display application to show the available hard drives and how much space is available on them.  Works great for Windows.  For Linux, I have to manually read /etc/fstab to get the partition information otherwise I can't find the drives to show the amount of space used.  Once I manually find the name of the partition, the space functions work correctly, so the only problem is getting the list of mounted partions to feed the space functions.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Need to get a list of mounted partitions for which File.getTotalSpace(), File.getFreeSapce(), File.getUsableSpace() will report results.
ACTUAL -
Function is not currently supported on Linux or Solaris.  Suggest:
File[]System.mountedPartitions()

CUSTOMER SUBMITTED WORKAROUND :
Manually reading /etc/ftab is the workaround.
Posted Date : 2008-01-08 17:02:05.0
Work Around
N/A
Evaluation
JSR-203/NIO.2, in progress for jdk7, defines a method to enumerate the underlying file stores. Each file store can be queried to get its total/allocated/unallocated so writing a df(1M) like utility is trivial.
Posted Date : 2008-01-08 19:52:35.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang