如何查看Android内部分区表?


28

我已经扎根了设备,将其置于恢复模式,并通过adb shell将其链接到PC 。

如何查看存储设备和分区列表?

注意: fdisk不起作用。


2
fdisk的工作,如果你传递一个设备,如fdisk -l /dev/block/mmcblk0
endolith

Answers:



26

我通常结合使用以下4个命令并将它们关联起来,因为这些命令中的每一个都提供了可能需要的信息。

总结:

  1. 使用df列出了文件系统路径别名和大小信息,如下所示(总大小,已使用,可用和块大小)

    • 输出示例:

      root@ks01lte:/sdcard # df
      df
      Filesystem                               Size     Used     Free   Blksize
      /dev                                   910.0M    92.0K   909.9M      4.0K
      /firmware                               64.0M     8.7M    55.2M     16.0K
      /firmware-modem                         64.0M    49.2M    14.8M     16.0K
      /system                                  2.2G     2.2G    62.7M      4.0K
      /data                                   11.9G     3.0G     8.9G      4.0K
      /cache                                  31.5M     4.1M    27.4M      4.0K
      /persist                                 7.9M     4.0M     3.8M      4.0K
      /efs                                    13.8M     4.4M     9.3M      4.0K
      /storage/emulated                      910.0M     0.0K   910.0M      4.0K
      /storage/emulated/0                     11.9G     3.0G     8.9G      4.0K
      /storage/emulated/0/Android/obb         11.9G     3.0G     8.9G      4.0K
      /storage/emulated/legacy                11.9G     3.0G     8.9G      4.0K
      /storage/emulated/legacy/Android/obb    11.9G     3.0G     8.9G      4.0K
      /mnt/media_rw/extSdCard                 29.7G   251.8M    29.5G     32.0K
      /storage/extSdCard                      29.7G   251.8M    29.5G     32.0K
      

      (...由于空间原因而削减)

  2. 使用cat /proc/mounts显示分区文件路径,别名,文件系统类型,startnig索引节点,块数,读/写状态(以及我不确定的单个分区的其他参数)

    • 注意:的输出cat /proc/mounts可能有点混乱,但是如果您逐行(逐项输入)仔细阅读,则会得到相关信息
    • 输出示例:

      root@ks01lte:/sdcard # cat /proc/mounts
      cat /proc/mounts
      rootfs / rootfs ro,relatime 0 0
      tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,size=931840k,nr_inodes=124673,mode=755 0 0
      devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
      none /dev/cpuctl cgroup rw,relatime,cpu 0 0
      proc /proc proc rw,relatime 0 0
      sysfs /sys sysfs rw,seclabel,relatime 0 0
      selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
      debugfs /sys/kernel/debug debugfs rw,relatime 0 0
      none /sys/fs/cgroup tmpfs rw,seclabel,relatime,size=931840k,nr_inodes=124673,mode=750,gid=1000 0 0
      /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0
      /dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
      /dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,errors=panic,data=ordered 0 0
      /dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
      /dev/block/platform/msm_sdcc.1/by-name/efs /efs ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
      

(...由于空间原因而削减)

  1. 使用cat /proc/partitions您将获得实际的分区名称标识符和分区中的块数。

    • 输出示例:

      root@ks01lte:/sdcard # cat /proc/partitions
      cat /proc/partitions
      major minor  #blocks  name
       253        0    1048576 vnswap0
       179        0   15388672 mmcblk0
       179        1      15360 mmcblk0p1
       179        2      58816 mmcblk0p2
       179        3        512 mmcblk0p3
       179        4         32 mmcblk0p4
       179        5         32 mmcblk0p5
       179        6       2048 mmcblk0p6
       179        7        512 mmcblk0p7
       179        8        512 mmcblk0p8
       179        9      10240 mmcblk0p9
       179       10      10240 mmcblk0p10
       179       11      14336 mmcblk0p11
       179       12       3072 mmcblk0p12
       179       13       3072 mmcblk0p13
       179       14      20480 mmcblk0p14
       179       15      20480 mmcblk0p15
       179       16      10240 mmcblk0p16
       179       17       7159 mmcblk0p17
       179       18       3072 mmcblk0p18 
      

      (...由于空间原因而削减)

  2. 使用ls -al /dev/block/platform/msm_sdcc.1/by-name您可以获取分区别名和实际分区文件的路径之间的映射(还可以获取所有者,其用户组等)。

    • 输出示例:

      root@ks01lte:/sdcard # ls -al /dev/block/platform/msm_sdcc.1/by-name
      ls -al /dev/block/platform/msm_sdcc.1/by-name
      lrwxrwxrwx root     root              2014-01-20 11:29 aboot -> /dev/block/mmcblk0p6
      lrwxrwxrwx root     root              2014-01-20 11:29 apnhlos -> /dev/block/mmcblk0p1
      lrwxrwxrwx root     root              2014-01-20 11:29 backup -> /dev/block/mmcblk0p17
      lrwxrwxrwx root     root              2014-01-20 11:29 boot -> /dev/block/mmcblk0p14
      lrwxrwxrwx root     root              2014-01-20 11:29 hidden -> /dev/block/mmcblk0p25
      lrwxrwxrwx root     root              2014-01-20 11:29 modem -> /dev/block/mmcblk0p2
      lrwxrwxrwx root     root              2014-01-20 11:29 persdata -> /dev/block/mmcblk0p22
      lrwxrwxrwx root     root              2014-01-20 11:29 persist -> /dev/block/mmcblk0p21
      lrwxrwxrwx root     root              2014-01-20 11:29 recovery -> /dev/block/mmcblk0p15
      lrwxrwxrwx root     root              2014-01-20 11:29 system -> /dev/block/mmcblk0p23
      lrwxrwxrwx root     root              2014-01-20 11:29 tz -> /dev/block/mmcblk0p8
      lrwxrwxrwx root     root              2014-01-20 11:29 userdata -> /dev/block/mmcblk0p26
      

      (...由于空间原因而削减)


