On 02/12/15 at 01:03pm, Karel Zak wrote:
On Thu, Feb 12, 2015 at 01:50:32PM +0800, Dave Young wrote:
> > The mountpoint created by bind operation is independent on previous
> > mounts,
> >
> > mount /mnt/sda1 /A
> > mount --bind /A /B
> > umount /A
> >
> > is pretty valid situation and /B still points to the filesystem.
>
> Hmm, got it, so they are equal, but for subdirectory mount there will be
> dependency?
No, you can still umount, it's just kernel feature that mount can
points to non-root filesystem directory.
# findmnt /dev/sdc1
TARGET SOURCE FSTYPE OPTIONS
/mnt/B /dev/sdc1[/subdir] ext4 rw,relatime,seclabel,stripe=32,data=ordered
/mnt/A /dev/sdc1 ext4 rw,relatime,seclabel,stripe=32,data=ordered
# umount /mnt/A
# findmnt /dev/sdc1
TARGET SOURCE FSTYPE OPTIONS
/mnt/B /dev/sdc1[/subdir] ext4 rw,relatime,seclabel,stripe=32,data=ordered
Karel
Hi, All!
Thanks Karel for explaination.
Dave, I think we should not mount the root in the 2nd kernel. Since
the root and "/var" are bind mount directory, we don't need to mount the
root firstly. I think we can do whatever we want, if we mount the device
where the root and "/var" are in.
Following is the tree in atomic.
-bash-4.2# findmnt /
TARGET SOURCE FSTYPE OPTIONS
/
/dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/deploy/4b513b5012db32d51b411f8e54e357a231f92b94ff6343bc0fb44cb53b9e0941.0]
xfs rw,relat
-bash-4.2# findmnt /var
TARGET SOURCE FSTYPE OPTIONS
/var /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]
xfs rw,relat
We can find the fact that the root directory is a bind mount directory which
points to the
/ostree/deploy/rhel-atomic-host/deploy/4b513b5012db32d51b411f8e54e357a231f92b94ff6343bc0fb44cb53b9e0941.0
directory, and "/var" points to the /ostree/deploy/rhel-atomic-host/var
directory.
To summarize the point, we can mount the device (/dev/mapper/atomicos-root) to
dump to the corresponding subdirecotry (/ostree/deploy/rhel-atomic-host/var).
Thanks
Minfei
--
Karel Zak <kzak(a)redhat.com>
http://karelzak.blogspot.com