mount --bind
| It's not as bad as ballancing your margarita on your laptop keyboard or trying to sit on a stack of precariously balanced running server towers wound in knots of network cable but it is n VERYs bad, n in proportion to the importance of the files that you are translocating. |
Do you really need to mount --bind ???
It's handy but do you need exactly the same files and directories in two places hot and live prehaps shared by two processes or more???
Does the same file really need to be in two places on the tree? Won't a copy do?
Try using cp -a instead !! SO if you think "mount --bind" then please think "cp -a ??" ! !
Addtionally think "ln -s ??? !!!!!"
Another option to mount --rebind is to use a symlink to the directory.
Why is that safer?
The symbolic link will not be followed in recursion from something like rm -rf but the rebound directory will. Everything below the rebound directory will be deleted in it's original location as well.
mount --bind ==> cp -a mount --bind ==> ln -s
There is no astrisk, bold print, or warning on the parent directories where you have translocated files. You need to create reminders for yourself if the files are important! !
If you can, rename containing directories with the original name of the remounted directory name or a note appended like:
foo_bin or testdir_mountbound
Put a POSTIT on your monitor and a stickynote on your desktop to remind you of the new dual tree location of the important files.
Don't assume that you will remember to unmount and clean up during the same session at the computer. Something will come up that will require your attention and you may forget and need to pick up where you left off later.
That being said why not try:
ls -Rm
This will let you browse your directory recursivly to doulbe check that you know what you are about to erase. It will remind you of forgotten ( desparite and depraved) mount --bind situations.
If you've used mount --bind then also do
mount
Note that I have not inclued any rm -i prostializing crap here. If you are not seaoned and are at all nervous with the command line then please have fun with rm -i and never use rm -rf. Several minutes of typeing 'Y' is better than hours required for data recovery, restoration, reinstallation or reproduciton. That being said I believe ls -Rm , mount, inspect thouse results and then rm -rf is a good alternative and I may write a script that does this for myself, one that requires typing 'y' 'e' 's' rather than just y but only once for the whole shabang.
************
Zarthon is a shlemiel living in Boston. He has been using linux for many years and has read 10000 warnings on mount --rebind and rm -rf used independently and together but recently used mount --rebind on /etc