Android - How to list all major partitions with their labels?
As existing answers already show, there seems to be no "unique way" to achieve that. So I started combining ideas from allover, joining them into a script (or rather a "script library") to have them checked sequentially (until a good hit was made), and integrated that into my "Device Documentation Tool" named Adebar. Those interested can find it in the lib/partitions.lib
file. As Adebar is open-source (GPLv2), feel free to copy and use it – or fork the project and improve it.
The full solution is a bit long to post here (as said, you can grab it at Github), but as our policy is to include at least the general part in the post, here's what it does:
Different sources provide different sets of details, so it tries the "best ones" first – and then recurses down until at least something was found.
/proc/dumchar_info
gives the most details, so this is tried first. Happy MTK users will get this./proc/mtd
is the second best source./proc/emmc
should have almost as much as the previous candidates, but is a bit tricky to use/dev/block/platform/*/by-name
, cross-checked with …/proc/partitions
cross-checked with/proc/mounts
gives us at least the partitions mounted
So the script I've built basically walks the sources in this order, stopping as soon as it was able to collect details (e.g. if /proc/dumchar_info
was found, no need to parse all the others). All of them put into separate functions, returning data using the very same structure, one could even merge results from all of them.
If someone can come up with a better solution, I'm of course always open for the idea :)
I stumbled upon this question. I like a challenge...
Tools that I used: BusyBox
I've come up with 3 commands (one you listed) to give some info about the partitions
busybox ls -QAl --color=never /dev/block/platform/*/by-name
Output:
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "DDR" -> "/dev/block/mmcblk0p4"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "aboot" -> "/dev/block/mmcblk0p5"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "abootf" -> "/dev/block/mmcblk0p16"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "boot" -> "/dev/block/mmcblk0p18"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "cache" -> "/dev/block/mmcblk0p41"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "dbi" -> "/dev/block/mmcblk0p3"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "dbibak" -> "/dev/block/mmcblk0p10"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "drm" -> "/dev/block/mmcblk0p36"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "eksst" -> "/dev/block/mmcblk0p29"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "encrypt" -> "/dev/block/mmcblk0p28"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "factory" -> "/dev/block/mmcblk0p39"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "fota" -> "/dev/block/mmcblk0p34"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "fsc" -> "/dev/block/mmcblk0p25"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "fsg" -> "/dev/block/mmcblk0p24"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "grow" -> "/dev/block/mmcblk0p43"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "laf" -> "/dev/block/mmcblk0p33"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "misc" -> "/dev/block/mmcblk0p32"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "modem" -> "/dev/block/mmcblk0p1"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "modemst1" -> "/dev/block/mmcblk0p21"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "modemst2" -> "/dev/block/mmcblk0p22"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "mpt" -> "/dev/block/mmcblk0p38"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "pad" -> "/dev/block/mmcblk0p8"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "pad1" -> "/dev/block/mmcblk0p23"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "pad2" -> "/dev/block/mmcblk0p27"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "persist" -> "/dev/block/mmcblk0p19"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "rct" -> "/dev/block/mmcblk0p30"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "recovery" -> "/dev/block/mmcblk0p20"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "rpm" -> "/dev/block/mmcblk0p6"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "rpmbak" -> "/dev/block/mmcblk0p11"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "rpmf" -> "/dev/block/mmcblk0p13"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "sbl1" -> "/dev/block/mmcblk0p2"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "sbl1b" -> "/dev/block/mmcblk0p9"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "sdif" -> "/dev/block/mmcblk0p15"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "sns" -> "/dev/block/mmcblk0p37"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "spare1" -> "/dev/block/mmcblk0p17"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "spare2" -> "/dev/block/mmcblk0p31"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "spare3" -> "/dev/block/mmcblk0p35"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "ssd" -> "/dev/block/mmcblk0p26"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "system" -> "/dev/block/mmcblk0p40"
lrwxrwxrwx 1 0 0 20 Jan 30 1970 "tz" -> "/dev/block/mmcblk0p7"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "tzbak" -> "/dev/block/mmcblk0p12"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "tzf" -> "/dev/block/mmcblk0p14"
lrwxrwxrwx 1 0 0 21 Jan 30 1970 "userdata" -> "/dev/block/mmcblk0p42"
busybox blkid
Output:
/dev/block/vold/179:65: LABEL="ANDROID" UUID="87B8-10F1"
/dev/block/mmcblk1p1: LABEL="ANDROID" UUID="87B8-10F1"
/dev/block/mmcblk0p42: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p41: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p40: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p38: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p37: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p36: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p19: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b"
/dev/block/mmcblk0p1: UUID="00BC-614E"
busybox df -ma
Output:
Filesystem 1M-blocks Used Available Use% Mounted on
tmpfs 1415 0 1415 0% /dev
devpts 0 0 0 0% /dev/pts
proc 0 0 0 0% /proc
sysfs 0 0 0 0% /sys
selinuxfs 0 0 0 0% /sys/fs/selinux
debugfs 0 0 0 0% /sys/kernel/debug
none 0 0 0 0% /acct
none 1415 0 1415 0% /sys/fs/cgroup
tmpfs 1415 0 1415 0% /mnt/asec
tmpfs 1415 0 1415 0% /mnt/obb
none 0 0 0 0% /dev/cpuctl
/dev/block/platform/msm_sdcc.1/by-name/system 2524 715 1808 28% /system
/dev/block/platform/msm_sdcc.1/by-name/userdata 25620 5066 20514 20% /data
/dev/block/platform/msm_sdcc.1/by-name/cache 834 13 820 2% /cache
/dev/block/platform/msm_sdcc.1/by-name/persist 31 4 27 13% /persist
/dev/block/platform/msm_sdcc.1/by-name/modem 64 56 7 88% /firmware
/dev/block/platform/msm_sdcc.1/by-name/sns 8 4 4 52% /sns
/dev/block/platform/msm_sdcc.1/by-name/drm 8 4 3 56% /persist-lg
/dev/block/platform/msm_sdcc.1/by-name/mpt 31 13 18 41% /mpt
/dev/fuse 25620 5066 20514 20% /mnt/shell/emulated
/dev/block/vold/179:65 60891 10820 50071 18% /mnt/media_rw/sdcard1
/dev/fuse 60891 10820 50071 18% /storage/sdcard1