3

Few questions after the following commands:

mount -o bind /new_disk/home/user/ /home/user/

mount -o bind --no-mtab /new_disk/home/user/ /home/user/
  1. What is the difference between the two commands other than " Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem."

  2. What is the difference between mount -o bind and mount --bind ...if there are

  3. Let's suppose i don't know there is a partition mounted using -o bind --no-mtab...where can I find if there is any mount point with bind ? The only way i can detect this is grep user /proc/mounts but in that line there is no info abut bind.

Thank you.

1 Answer 1

2
  1. None.
  2. None.
  3. Hmm, never knew that. You could find duplicate source devices and stat both mountpoints. If inodes differ, you have a bind mount:

    dennis@lightning:/tmp/foo1$ grep uuid /proc/mounts
    /dev/disk/by-uuid/ae2c3836-ea2d-4d0e-8409-75d682889d1f / ext3 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
    /dev/disk/by-uuid/ae2c3836-ea2d-4d0e-8409-75d682889d1f /tmp/bar1 ext3 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
    
    dennis@lightning:/tmp/foo1$ stat -c %i /tmp/bar1 /
    1228938
    2
    

    However, if you bindmount one mountpoint to another (e.g. bindmounting / to /tmp/bar1), the inode numbers will be the same. Thus making it impossible to distinguish between a bind-mounted filesytem or a device simply mounted twice.

2
  • i hope there is a way of getting partitions mounted with bind if --no-mtab is given. I'll wait a few more days maybe someone will give me a hint :) but thank you for your explains
    – Ionut
    Dec 17, 2012 at 23:24
  • See bind mounts, mtab and read-only, bindmount one mountpoint to another is identical to mount the same filesystem on two places, at least from kernel point of view.
    – wimh
    Nov 21, 2016 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .