February 8, 2013

Linux CentOS 6: strange behaviour with multiple devices on single mount point !!!

Posted in Linux at 11:18 am by alessiodini

I’m doing a lot of tests , experiments on my CentOS.

Yesterday i was experimenti a LVM mirror recovery and i found two devices mounted on same mount point: /mnt

I tought “damn due to my experiments i erased the system again…”

Later i was curious about to try it again. IT WORKED , how is that possible?

I can do this even now:

[root@centos6 ~]# cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m

[root@centos6 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
ale rootvg -wi-a— 1.00g
ale2 rootvg -wi-a— 104.00m
mau rootvg -wi-a— 1.00g
rootvol rootvg -wi-ao– 13.46g
swap2vol rootvg -wi-a— 2.00g
swapvol rootvg -wi-ao– 2.05g
test rootvg -wi-ao– 200.00m
mirrvol testvg mwi-a-m- 2.00g mirrvol_mlog 100.00

[root@centos6 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
rootvg 1 7 0 wz–n- 24.51g 4.70g
testvg 2 1 0 wz–n- 9.98g 5.98g

[root@centos6 ~]# mount /dev/mapper/rootvg-test /mnt
[root@centos6 ~]# mount /dev/mapper/testvg-mirrvol /mnt

[root@centos6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootvol
14G 4.4G 8.2G 35% /
tmpfs 498M 188K 498M 1% /dev/shm
/dev/sda1 485M 33M 427M 8% /boot
/dev/mapper/rootvg-test
2.0G 67M 1.9G 4% /mnt

/dev/mapper/testvg-mirrvol
2.0G 67M 1.9G 4% /mnt

I need to understand. NOW !!

Advertisements

2 Comments »

  1. Ramdev said,

    out of my curiosity, i have tested it on rhel 6.3 and observed the similar behavior, but not too strange.

    whenever you try to mount new device on top of existing mount, the current data is going one layer down and the mnt just shows the recent mount device data. It is similar to mounting a device on top of non-empty mount directory.

    I believe this was because of the flexible binding mount features added from Linux 2.4.0 kernel ( but not exactly sure)

    [root@gurkulrhel2 ~]# mount /dev/mapper/vg_gurkulrhel2-data1 /mnt

    [root@gurkulrhel2 ~]# grep mnt /etc/mtab
    /dev/mapper/vg_gurkulrhel2-data1 /mnt ext2 rw 0 0

    [root@gurkulrhel2 ~]# ls -l /mnt
    total 20
    drwxr-xr-x 2 root root 4096 Feb 10 06:18 data1-mount-dir
    drwx—— 2 root root 16384 Feb 10 06:16 lost+found

    [root@gurkulrhel2 ~]# df -k /mnt
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/vg_gurkulrhel2-data1
    2064208 3076 1956276 1% /mnt

    [root@gurkulrhel2 ~]# mount /dev/mapper/vg_gurkulrhel2-data2 /mnt
    [root@gurkulrhel2 ~]# grep mnt /etc/mtab
    /dev/mapper/vg_gurkulrhel2-data1 /mnt ext2 rw 0 0
    /dev/mapper/vg_gurkulrhel2-data2 /mnt ext2 rw 0 0

    [root@gurkulrhel2 ~]# ls -l /mnt
    total 20
    drwxr-xr-x 2 root root 4096 Feb 10 06:18 data2_mount_dir
    drwx—— 2 root root 16384 Feb 10 06:16 lost+found

    [root@gurkulrhel2 ~]# df -k /mnt
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/vg_gurkulrhel2-data2 1032088 1288 978372 1% /mnt

    [root@gurkulrhel2 ~]# mount /dev/mapper/vg_gurkulrhel2-data3 /mnt

    [root@gurkulrhel2 ~]# grep mnt /etc/mtab
    /dev/mapper/vg_gurkulrhel2-data1 /mnt ext2 rw 0 0
    /dev/mapper/vg_gurkulrhel2-data2 /mnt ext2 rw 0 0
    /dev/mapper/vg_gurkulrhel2-data3 /mnt ext3 rw 0 0

    [root@gurkulrhel2 ~]# ls -l /mnt
    total 12
    drwx—— 2 root root 12288 Feb 10 06:31 lost+found

    [root@gurkulrhel2 ~]# df -k /mnt
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/vg_gurkulrhel2-data3 495844 10543 459701 3% /mnt

    [root@gurkulrhel2 ~]# umount /mnt

    [root@gurkulrhel2 ~]# grep mnt /etc/mtab
    /dev/mapper/vg_gurkulrhel2-data1 /mnt ext2 rw 0 0
    /dev/mapper/vg_gurkulrhel2-data2 /mnt ext2 rw 0 0

    [root@gurkulrhel2 ~]# df -k /mnt
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/vg_gurkulrhel2-data2 1032088 1288 978372 1% /mnt

    [root@gurkulrhel2 ~]# umount /mnt

    [root@gurkulrhel2 ~]# grep mnt /etc/mtab
    /dev/mapper/vg_gurkulrhel2-data1 /mnt ext2 rw 0 0

    [root@gurkulrhel2 ~]# df -k /mnt
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/vg_gurkulrhel2-data1 2064208 3076 1956276 1% /mnt

    [root@gurkulrhel2 ~]# umount /mnt

    [root@gurkulrhel2 ~]# df -k /mnt
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/vg_gurkulrhel2-lv_root 11941808 7084108 4251084 63% /

    [root@gurkulrhel2 ~]#

    • alessiodini said,

      Nice job 🙂
      Now it’s a little bit more clear !


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: