pictures folder

Carruth, Rusty Rusty.Carruth at smartstoragesys.com
Tue Jan 29 11:18:56 MST 2013


Of course, if you say:

	sudo mount /whatever ~/Pictures

The tilde-expansion is done BEFORE the sudo takes effect, so you get the current user's home dir, not roots.  That is, the above line expands to 'sudo mount /whatever /home/currentuser/Pictures' before the 'sudo' is executed.

note that this is COMPLETELY different than the sequence:

	sudo su -
	mount /whatever ~/Pictures

which WILL expand ~ to "/root" so the command becomes 'mount /whatever /root/Pictures'

Possible head-exploding stuff follows:

One other thing to note is that when you mount 'over' a current directory tree, the directory tree is still there, just not visible from 'above'.

That is, if you do this:

	ls ~/Pictures
Picture1.jpg   picture2.jpg
	sudo mount /whatever ~/Pictures
	ls ~/Pictures
whatever.is.on.whatever.jpg
	sudo umount ~/Pictures
	ls ~/Pictures 
Picture1.jpg   picture2.jpg

Note that Picture1.jpg and picture2.jpg are still there, you just cannot see them.

However, if you happened to have a file handle or inode open for the place that got 'covered', you could still see the 'covered' stuff.  For example (and if this makes your head explode, sorry :-))

	cd ~/Pictures ; ls
	cd ~/Pictures ; ls
Picture1.jpg   picture2.jpg
	sudo mount /whatever ~/Pictures
	pwd
/home/me/Pictures
	ls
Picture1.jpg   picture2.jpg
	ls ~/Pictures
whatever.is.on.whatever.jpg

This also holds true if you do a remove of a file or directory.  If you are IN a directory and someone or something does an rm -rf that includes the directory you are in, all files in that directory go away, but you can still say 'ls' and see... NOTHING!

For exmaple:

Window 1:
	mkdir -p ~/killme1/killme2 # make both killme1 and killme2 inside it.

Switch to window 2.
	cd ~/killme1/killme2
	touch foobar
	ls 
foobar

Switch back to window 1:

	rm -rf killme1
	cd killme1/killme2
(fails, because you deleted it)

Switch back to window 2:

	ls
	cd ..
If I remember right, the above cd will fail.  Note that the file ('foobar') is gone.  I forget what happens with an ls -l from within killme2 - I think you have . and .., but directory '..' (that is ~/killme1) is gone, so you cannot CD there.  Try it if you are curious.  For the extreme crazies, you might be able to create a file here in this directory - but I'll bet you end up with an orphan inode when you do, because as soon as all references to the current directory (that is, ~/killme1/killme2) are gone, that directory is deleted (oh, ok, not deleted but finally allowed to go into the pool of 'free' inodes).


 Rusty

> -----Original Message-----
> 
> On 01/29/2013 12:24 AM, Michael Havens wrote:
> > I have a question
> > though, I tested it and when I copied a file into
> > /home/bmike1/Pictures the file went to the desired directory. Why if
> I
> > copy it to the desired directory directly does it not go to
> > /home/bmike1/Pictures also? It must have to do with the order you put
> > the the two directories in
> 
> A bind mount works like mounting any other hard drive.  Everything
> below the place that you mount the filesystem gets replaced by the
> drive you mount on top of it.  If your filesystem were a tree it would
> be like cutting off a limb and grafting a new limb onto where you cut
> it off.
> There is a way to layer up directories, it's call a Union filesystem
> and allows you to merge directories together, but they are a little
> harder to setup that just a simple mount.
> 
> > sudo mount ~bmike1/Pictures
> >
> > why is it '~bmike1/Pictures' and not '~/bmike1/Pictures'?
> 
> the ~ means "home directory of", if you have just a ~ by itself it will
> refer to the home directory of the current user, if you put a ~ in
> front of a user name, it means the home directory of that user.
> Since you were most likely mounting stuff as root, you needed to
> include the user name after the ~, otherwise you could have simply put
> ~/Pictures.
> In your case if you were to have put ~/bmike1/Pictures, as root it
> would actually turn into the path /root/bmike1/Pictures or if you had
> run the command as bmike1 it would have really meant
> /home/bmike1/bmike1/pictures
> 
> Brian Cluff
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org To
> subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list