Sunday, August 2, 2009

Growing an XFS partition on Amazon EBS

Amazon EBS is Amazon's Persistent Storage service. I think of it as the ability to have a "thumbdrive in the clouds". I can then "attach" that drive to an Amazon EC2 instance (a machine in the clouds).

Today I needed to add space to a filesystem. The filesystem was 10G XFS partition and I wanted to make it 30G. (don't try this if you're not using XFS, some of these notes are XFS specific).

With the help of Elastic Fox this is pretty easy. Also make sure that you have the xfs_growfs application installed on your server. On Ubuntu/Debian 'apt-get install xfsprogs'.

update: You can do all of this with Amazon Web Console now, Elastic Fox is not the recommended choice.

1. Under ElasticFox > Volumes and Snapshots, I selected the Volume I wanted to work with and chose "create a new snapshot from this volume"
2. Under ElasticFox > Volumes and Snapshots, I selected the newly created snapshot and chose "create new volume from this snapshot" (making sure to specify a size of 30G).
3. Then I detached the old volume and attached the new volume (in this case to /dev/sdp)
4. Finally, I logged in to the server and ran the xfs_growfs command 'xfs_growfs /dev/sdp', my filesystem "magically" grew to be 30G.

I've been working, on and off with EC2 for a few months now. We now have clients hosted on EC2 based infrastructure. Amazon's Elastic Compute Cloud (EC2) is a utility that makes it possible to run virtual machines (Linux,Windows and others) on remarkably powerful infrastructure provided by Amazon.

Recently I tried attaching my new volume to a different device '/dev/sdg' in this case. When I tried to mount the new device I got a 'wrong fs' error. The problem is that I was not able to mount the new device while another device with the identical UUID existed. The solution was to run the following command which generates a new UUID for my new device:

xfs_admin -U generate /dev/sdg

1 comment:

Carlos said...

Do I need to unmount the volume before the dettach?

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos