Android Code Snippet Get Mounting Points

Subname: DevicePaths

Description: Use to find all mount points on a device. This should work with all versions below Android 4.3, at which time they changed the OS where it can not access the needed information. You do not need to change the manifest as the line: dp = File.DirRootExternal in the code below, will add the permissions needed.

Dependencies/Libraries: none

Sub GetMountPoints
    'Call like this
    Dim MountPoints As Map = DevicePaths
    'Log here just to show the results
    Log("Device Paths Found..." & CRLF & "_____________________")
    For i = 0 To MountPoints.Size -1
        Log(MountPoints.GetKeyAt(i) & ", " & MountPoints.GetValueAt(i))
End Sub
Sub DevicePaths As Map
    'Should work with Android versions below 4.3
    Dim lp As List : Dim dpaths As Map : Dim ChkVal, dp = File.DirRootExternal As String : dpaths.Initialize
    lp = File.ReadList("/system/etc/", "vold.fstab")
    For i = 0 To lp.Size -1
        ChkVal = lp.get(i) : ChkVal = ChkVal.Replace(":", " ")
        If ChkVal.ToLowerCase.StartsWith("dev_mount") Then
            dpaths.Put(SGW(ChkVal, 2), SGW(ChkVal, 3))
        End If
    Return dpaths
End Sub
Sub SGW(CStr As String, GE As Int) As String
    Dim t As List : Dim rs, sd As String : sd = " "
    t = Regex.Split(sd, CStr)
    rs = t.Get(GE-1)
    Return rs
End Sub

Example: On my ASUS TF-101 with keyboard attached, returns:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **

Device Paths Found...
microsd, /Removable/MicroSD
usbdisk2, /Removable/USBdisk2
usbdisk1, /Removable/USBdisk1
sdreader, /Removable/SD

Tags: Mount, Mounts, SDCard, External, Memory, ExternalMemory, DirRootExternal
Last edited:


Licensed User
Longtime User
Hi Margret,

In this thread on stackoverflow , there is a suggestion that you can get the info from /proc/mount for 4.3. I haven't tried it.