1
没有/dev/block/platform/xxx/by-name/proc/emmc确实有,这很相似,但是没有列出启动分区。也没有cat /proc/mounts,而是使用mount
jiggunjer

6

可以从中获得更多有用的信息parted。块设备为/dev/block/mmcblk0以下示例:

~ # parted /dev/block/mmcblk0 print
Model: MMC SEM04G (sd/mmc)
Disk /dev/block/mmcblk0: 3959MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags
10      524kB   1573kB  1049kB               PIT
 6      1573kB  3146kB  1573kB               CSPSA FS
 7      4194kB  14.7MB  10.5MB  ext4         EFS
 2      14.7MB  31.5MB  16.8MB  ext4         Modem FS
14      32.5MB  34.6MB  2097kB               SBL
16      34.6MB  36.7MB  2097kB               SBL_2
 1      36.7MB  53.5MB  16.8MB               PARAM
12      53.5MB  55.6MB  2097kB               IPL Modem
13      55.6MB  72.4MB  16.8MB               Modem
15      72.4MB  89.1MB  16.8MB               Kernel
17      89.1MB  106MB   16.8MB               Kernel2
 3      106MB   748MB   642MB   ext4         SYSTEM
 5      748MB   2056MB  1309MB  ext4         DATAFS
 4      2056MB  2377MB  321MB   ext4         CACHEFS
 9      2377MB  2713MB  336MB   ext4         HIDDEN
11      2713MB  2765MB  52.4MB               Fota
 8      2765MB  3949MB  1184MB               UMS

~ #

4
parted未安装在我的设备上,因此默认情况下不可用。
史蒂夫·克鲁恩

2
您如何分开安装?
endlith

4

您可以通过droid上的busybox使用fdisk。因此,假设您的rom上有busybox二进制文件,并且在您的路径上,则命令将简单地是:

busybox fdisk [the various fdisk options...]

busybox fdisk -l /dev/block/sda

3

您只需使用以下命令即可查看所有已挂载分区的大小和使用情况统计信息:

df

请注意,典型值df -h在这里不起作用,因此不需要,因为输出已经以兆字节为单位。该命令可在adb shellAndroid终端模拟器中运行,但不能在“恢复”模式终端中运行,因为此时未安装任何内容。


3

旧线程,但发现没有其他人提到过……只是以防万一有人发现它有用。

ls -la /dev/block/bootdevice/by-name 该目录包含所有分区的命名符号链接。


0

仅对于内部存储,可以安装DiskInfo。但是它没有显示我的SD卡的文件系统。


0

用于列出mmcblk0分区:

猫/ proc / dumchar_info

Part_Name   Size    StartAddr   Type    MapTo
preloader    0x0000000000600000   0x0000000000000000   2   /dev/misc-sd
mbr          0x0000000000080000   0x0000000000000000   2   /dev/block/mmcblk0
ebr1         0x0000000000080000   0x0000000000080000   2   /dev/block/mmcblk0p1
pro_info     0x0000000000300000   0x0000000000100000   2   /dev/block/mmcblk0
nvram        0x0000000000500000   0x0000000000400000   2   /dev/block/mmcblk0
protect_f    0x0000000000a00000   0x0000000000900000   2   /dev/block/mmcblk0p2
protect_s    0x0000000000a00000   0x0000000001300000   2   /dev/block/mmcblk0p3
seccfg       0x0000000000020000   0x0000000001d00000   2   /dev/block/mmcblk0
uboot        0x0000000000060000   0x0000000001d20000   2   /dev/block/mmcblk0
bootimg      0x0000000000600000   0x0000000001d80000   2   /dev/block/mmcblk0
recovery     0x0000000000600000   0x0000000002380000   2   /dev/block/mmcblk0
sec_ro       0x0000000000600000   0x0000000002980000   2   /dev/block/mmcblk0p4
misc         0x0000000000080000   0x0000000002f80000   2   /dev/block/mmcblk0
logo         0x0000000000300000   0x0000000003000000   2   /dev/block/mmcblk0
expdb        0x0000000000080000   0x0000000003300000   2   /dev/block/mmcblk0
android      0x0000000000a00000   0x0000000003380000   2   /dev/block/mmcblk0p5
cache        0x000000002bc00000   0x0000000003d80000   2   /dev/block/mmcblk0p6
usrdata      0x00000000b6ca0000   0x000000002f980000   2   /dev/block/mmcblk0p7
bmtpool      0x0000000000000000   0x0000000037780000   2   /dev/block/mmcblk0
Part_Name:Partition name you should open;
Size:size of partition
StartAddr:Start Address of partition;
Type:Type of partition(MTD=1,EMMC=2)
MapTo:actual device you operate
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.