Light on Dark -:- User Guides

Adding disk space to your server

We have used an AMI with 8GB of virtual disk storage attached - this is normal for Ubuntu images. 8GB is plenty to run most applications but you will soon run out if you upload a couple of movies, so you may need to add more.

There are also good reasons to have multiple disks as it makes archiving and upgrading easier. For example if you have your MySQL files on a different drive, you can use snapshots to back up your data; use a different drive for the filestore, as a small database will snapshot very quickly while a large filestore may take minutes to snap.

If you think 8GB will be enough, skip this section and save yourself some money!  If you want more disk space, you will need to set up another EBS volume, but you have already used your free allotment so this will cost you – about $0.11 per GB Month, so 10GB of EBS will cost you about $1.1 per month – not bad really!

To set up a new volume, there are three steps - create the volume, attach it to the server and then mount it.

Create a Volume

in AWS management console, select 'Elastic Block Storage', 'Volumes', and click the 'Creates Volume' button
AWS console

Say how big you want the disk to be, select an availability zone, and click 'Yes, Create'.
create volume

You will see the new volume being created;
show volumes

once it is ready, right click and select 'Attach Volume'
attach link

Oops - we have a problem. A long time ago, when we created the server instance, we did not specify the availability zone to be used. Because we didn't check this and didn't set the correct availability zone for this volume, we get the message like this:
no instances found

There's no point in keeping (and paying for) this disk space, so right click on the volume and select delete:
detach volume

And while that is deleting, we will have another go. If you look at the existing volume, you will see it is in zone eu-west-1b, so this time select the correct availability zone.
try again

This looks better; we can see our ResourceSpace instance, and we can select a device to attach the volume to.

If you get the notes about xvds in the latest versions of Linux, make sure you read and understand it as it may confuse you later if you have not seen this. Since we are using the latest version of Ubuntu for this demonstration, we will be getting back to this later.
that's better

And here you can see the old disk attached as sda1 and the new disk attached as sdf. As far as AWS is concerned, this disc is now in use, but you still need to mount it before your application can see it.
two volumes attached


Formatting and mounting the disk

Having attached the disk through the AWS console, we need to use SSH to format and mount it. Log in to your SSH client.

Referring back to the notes above, we will see if it is sdf or xvdf by looking at the existing drive.

ls -l /dev/disk/by-uuid

existing volume
We have xvda1 so our new drive will be xvdf.

If you have placed your new disc on an existing snapshot, it will probably appear on this list as well as the old disk. If you have created a brand-new volume, it will need formatting before it can be mounted.

To format the disk, use the following command. ext4 is the latest Linux disk format; you may prefer to use the older ext3, or you could use fat32 to make a disk which is compatible with Windows systems. if your existing disk is shown as being sda1, replaces the /dev/xvdf with /dev/sdf

sudo mkfs -t ext4 /dev/xvdf

We can check that the format is complete by doing another ls as before

ls -l /dev/disk/by-uuid

Which should now show both drives:
new volume 

mount the drive

Now we have a formatted disk attached, we need to mount it.  We will do this in fstab so they will automatically re-mount on boot.

Start by creating a mount point - we are going to mount this drive as a folder under /mnt – the traditional place to mount disks. If you do not understand mounting file systems under Linux don't worry about it – just follow these instructions. If you do understand it and would prefer to mount the drive elsewhere, then why are you reading this guide?

sudo mkdir /mnt/storage

If you have not already done so, check the disk is available and formatted

ls -l /dev/disk/by-uuid

new volume 

Edit /etc/fstab, which is the file used on boot to remount drives, and add the new drive information. Please remember if you are using an older version of Linux, you should use /dev/sdf instead.

sudo nano  /etc/fstab

/dev/xvdf        /mnt/storage    auto    defaults        0       0

It should look like this:
fs tab

Save the file and exit Nano – use alt-x and answer yes twice

Now, run the command to mount all the drives in fstab:

sudo mount -a

check that the disk has been mounted and is available by using the df command, the -h switch gives the result in MB or GB rather than just in bytes:

df –h

file system use

How good is your maths?  9.9 G – 151M = 9.2G??


Map space on this drive to use by your applications

Having created this new disc, we need to decide how it is going to be used. the major difference between this volume and the default volume is that this volume will not disappear when the instance is terminated, so all our permanent data should be stored on this volume. With ResourceSpace, there are three types of permanent data: the database, the application and the file store. Fortunately, in a default configuration the file store is stored within the application folders, so we just need to map the application folder to this volume. Instructions for storing the database on this volume can be found in the phpMyAdmin guide; here, I will show you how to map the application folder (and the file store) to this volume, and get back to discussing alternatives at a later date. If you have any specific questions, please ask them in the forum.

We need to create a new folder on this volume and then map (link) it to the ResourceSpace folder for a default install. If you have already installed ResourceSpace in a different folder, please use that folder name here instead of RS. Please remember that in Linux filenames are case sensitive, so ResourceSpace/ and resourcespace/ are different folders.

Start by making a ResourceSpace folder on the new drive

sudo mkdir /mnt/storage/ResourceSpace

Now Change this folder so it belongs to the Apache user, and give everybody read access to it.

sudo chown www-data:www-data /mnt/storage/ResourceSpace

sudo chmod -R 755 /mnt/storage/ResourceSpace

Make sure the destination folder does not already exist, as that will cause confusion.

sudo rm -R /var/www/RS

And finally, we have the command to link the folder on the new disc to a virtual folder for ResourceSpace:

sudo ln -s /mnt/storage/ResourceSpace /var/www/RS

We now have something called a symlink - a symbolic link, which unlike Windows mapping can the navigated in both directions – if I go to /var/www/RS I will see the exact same files as if I go to /mnt/storage/ResourceSpace

If you want to put MySQL data on this volume as well, see

And that's just about it for now – more will follow later.


just making sure we have a vertical scroll bar, otherwise it jitters sideways.