Vsftp: mount --bind at boot

I’ve manually created var/ftp directory that I want to populate with links to various folders I want to share and I want them to mount at boot.

So far I’m using manual “mount --bind” commands in terminal, as root and from the root directory, too:


mount --bind /media/SeagateExt/Software/ var/ftp/Software
mount --bind /home/stan/Download/ var/ftp/Download

There are several more similar lines.

How to automate this procedure?

I have a mountftp.sh file with all the commands but where to put it and how to run it at boot?

Would it be okay to put it into /etc/rc.d/rc1.d/? I wonder what will happen to my paths to the directories - I’m awfully terrible at figuring them out, as I said I’d rather run the commands from root than tweak the paths from home directory.

Should I change paths to mount --bind …/…/…/media/SeagateExt or something? Should I put the script into a different runlevel?

Is there any other way to mount my folders?

Put the bind mounts in /etc/fstab?

Do you mean to add mount --bind commands just as I run them in terminal? Never thought fstab worked that way.

bind is just another thing you can add in the options field. However because your directory is on an external device you would have to make sure that device is mounted first.

/media/SeagateExt/Software /var/ftp/Software none bind

That worked, thanks, I put the external drive mounts to the end of fstab.

Should I add some “sleep” time just in case the directories are not yet ready to mount? Originally I thought this should be done after the whole filesystem is properly initialized.

There isn’t any place for a sleep in fstab anyway. mounts are done in order in the file and are synchronous so a previous mount is ready to use further down the file.

That settles it, then, thanks again.

I’ll tackle the proper paths in .sh files on another occasion.