Results 1 to 2 of 2
  1. #1
    Shellback3 is offline Member
    Join Date
    Jan 2011
    Location
    Riveside, CA
    Posts
    16
    Rep Power
    0

    Question 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,
    Nate

  2. #2
    Shellback3 is offline Member
    Join Date
    Jan 2011
    Location
    Riveside, CA
    Posts
    16
    Rep Power
    0

    Default 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.

Similar Threads

  1. Problem accessing mapped drives
    By jonmagnar in forum Advanced Java
    Replies: 7
    Last Post: 02-15-2011, 07:04 AM
  2. Ho to add usedspace for all drives
    By Ajitha in forum New To Java
    Replies: 1
    Last Post: 05-30-2010, 04:30 PM
  3. Drives me crazy. How to mark thread Solved.
    By ocean in forum Forum Lobby
    Replies: 2
    Last Post: 12-07-2009, 09:42 AM
  4. Recognize HDD, CD/ROM, DVD/ROM drives
    By xmikul28 in forum Advanced Java
    Replies: 3
    Last Post: 08-25-2009, 02:27 PM
  5. Listing Logical Drives
    By Juggler in forum New To Java
    Replies: 3
    Last Post: 08-10-2008, 08:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •