Same partition mounted twice, showing a different content on each mountpoint. How is that possible ?
# mkdir /mnt/tmp
# mount -t ext4 -o noatime /dev/block/sda1 /mnt/tmp/
# mount | grep sda1
/dev/block/sda1 on /data type ext4 (rw,seclabel,noatime)
/dev/block/sda1 on /mnt/tmp type ext4 (rw,seclabel,noatime)
# ll /data
drwx------ 2 root root 4096 2021-08-19 18:34 adb
drwxrwxr-x 2 system system 4096 2021-08-19 18:34 anr
drwxrwx--x 8 system system 4096 2021-08-21 22:42 app
(...)
drwx--x--x 2 system system 4096 2021-08-19 18:34 user
drwx--x--x 3 system system 4096 2021-08-19 18:34 user_de
drwxrwx--x 3 root root 4096 2021-08-19 18:34 vendor
# ll /mnt/tmp/
drwxr-xr-x 3 root root 4096 2021-08-19 18:33 android-8.1-r6
drwxr-xr-x 2 root root 4096 2021-08-19 18:33 grub
drwx------ 2 root root 4096 1970-01-01 01:00 lost+found
The same partition, /dev/block/sda1
, is mounted twice, and each mountpoint (/data
and /mnt/tmp
) shows a different content.
Background : I wanted to modify GRUB's menu.lst
file, and in android-x86 it appears that file is only available from withing GRUB's debug mode, or from android itself by mounting /dev/block/sda1
. I did that, and indeed I could then access menu.lst
(/mnt/tmp/grub/menu.lst
), but how this works, and why /dev/block/sda1
shows a different content depending on the mountpoint is beyond me !
[ EDIT : answer given by user488112 below ]
It appears /data
is in fact mounted on /android-8.1-r6/data
, a sub-directory of /dev/block/sda1
, and not on the "root" of dev/block/sda1
. # mount
is incomplete (it only shows the device block, not the "root" of the mount) :
# egrep '/data|/mnt/tmp' /proc/self/mountinfo
18 15 8:1 /android-8.1-r6/data /data rw,noatime shared:3 - ext4 /dev/block/sda1 rw,seclabel
237 28 8:1 / /mnt/tmp rw,noatime shared:23 - ext4 /dev/block/sda1 rw,seclabel
# sync
didn't change nothing. I think it's probably android-x86 specific, but how ???