Mounting Two Drives on Single Mount Point – Unexpected Results

filesystemslinuxmountpartition

I was running out of /tmp space on one of my servers today so I attached a new 100GB disk to the system and did the following without unmounting /usr/tmpDSK from /tmp:

mkfs.ext4 /dev/xvde
mount /dev/xvde /tmp

and now df -h outputs as:

Filesystem      Size  Used Avail Use% Mounted on
/usr/tmpDSK      98G  4.5G   89G   5% /tmp
/dev/xvde        98G  4.5G   89G   5% /tmp 

The size of /usr/tmpDSK shows :

[root@server2 usr]# ll -h /usr/tmpDSK
-rw------- 1 root root 2.3G Jan 27 17:32 /usr/tmpDSK 

Different forums suggested using mhddfs to mount multiple drives on a single mount point, but I just did it directly and it seems to have worked — or am I missing something?

I am hoping to better understand what actually happened.

Best Answer

When you mount a filesystem on top of a directory, the contents of that directory is hidden until the filesystem is unmounted.

If the directory was previously a mount point for another filesystem or not does not matter. If it was, then you need to unmount the new filesystem to access the files on the old filesystem (or to unmount the old filesystem).

Related:


I can't say much about the df output. On my OpenBSD system, the two filesystems will have correct individual stats in the df output.

Related Question