How do I get all the mount point information for an Android device programmatically?
You can see the partitions known to the system by examining /proc/partitions
. From my HTC Desire:
major minor #blocks name
31 0 640 mtdblock0
31 1 4608 mtdblock1
31 2 3072 mtdblock2
31 3 256000 mtdblock3
31 4 40960 mtdblock4
31 5 151168 mtdblock5
179 0 3872256 mmcblk0
179 1 2872070 mmcblk0p1
179 2 1000185 mmcblk0p2
The mtdblock
devices are the phone's internal flash storage. mmcblk0
is the phone's SD card.
The best way to see what is mounted where is to examine /proc/self/mountinfo
. This is better than /proc/mounts
because the latter misses certain information. Again, on my HTC Desire (I added column headings and ran the output through column -s
for good measure):
ID PARENT BLOCK ROOT MOUNTPOINT OPTIONS - TYPE SOURCE SUPEROPTS
1 1 0:1 / / ro,relatime - rootfs rootfs ro
11 1 0:11 / /dev rw,relatime - tmpfs tmpfs rw,mode=755
12 11 0:9 / /dev/pts rw,relatime - devpts devpts rw,mode=600
13 1 0:3 / /proc rw,relatime - proc proc rw
14 1 0:12 / /sys rw,relatime - sysfs sysfs rw
15 1 0:13 / /acct rw,relatime - cgroup none rw,cpuacct
16 1 0:14 / /mnt/asec rw,relatime - tmpfs tmpfs rw,mode=755,gid=1000
17 1 0:15 / /mnt/obb rw,relatime - tmpfs tmpfs rw,mode=755,gid=1000
18 11 0:16 / /dev/cpuctl rw,relatime - cgroup none rw,cpu
19 1 31:3 / /system ro,relatime - yaffs2 /dev/block/mtdblock3 ro
20 1 31:5 / /data rw,nosuid,nodev,relatime - yaffs2 /dev/block/mtdblock5 rw
21 1 31:4 / /cache rw,nosuid,nodev,relatime - yaffs2 /dev/block/mtdblock4 rw
22 21 31:5 /local/download /cache/download rw,nosuid,nodev,relatime - yaffs2 /dev/block/mtdblock5 rw
23 1 179:2 / /sd-ext rw,nosuid,nodev,noatime,nodiratime - ext4 /dev/block/mmcblk0p2 rw,commit=19,barrier=0,data=writeback
24 20 179:2 /app /data/app rw,nosuid,nodev,noatime,nodiratime - ext4 /dev/block/mmcblk0p2 rw,commit=19,barrier=0,data=writeback
25 20 179:2 /data /data/data rw,nosuid,nodev,noatime,nodiratime - ext4 /dev/block/mmcblk0p2 rw,commit=19,barrier=0,data=writeback
26 14 0:6 / /sys/kernel/debug rw,relatime - debugfs /sys/kernel/debug rw
27 1 179:1 / /mnt/sdcard rw,nosuid,nodev,noexec,relatime - vfat /dev/block/vold/179:1 rw,dirsync,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
28 1 179:1 /.android_secure /mnt/secure/asec rw,nosuid,nodev,noexec,relatime - vfat /dev/block/vold/179:1 rw,dirsync,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
29 27 0:17 / /mnt/sdcard/.android_secure ro,relatime - tmpfs tmpfs ro,size=0k,mode=000