20

I'm having trouble finding an answer for this question

Does mount --bind persist over reboot?

On my CentOS it looks like it doesn't, so I've placed apropriate mount --bind calls in rc.local.

How can I do mount --bind to avoid rc.local scenario?

vnuk
  • 506
  • 1
  • 8
  • 17

2 Answers2

35

Create an entry for the bound mount in your /etc/fstab. An example is below.

/path/to/source/dir /path/to/mount/point none bind 0 0

nabrond
  • 661
  • 6
  • 10
  • What do the "none" and 0 0 do? – raphael75 Aug 23 '18 at 19:09
  • 2
    "none" represents the file system and "0 0" provide configuration used by [dump](https://linux.die.net/man/8/dump) and [fsck](https://linux.die.net/man/5/fstab), respectively. Since this is an existing path and not a unique disk/file system, empty or disabled values are specified for these fields. – nabrond Sep 23 '18 at 12:40
  • are source dir and mount point arguments in the same order as for the `mount` command? – John Bachir Sep 05 '19 at 15:45
  • @JohnBachir yes, same order – Mugen Mar 31 '20 at 11:36
0

You should add the appropriate info into /etc/fstab in order to mount the filesystem at boot.

ThatGraemeGuy
  • 15,473
  • 12
  • 53
  • 79