Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was trying to break some files out of my VirtualBox install of Ubuntu, and I accidentally mounted a VirtualBox shared folder onto ~, thereby erasing the very files I was trying to get at. Is there any way to recover my hard work, or am I just going to have to sudo rm -f /bin/mount and start over?

And no, I don't seriously intend to rm -f /bin/mount.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Mounting just hides the files under the mount point, it doesn't change them. If you unmount the VB share, you'll see your files again. You don't even need to unmount the share; you can move it:

mkdir /media/foo
mount --move ~ /media/foo
share|improve this answer
    
It gets better. Since I didn't do a persistent mount, I just had to reboot! <facepalm> –  Matt Jun 27 '11 at 20:03
add comment

While the contents of a directory become inaccessible when you mount a file system over the top, they aren't lost. Unmounting the file system should make them visible again. Something like the following:

sudo umount ~
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.