I just accidentally mounted a new drive to a folder that already contained files. I don't care about them and have them somewhere else, but that folder appears empty now. I'm curious what happened to the files. Are they simply deleted by Linux?

  • They don't "go" anywhere. You just can't see them. Jun 22, 2012 at 4:42
  • 6
    This is one of the amusing functions/features of mounting that I use/abuse sometimes to know the state of some things. Some mount points (the directory), I will leave an empty file not mounted in so that if I browse into it, I'll know immediately that it wasn't mounted for whatever reason.
    – killermist
    Jun 23, 2012 at 4:46

2 Answers 2


Just "shadowed" and will be there again when unmounted. :)

In fact the files are "there" intact and if you need to reach them right away, w/o unmounting, this can be worked-around with so-called bind mount:

mount --bind /Original/FS/Mount/Point /Somewhere/Else

It works (so) because when you ask kernel to mount a filesystem to some mountpoint, kernel treats that mountpoint as a "view port" to filesystem you're mounting, so it's expected you shall see mounted FS content there.

But this is not the only way how those FSes "layers" can be combined to single view. There's so called "union mount" approach (it's funny to know that this "a central concept in Plan 9", BTW). On Linux you could use Aufs, which never made its way into mainline kernel, or, currently (since 3.18), OverlayFS — it did.


The newly mounted filesystem is like an overlay which hides part of the initial filesystem. There are trick to access the files, like the bind mount as described by poige. On Linux I personally like the fact that you can mount a filesystem more than once on different mount points. So you can perfectly well mount the root filesystem on / as well as on /mnt. This comes in handy while debugging lost space / lost files / counting disk usage / ...


  • The old files are still there and using up space. It is a common mistake to have 'missing' disk space in files hidden by a mount. E.g. when you accidentally wrote large files in a directory and at some time decided to mount a filesystem on it. E.g. accidentally starting a large database before the logging filesystem was properly mounted ...
  • When a program has a file open which is subsequently hidden by a newly mounted filesystem, the program won't care about it and successfully keeps using the 'hidden' file until it closes it. From that moment, that file becomes invisible to the process until the new filesystem is unmounted and the underlying directory shows up again.

Not the answer you're looking for? Browse other questions tagged .