[SOLVED] mount bind, preserving directory contents
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Just had a bit of a scary moment when messing about with mount --bind
I have a directory full of files/directories that I wished to make accessible under another mount point (for FTP users)
So I ran...
Code:
mount --bind /var/ftp/user/newmountpount /mnt/raid6/folder/
Which then appeared to clear the directory completely of any files! Fortunately they re-appeared when I unmounted.
So here's my question...
Is there a way to have it so that the files/sub-directories are there when the mount bind is both mounted and unmounted?
Or is it a case of moving the existing files somewhere else.
Doing the mount --bind
Moving the files back again.
Then I guess I should also make an entry in fstab to re-mount when the machine is restarted.
The manual says "--move" moves the directory tree from A to B but "--bind" makes the directory tree accessible in both places. So I wonder how you determined the "files where not there". If it's over FTP then maybe there's a problem with access permissions? (And wrt permissions also see Fuse-bindfs.)
The destination folder is also a samba share and as soon as i did a bind mount the files disappeared from the share.
Also i tried an ls -lah and there were no files returned in the file listing
Everytime, when you mount something in one directory, it contents will be hidden and you see only the new content from mounted device. If you want to see two or more devices in one place look for unionfs. But I don't known if it works with samba. Anyway, why do you want to mount ftp directory in samba shared directory, create other directory and mount to it.
Thanks for the info. Thanks to your help I've figured it out.
I had the src and destination switched around the wrong way in my mount --bind command.
Fortunately it didn't trash the data in that directory.
So for the record, what I actually wanted to do was this...
Code:
mount --bind /mnt/raid6/folder/ /var/ftp/user/newmountpount
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.