[Defy Q&A, Help & Troubleshooting] xkremlac:
Virtual partitions mount

There's script /system/bootmenu/2nd-boot/fshook.edit_devtree.sh in the bootmenu, which replaces real devices with virtual ones from fsimages on sdcard. This script is running twice: from init.hook.rc and 2nd-boot.sh.

I change fshook.edit_devtree.sh to write log on sdcard:

#### SYSTEM
# setup virtual image as device
losetup /dev/block/loop4 /fshook/mounts/imageSrc/fsimages/system.img 2>> /fshook/mounts/imageSrc/dev.log
rm /dev/block/mmcblk1p21 2>> /fshook/mounts/imageSrc/dev.log
mknod -m 0600 /dev/block/mmcblk1p21 b 7 4 2>> /fshook/mounts/imageSrc/dev.log

######## DATA
# setup virtual image as device
losetup /dev/block/loop6 /fshook/mounts/imageSrc/fsimages/data.img 2>> /fshook/mounts/imageSrc/dev.log
rm /dev/block/mmcblk1p25 2>> /fshook/mounts/imageSrc/dev.log
mknod -m 0600 /dev/block/mmcblk1p25 b 7 6 2>> /fshook/mounts/imageSrc/dev.log

######## CACHE
# setup virtual image as device
losetup /dev/block/loop5 /fshook/mounts/imageSrc/fsimages/cache.img 2>> /fshook/mounts/imageSrc/dev.log
rm /dev/block/mmcblk1p24 2>> /fshook/mounts/imageSrc/dev.log
mknod -m 0600 /dev/block/mmcblk1p24 b 7 5 2>> /fshook/mounts/imageSrc/dev.log

######## PDS
# setup virtual image as device
losetup /dev/block/loop2 /fshook/mounts/imageSrc/fsimages/pds.img 2>> /fshook/mounts/imageSrc/dev.log
rm /dev/block/mmcblk1p7 2>> /fshook/mounts/imageSrc/dev.log
mknod -m 0600 /dev/block/mmcblk1p7 b 7 2 2>> /fshook/mounts/imageSrc/dev.log

ls -l /dev/block/mmcblk1p* >> /fshook/mounts/imageSrc/dev.log

When some of virtual partitions (in this case it was cache) isn't mounted correctly, log file is following:

brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p1
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p10
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p11
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p12
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p13
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p14
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p15
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p16
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p17
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p18
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p19
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p2
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p20
brw------- 1 root root 7, 4 Feb 15 10:10 /dev/block/mmcblk1p21
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p22
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p23
brw------- 1 root root 7, 5 Feb 15 10:10 /dev/block/mmcblk1p24
brw------- 1 root root 7, 6 Feb 15 10:10 /dev/block/mmcblk1p25
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p3
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p4
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p5
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p6
brw------- 1 root root 7, 2 Feb 15 10:10 /dev/block/mmcblk1p7
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p8
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p9
losetup: /dev/block/loop4: No such file or directory
losetup: /dev/block/loop6: No such file or directory
losetup: /dev/block/loop5: No such file or directory
mknod: /dev/block/mmcblk1p24: File exists
losetup: /dev/block/loop2: No such file or directory
brw-rw---- 1 root system 179, 33 Feb 15 10:10 /dev/block/mmcblk1p1
brw------- 1 root root 179, 42 Feb 15 10:10 /dev/block/mmcblk1p10
brw------- 1 root root 179, 43 Feb 15 10:10 /dev/block/mmcblk1p11
brw------- 1 root root 179, 44 Feb 15 10:10 /dev/block/mmcblk1p12
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p13
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p14
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p15
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p16
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p17
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p18
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p19
brw------- 1 root root 179, 34 Feb 15 10:10 /dev/block/mmcblk1p2
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p20
brw------- 1 root root 7, 4 Feb 15 10:10 /dev/block/mmcblk1p21
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p22
brw------- 1 root root 7, 3 Feb 15 10:10 /dev/block/mmcblk1p23
brw------- 1 root root 179, 56 Feb 15 10:10 /dev/block/mmcblk1p24
brw------- 1 root root 7, 6 Feb 15 10:10 /dev/block/mmcblk1p25
brw------- 1 root root 179, 35 Feb 15 10:10 /dev/block/mmcblk1p3
brw------- 1 root root 179, 36 Feb 15 10:10 /dev/block/mmcblk1p4
brw------- 1 root root 179, 37 Feb 15 10:10 /dev/block/mmcblk1p5
brw-rw---- 1 root system 179, 38 Feb 15 10:10 /dev/block/mmcblk1p6
brw------- 1 root root 7, 2 Feb 15 10:10 /dev/block/mmcblk1p7
brw------- 1 root root 179, 40 Feb 15 10:10 /dev/block/mmcblk1p8
brw------- 1 root root 179, 41 Feb 15 10:10 /dev/block/mmcblk1p9

mknod couldn't create mmcblk1p24 device, although it looks like removed without warning before. And in the first run of this script mknod was create mmcblk1p24 correctly.