I have a VM running on Win10 host (poor me) with Xubuntu 16.04 as guest. After installing a bunch of stuff the free space on the VM's dedicated HDD (10GB) shrunk pretty fast. I need to also install Qt which needless to say requires more than I can offer with the current HDD attached to the VM. Now there are multiple options how to proceed here (cloning the HDD, expanding it and then re-attaching it using Clonezilla; resizing the HDD using VirtualBox's tools (I have it as fixed size so it should work more or less) etc.). A couple of years ago I was facing a very similar problem with a bunch of very large projects that I had to work on in a Linux VM and back than I created a new HDD, partitioned it (a single logical partition with ext4 as FS), mounted it (edited /etc/fstab of course) and used it without any issues.

Here's the thing - I decided to dedicate the new HDD with its parition to /opt as a mounting point. However /opt is already taken by the first HDD when the initial installation of Xubuntu went through. I did that and needless to say the VirtualBox guest additions disappeared (the only thing that was in the previous /opt. Reinstalling these was not a problem at all so everything works fine now.

However this raised a question in my tiny brain namely when you adjust the mounting points (as in my case /opt from HDD 1 to /opt from HDD 2) what happens to the contents that were there?

1 Answer 1


When you mount a device to a directory (mount point) that was not empty, let's say /opt, the old contents of that directory become inaccessible.

Now /opt contains the files contained in the root directory of the device. However, the old files were not lost; when you unmount the device, you will see that /opt contains the old files.

This because when you mount a device, its filesystem root is only attached to the mount point -- it doesn't overwrite anything on the underlying filesystem. When you unmount the device, the filesystem root is detached. So it is possible to mount a device to a non-empty directory, but in general this should be avoided as it can be confusing.

  • 2
    Tested, true. Thanks a lot for the info. You are right, it's confusing doing this to a non-empty directory. XD Oct 5, 2016 at 14:15

You must log in to answer this question.

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