[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A Basic Mount Observation



Hi,

Cindy Sue Causey wrote:
> $ ls
> $ *STILL. crickets.*

You need to re-enter the directory, because the thing which now has
its name is not the directory which you entered before mount.

All programs which show the mounted content have addressed the directory
by its name after the mount operation.
Those programs which show the empty mount point directory have resolved
the address to a directory inode before the mount operation.


Let's look at device and inode numbers rather than names:

  # stat --format='%d %i' /mnt/iso
  2051 11796486
  # cd /mnt/iso
  # ls -ldi .
  11796486 drwxr-xr-x 2 root root 4096 ...date... .

You see that the mount point directory has inode number 11796486 in its
filesystem on device 2051.
Now with mounting

  # mount test.iso /mnt/iso
  # stat --format='%d %i' /mnt/iso
  1792 1216
  # ls -ldi /mnt/iso
  1216 dr-xr-xr-x 1 root root 2048 ...other.date... /mnt/iso

The mounted directory has inode number 1216 in the mounted ISO filesystem
on device 1792.

But your working directory is still the other inode

  # ls -ldi .
  11796486 drwxr-xr-x 2 root root 4096 ...date... .

Now set your working directory to what is pointed to by path /mnt/iso:

  # cd /mnt/iso
  # ls -ldi .
  1216 dr-xr-xr-x 1 root root 2048 ...other.date... .

Now you are in the root inode of the ISO and normally cannot unmount
before you leave it.

Go away and unmount to see the inode numer in the disk filesystem again:

  # cd
  # umount /mnt/iso
  # ls -ldi /mnt/iso
  11796486 drwxr-xr-x 2 root root 4096 ...date... /mnt/iso


Have a nice day :)

Thomas


Reply to: