So I used the guide in this answer to mount a new volume to /var/www:

Allowing apache to access multiple volumes under AWS

However, after doing it, my /var/www appears to have been cleaned out. I know the files all still exist, because running a quick df shows no change in the disk usage in the original volume (/dev/xvda1). Where can I find these files? I really need to get them back.

  • What did you do with the files that were there? – Michael Hampton Sep 24 '13 at 1:58
  • I didn't do anything outside of the commands listed in the answer. There's a lost+found directory where the files were - could they be in there? – Fibericon Sep 24 '13 at 1:59
  • 5
    Unmount the new directory. – Michael Hampton Sep 24 '13 at 1:59
  • Wow, I was about to slam my head on my desk. Please make that an answer so I can mark it as the correct one. – Fibericon Sep 24 '13 at 2:03

Mounting a filesystem at a mount point hides any files that may be in that directory on the parent filesystem.

To resolve the issue, move your old files somewhere else temporarily and create a new empty directory to hold the mount point. Then move the files into the new filesystem.

sudo -i
mv /var/www /var/www.old
mkdir /var/www
mount /dev/xvd** /var/www
mv -v /var/www.old/* /var/www
rmdir /var/www.old
  • @MikeyB's answer is quite elegant in its own right, but this is a much more succinct explanation of the OP's issue. – jscott Sep 24 '13 at 2:14

Michael Hampton's answer is most correct, though I've posted about this before.

The easiest way of moving the files over to the new mountpoint is:

# cd /var/www
# vi /etc/fstab # (add the new disk to the fstab now so you don't forget!)
# mount /var/www
# mv * /var/www
  • 2
    Evil genius, yes. Though it's not immediately clear there what's going on. – Michael Hampton Sep 24 '13 at 2:07
  • 2
    I like teaching a man to fish. – MikeyB Sep 24 '13 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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