mkdir /home
then we mount something on /home
.
Say /home
already contains files.
What happen to the old files after a new drive is mounted to that directory?
mkdir /home
then we mount something on /home
.
Say /home
already contains files.
What happen to the old files after a new drive is mounted to that directory?
The mount will hide any existing files in the directory used as a mountpoint. Nothing happens to the files themselves.
If you want to access the hidden files without unmounting /home
, you can bind mount the underlying directory at another mountpoint:
$ mount --bind / /mnt
Now /mnt/home/
contains the files hidden by the /home
mount.
File stays there. Nothing happens to them. It is just hidden beneath the new layer.
But if you are looking for solution to see both file
a. directory /home content
b. mountpoint /home content
at the same time then you need to study aufs
df
(which accesses the used block counts from the file system), but wouldn't show up indu
output (asdu
wouldn't be able to access the files to get their size). – Thomas Nyman Sep 30 '13 at 07:35