Allowing apache to access multiple volumes under AWS

I've added another volume to my EC2 instance (mounted as /dev/xvdf), and I need to be able to place files on that volume and be able to retrieve them via the /var/www/ directory. How can I accomplish this? This is an Ubuntu instance, if that makes a difference.


The simplest scenario may be to configure a partition on that block device, then to create a filesystem on it and finally to attach or so-called mount it at some directory.

  1. create a primary partition number 1 (follow the help) - sudo fdisk /dev/xvdf
  2. create an ext4 filesystem - sudo mkfs.ext4 /dev/xvdf1
  3. create a mountpoint - sudo mkdir /foo
  4. mount the filesystem - sudo mount /dev/xvdf1 /foo

If you wish you can mount it under /var/www directory as you asked. If you don't want to mount it there then configure another Apache2 VirtualHost with DocumentRoot pointing there. with To make the step 4 persistent, append this line to /etc/fstab:

/dev/xvdf1       /foo         auto    defaults        0       0

Finally, just google such kind of tasks and I'm sure you will find more detailed documentation how to do it as this is one of the most basic administration tasks.