How to increase the size of vol on AWS
Friday, November 20th, 2009OK. First a huge disclaimer. If you’re a regular reader of this blog you’re not going to be interested in this post.
It’s a technical post which I’m leaving partly because I found the information very hard to find online, and partly because I’ll probably reference myself it in the future.
I should also point out we have a great sysadmin who looks after the Aroxo production system, but I’ve got a “knock about” server which I like to play with to help me understand what I’m doing, what I’ve done here refers to that server.
So here’s the scenario: you’re hosted using Amazon Web-Services EC2 platform. You’ve created a volume to store your data on, and you’ve run out of space. How do you increase the space on /vol using AWS?
Here are the steps which after a lot of messing around and a lot of help about I eventually found to work, some of this is based on this post. This might not be the most efficient way and some steps might be unnecessary and it’s based on a Debian install, maybe that makes a difference, maybe it doesn’t:
- Log onto your machine using SSH
- Type
umount /vol
to unmount your drive (note it’s umount, not unmount)
- If your machine tells you that the drive is use, and it probably will, do this:
-
fuser -m /vol
- You’ll get a list of the process IDs which are currently using the drive
- I then just killed them using
kill xxxx
but there’s probably a smoother way to shutting them down, you might want to think about that, like a clean shutdown of Apache and mysql at least
- Type
umount /vol
- Go to your AWS console
- Detach this drive from your instance
- Create a snapshot based on the volume and wait for it to complete
- Create a new, larger, drive based on the snapshot
- Attach the new drive (remember the mount point, maybe something like /dev/sdf)
- Back to SSH type
mount /dev/sdf /vol
- Type
xfs_growfs /vol
- Restart the box or the services you unceremoniously killed
- Check everything
- Breath a sigh of relief
- Make a cup of tea and find some to tell who’s likely to be impressed (if you find anyone, let me know).
That’s what I did, it worked but it wasn’t pretty.
