How to get all the mount point information for android device?

前端 未结 5 1044
一个人的身影
一个人的身影 2021-01-01 02:02

How do I get all the mount point information for an Android device programmatically?

相关标签:
5条回答
  • 2021-01-01 02:13

    Not exactly part of the android apis, but the underlying linux will tell you about the ones that are in use if you read /proc/mounts

    As a clarification, in later Android versions Linux's ability to have unique mounts for each process ancestry is leveraged, so the mounts seen by an application process can (and typically will) be different than those seen by something launched from ADB, or a core system process.

    0 讨论(0)
  • 2021-01-01 02:15

    /proc/mtd

    or on other phones:

    /proc/emmc

    This will show all the partitions and their names - which may or may not currently be mounted.

    0 讨论(0)
  • adb shell df -h

    Example

      Filesystem      Size  Used Avail   Use%   Mounted on
      tmpfs           3.6G  1.1M  3.6G     1%   /dev
      tmpfs           3.6G     0  3.6G     0%   /mnt
    
                 
    
    0 讨论(0)
  • 2021-01-01 02:31

    this worked with my samsung j5

    adb shell df -h

    0 讨论(0)
  • 2021-01-01 02:33

    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
    
    0 讨论(0)
提交回复
热议问题