How to get list of mounted drives?
I just installed Ubuntu 11.10 and Eclipse Indigo on a new computer that has a small system drive /dev/sda1 mounted on / and a bay that holds two removable solid state drives populated with one drive /dev/sdb1 mounted on /media/sdb1. I assume that a second removable drive would be mounted as /media/sdb2 or /media/sdc1.
My program needs to know what removable drives are mounted and the assigned name, that it my imaginative name for the removable drive is "data-0". My programy program will need to report an error if no drive is mounted, keep track of available space, and if we should have enough money to purchase a second drive, switch to the second drive if the first gets full.
I have tried to use FileSystemView.getFileSystemView() and File.listRoots() but neither returns any but the system drive.
Any suggestions would be greatly appreciated,
Re: How to get list of mounted drives?
For want of any reply and no web searches with an answer I decided to parse the /proc/mounts file as it has current data. On my computer only the removable disk is in a line starting with /dev/sd
The next field is the mount point:
/dev/sdb1 /media/sdb1 <more fields separated by spaces>
This is trivial to parse and I can use the mount point to get information such as the disk size and amount of free space.