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.
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.
- duplicates
-
JDK-4313887 New I/O: Improved filesystem interface
- Resolved