- Android storage mount configuration
- # cat /init.rc
root@mv7420:/ # cat /init.rc | grep mount
….
# Create cgroup mount point for cpu accounting
mount cgroup none /acct cpuacct
….
# Create cgroup mount point for memory
mount tmpfs none /sys/fs/cgroup mode=0750,uid=0,gid=1000
mount cgroup none /sys/fs/cgroup/memory memory
….
# Secure container public mount points.
mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
….
# Filesystem image public mount points.
mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000
….
# memory control cgroup
mount cgroup none /dev/memcg memory
….
# Create cgroup mount points for process groups
mount cgroup none /dev/cpuctl cpu
….
# pstore/ramoops previous console log
mount pstore pstore /sys/fs/pstore
….
# once everything is setup, no need to modify /
mount rootfs rootfs / ro remount
# mount shared so changes propagate into child namespaces
mount rootfs rootfs / shared rec
….
|
- # cat /init.<device>.rc
root@mv7420:/ # cat init.samsungexynos7420.rc
import init.samsungexynos7420.usb.rc
on init
start watchdogd
chmod 0701 /mnt/media_rw
chown root root /mnt/media_rw
….
….
service setup_fs /system/bin/setup_fs mmcblk0p3 mmcblk0p4
class core
user root
group root
oneshot
service battery_charger /sbin/healthd -c
user root
group root
class charger
seclabel u:r:healthd:s0
on fs
mount_all /fstab.samsungexynos7420
setprop ro.crypto.fuse_sdcard true
# Boost Block I/O Performance
write /sys/block/sda/queue/read_ahead_kb 512
write /sys/block/sda/queue/rq_affinity 2
write /sys/block/sda/queue/iosched/slice_idle 0
# Permissions for ION
chmod 0660 /sys/class/ion_cma/ion_video_ext/isolated
chown system system /sys/class/ion_cma/ion_video_ext/isolated
# Permissions for backlight
chmod 0660 /sys/class/backlight/pwm-backlight.0/brightness
chown system system /sys/class/backlight/pwm-backlight.0/brightness
# Copy DRM Key
copy /system/app/wv.keys /factory/wv.keys
|
- External storage is managed by a combination of the vold init service and MountService system service. Mounting of physical external storage volumes is handled by vold, which performs staging operations to prepare the media before exposing it to apps.
https://source.android.com/devices/storage/config.html - Android 4.2.2 and earlier : /etc/vold.fstab
- Android 4.3 and later : /fstab.<device>
the raw physical device must first be mounted /devices/xxx, then vold will manage the sdcard0, usb1, usb2
# cat fstab.samsungexynos7420
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options>
<fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/platform/15740000.dwmmc0/by-name/system /system ext4 rowait
/dev/block/platform/15740000.dwmmc0/by-name/cache /cache ext4 noatime, nosuid,nodev,nomblk_io_submit,errors=panic wait
/dev/block/platform/15740000.dwmmc0/by-name/userdata /data ext4 noatime,
nosuid,nodev,nomblk_io_submit,discard,noauto_da_alloc,errors=panic wait,force encrypt=/cache/metadata
# VOLD
/devices/15560000.dwmmc2/mmc_host/mmc2 auto vfat default voldmanaged=sdcard0:auto
/devices/15510000.usb auto vfat default voldmana ged=usb1:auto
/devices/15400000.usb/15400000.dwc3/xhci-hcd auto vfat default voldmana ged=usb2:auto
|
- MMC device partition name
# ls -l /dev/block/platform/15740000.dwmmc0/by-name/
lrwxrwxrwx root root 2046-11-08 15:37 fat -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 2046-11-08 15:37 system -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 2046-11-08 15:37 userdata -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 2046-11-08 15:37 cache -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 2046-11-08 15:37 efs -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 2046-11-08 15:37 kernel -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 2046-11-08 15:37 ramdisk -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 2046-11-08 15:37 recovery -> /dev/block/mmcblk0p8 lrwxrwxrwx root root 2046-11-08 15:37 dtb -> /dev/block/mmcblk0p9 lrwxrwxrwx root root 2046-11-08 15:37 ldfw -> /dev/block/mmcblk0p10 lrwxrwxrwx root root 2046-11-08 15:37 bootlogo -> /dev/block/mmcblk0p11 lrwxrwxrwx root root 2046-11-08 15:37 font -> /dev/block/mmcblk0p12 lrwxrwxrwx root root 2046-11-08 15:37 engmode -> /dev/block/mmcblk0p13 |
- MMC device partition blocks
# cat /proc/partitions
major minor #blocks name
179 0 30535680 mmcblk0
179 1 32 mmcblk0p1
179 2 2662400 mmcblk0p2
179 3 26941360 mmcblk0p3
179 4 819200 mmcblk0p4
179 5 10240 mmcblk0p5
179 6 20480 mmcblk0p6
179 7 26624 mmcblk0p7
259 0 26624 mmcblk0p8
259 1 1024 mmcblk0p9
259 2 2048 mmcblk0p10
259 3 10240 mmcblk0p11
259 4 1024 mmcblk0p12
259 5 2048 mmcblk0p13
179 24 4096 mmcblk0rpmb
179 16 4096 mmcblk0boot1
179 8 4096 mmcblk0boot0
254 0 26941360 dm-0
|
- for MTD and EMMC devices, the partition layout and name can be retrieved by reading /proc/mtd, /proc/emmc