Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've rooted my device, put it in recovery mode, and have linked it to PC by adb shell.

How can I view the list of storage devices and partitions?

Note: fdisk doesn't work.

share|improve this question
    
fdisk works if you pass it a device like fdisk -l /dev/block/mmcblk0 – endolith Oct 4 '14 at 17:21
up vote 6 down vote accepted

I believe you want: cat /proc/mtd.

Also useful: mount.

share|improve this answer
2  
cat /proc/partitions shows a list of all the partitions too. I think mount correlates with cat /proc/mounts. Ah, good 'ol /proc – Ehtesh Choudhury Jul 18 '13 at 11:35
    
all I get is dev: size erasesize name whether I run as su or not. android.stackexchange.com/q/53225/693 – endolith Sep 28 '13 at 14:17
2  
/proc/mtd is not available on all devices, while /proc/partitions should be. – Izzy Jul 20 '15 at 16:33

I usually use a combination of the following 4 commands and correlate them, since each of these commands gives a piece of the information that might be needed.

Summarily:

  1. Using df lists the filesystem path alias and size info as seen below (total size, used, free and block size)

    • Example output:

      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
      

      (... cut for space reasons)

  2. Using cat /proc/mounts shows the partition file path, the alias, the filesystem type, the startnig inode, the number of blocks, read/write status (and other parameters of the individual partition that I'm not entirely sure of)

    • NB: The output of cat /proc/mounts can be a bit messy, but if you read it line by line (entry by entry) carefully you'll get the info
    • Example output:

      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
      

(... cut for space reasons)

  1. Using cat /proc/partitions you will get the actual partition name identifier and the number of blocks in the partition.

    • Example output:

      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 
      

      (... cut for space reasons)

  2. Using ls -al /dev/block/platform/msm_sdcc.1/by-name you get the mapping between the partition alias and the path of actual partition file (you also get the owner, their user group, etc)

    • Example output:

      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
      

      (... cut for space reasons)

share|improve this answer
    
Don't have /dev/block/platform/xxx/by-name. Did have /proc/emmc, which is similar, but doesn't list the boot partitions. Also don't have cat /proc/mounts, but used mount instead. – jiggunjer Feb 18 at 4:00

Even more useful information can be obtained from parted. An example when the block device is /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

~ #
share|improve this answer
1  
parted not installed on my device, so presumably not available by default. – Steve Kroon Nov 2 '15 at 9:00

You can see sizes and usage statistics of all mounted partitions by simply using this command:

df

Note, the typical df -h does not work here and is not needed because the output is already in megabytes. The command works within adb shell and the Android terminal emulator, but not in the Recovery mode terminal because nothing is mounted at that point.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.