0

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.

Fibericon
  • 105
  • 3

2 Answers2

6

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
MikeyB
  • 39,291
  • 10
  • 105
  • 189
4

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
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • @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 02:14