[CentOS] mount bind problem

Thu Apr 14 01:44:55 UTC 2016
望月忠雄 <tadao at creative-japan.org>

Dear Robert,

Thank you.
The state after reboot are as follows.

# LANG=C lsblk
NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                          11:0    1 1024M  0 rom
vda                         252:0    0   15G  0 disk
|-vda1                      252:1    0  500M  0 part /boot
`-vda2                      252:2    0 14.5G  0 part
  |-VolGroup-lv_root (dm-0) 253:0    0 12.5G  0 lvm  /
  `-VolGroup-lv_swap (dm-1) 253:1    0    2G  0 lvm  [SWAP]
vdb                         252:16   0   40G  0 disk /mnt/extradiskA


# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw,usrquota,grpquota)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/vda1 on /boot type ext4 (rw)
/dev/vdb on /mnt/extradiskA type ext4 (rw,usrquota,grpquota)
/mnt/extradiskA/home on /home type none (rw,bind)
/mnt/extradiskA/log on /var/log type none (rw,bind)
/mnt/extradiskA/mysql on /var/lib/mysql type none (rw,bind)
/mnt/extradiskA/.backup on /.backup type none (rw,bind)
/mnt/extradiskA/.daily_backup on /.daily_backup type none (rw,bind)
/mnt/extradiskA/backups on /var/backups type none (rw,bind)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/vdb on /home type ext4
(rw,relatime,barrier=1,data=ordered,usrquota,grpquota)

# ls -l /home
total 48
-rw------- 1 root  root   7168 Nov 15 19:10 aquota.group
-rw------- 1 root  root   7168 Apr 14 10:22 aquota.user
drwxr-x--- 2 root  root   4096 Jan 18 21:55 backups
drwxr-xr-x 4 root  root   4096 Jan  1 11:59 home
drwxr-xr-x 8 root  root   4096 Apr 14 10:23 log
drwx------ 2 root  root  16384 Nov 15 18:58 lost+found
drwxr-xr-x 6 mysql mysql  4096 Apr 14 10:24 mysql
# ls -al /mnt/extradiskA
total 72
drwxr-xr-x  9 root  root   4096 Nov 15 19:10 .
drwxr-xr-x. 3 root  root   4096 Nov 15 19:00 ..
-rw-------  1 root  root   7168 Nov 15 19:10 aquota.group
-rw-------  1 root  root   7168 Apr 14 10:22 aquota.user
drwxr-xr-x  2 root  root  12288 Apr 14 00:00 .backup
drwxr-x---  2 root  root   4096 Jan 18 21:55 backups
drwxr-xr-x  2 root  root   4096 Nov 16 02:30 .daily_backup
drwxr-xr-x  4 root  root   4096 Jan  1 11:59 home
drwxr-xr-x  8 root  root   4096 Apr 14 10:23 log
drwx------  2 root  root  16384 Nov 15 18:58 lost+found
drwxr-xr-x  6 mysql mysql  4096 Apr 14 10:24 mysql

# ls -al /mnt/extradiskA/home
total 16
drwxr-xr-x  4 root    root    4096 Jan  1 11:59 .
drwxr-xr-x  9 root    root    4096 Nov 15 19:10 ..
drwxr-xr-x. 7 admin   admin   4096 Sep 21  2015 admin
drwxr-xr-x  4 kavfile kavfile 4096 Jan  1 12:00 kavfile

# mkdir /tmp/tmproot
# mount --bind / /tmp/tmproot
#  ls -a /tmp/tmproot/mnt/extradiskA
.  ..


# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Jul 28 08:21:01 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4
 defaults,usrquota,grpquota        1 1
UUID=9a855356-ee00-4ae7-a185-226566ce1dba /boot                   ext4
 defaults        1 2
UUID=093c9b95-8336-4682-9927-132dbdf2f082 /mnt/extradiskA     ext4
 defaults,usrquota,grpquota      1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults
 0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/mnt/extradiskA/home    /home                   none    bind            0 0
/mnt/extradiskA/log     /var/log                none    bind            0 0
/mnt/extradiskA/mysql    /var/lib/mysql         none    bind            0 0
/mnt/extradiskA/.backup /.backup                none    bind            0 0
/mnt/extradiskA/.daily_backup  /.daily_backup   none    bind            0 0
/mnt/extradiskA/backups  /var/backups           none    bind            0 0


2016-04-13 23:32 GMT+09:00 Robert Nichols <rnicholsNOSPAM at comcast.net>:

> On 04/13/2016 12:02 AM, 望月忠雄 wrote:
>
>> In /etc/rc.d/rc.sysinit,
>> there's "mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2i,glusterfs -O
>> no_netdev".
>>
>>
>> I have other same type servers. And on other servers with same /etc/fstsb,
>> file system is correct.
>> There's no difference between normal server's rc.sysinit and this problem
>> server's rc.sysinit too.
>>
>
> It's not apparent how /dev/vdb (the whole filesystem) came to be mounted
> on both /mnt/extradiskA and /home.  Let's see the output
> from "lsblk" and "mount".  Did you look in /mnt/extradiskA/home
> and verify that just the expected user directories are there
> (no "/mnt/extradiskA/home/home")?
>
> It might also be worthwhile to verify that the mount point
> directory /mnt/extradiskA in the root filesystem is empty.  If
> there happens to be a /mnt/extradiskA/home directory present
> before /dev/vdb gets mounted, that could allow the mounts to
> be performed out of order, though I don't really see how that
> could lead the to result you have.
>
>     mkdir /tmp/tmproot
>     mount --bind / /tmp/tmproot
>     ls -a /tmp/tmproot/mnt/extradiskA
>     umount /tmp/tmproot
>
>
> --
> Bob Nichols     "NOSPAM" is really part of my email address.
>                 Do NOT delete it.
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>