Ubuntu – How to make mount –bind permanent

14.04fstabmount

When I am doing:

mount --bind dirone dirtwo

After OS reboot the binding is lost.

I am checking binded dirs in /proc/mounts

How can I make these binds permanent without clogging up /etc/fstab ?

Here's one entry from /proc/mounts

/dev/disk/by-uuid/4f5082d7-aba2-4bc7-8d64-3bbb3d773aab /home/username/dir ext4 rw,relatime,data=ordered 0 0

Best Answer

  • What do you mean "clogging up /etc/fstab"? The best place to put this in is /etc/fstab; that's what it was made for!

    All you have to do is add one line after the first mount:

    # <device>                                 <dir>                 <type>  <options>                 <dump>  <pass>
    UUID=288a84bf-876c-4c4b-a4ba-d6b4cc6fc0d2  /mnt/device            ext4    defaults,noatime,nofail   0       2
    /mnt/device                                /srv/binded_device     none    bind                      0       0
    
  • Related Question