Category Archives: ebs

Enlarge Amazon EBS Volume

The easiest way enlarge an EBS volume is obviously by creating a snapshot ,create a new volume using that snapshot with a higher capacity. Unfortunately, once you mount the new EBS volume,you will notice that it’s size is the same. Below are the tips how to fix it.

If filesystem of the volume is EXT3:

I got a chance to create a snapshot of 200Gb EBS volume previously formatted using EXT3. After the snapshot which takes a little longer, need to create another 500GB volume from the snapshot because the older EBS about to be filled up with more data. Following steps posted by izyboyd found at:

Procedure to enlarge ext3 EBS volume from snapshot

Update: Commands for enalarging EXT3

 umount /mnt/ebs1 
# ElasticFox -> volumes -> right click -> create a new snapshot from this volume 
# ElasticFox -> snapshots -> right click -> create new volume from this snapshot (with increased size) 
# ElasticFox -> volumes -> right click ->; attach /dev/sdi 
fdisk /dev/sdi 
# Type 'd' to delete the primary partition 
# Type 'n' for new partition 
# Type 'p' for primary 
# Type '1' for 1st 
# Type Enter for 1st cylinder 
# Type Enter for last cylinder (full disk) 
# Partition is not bootable, so 'a' not necessary 
# Type 'w' to finish 
e2fsck -f /dev/sdi 
resize2fs -p /dev/sdi  
fsck -f -y /dev/sdi  
mount -t ext3 /dev/sdi  /mnt/ebs1

It’s was easy, though the time it takes to snapshot and wait for e2fsck command to finish takes sometime. I leave it overnight to finish the process. It’s important to do e2fsck to the new volume to ensure integrity of data.

If filesystem of the volume is XFS:

While EXT3 volume need to be unmounted while executing the resize, XFS is very simple and can be resize while it’s mounted and live using the command xfs_growfs.

The link of the post messages is at:
Increase XFS EBS volume size

Update: Commands for enlarging XFS

 umount /mnt/ebs1 
# ElasticFox -> volumes -> right click -> create a new snapshot from this volume 
# ElasticFox -> snapshots-> right click -> create new volume from this snapshot (with increased size) 
# ElasticFox -> volumes -> right click -> attach /dev/sdi 
mount /dev/sdi /mnt/ebs1 
xfs_growfs /mnt/ebs1

Whether using EXT3 or XFS in the next volume in EC2, the links above are very helpful. Anybody have a chance snapshotting bigger than 500GB volume? How long does it takes for you to finish?

Migrate data using Amazon EBS to a new running instance in EC2.

Been running mysql server inside Amazon EC2 throught an Elastic Block store and needs to be migrated to a new instance.

The tasks include:

1. Stopping mysql server.

2. Assume /var/lib/mysql and /var/log/mysql are symbolic links to
/ebs1/MYSQLDB/var/lib/mysql and /ebs1/MYSQLDB/var/log/mysq respectively.
Create a snapshot of a volume which is attached to the running instance.

3. Create new Volume from generated snapshot.

4. Install mysql-server. Stop mysql-server first, then

5. Attach new volume to the the new running instance. /dev/sdh and mount to /ebs1 directory.

6. Configure the symlink to /var/log/mysql and /var/lib/mysql point to
/ebs1/MYSQLDB//var/log/mysql and /ebs1/MYSQLDB/var/lib/mysql repectively.

In some cases, I got the error in debian-sys-maint when starting mysql, which can easily fix
by checking the password at /etc/mysql/debian.cnf for Ubuntu machines and granting
admin permissions for this user.

I tried also attaching EBS Volumes with the same data inside and get the error:

   Filesystem "sdi": Disabling barriers, not supported by the underlying device
XFS: Filesystem sdi has duplicate UUID - can't mount
sdi: unknown partition table<br />   

Where my /etc/fstab says:

 # Legacy /etc/fstab
 # Supplied by: ec2-ami-tools-1.3-30748
 /dev/sda1 /     ext3    defaults 1 1
 /dev/sda2 /mnt  ext3    defaults 0 0
 /dev/sda3 swap  swap    defaults 0 0
none      /proc proc    defaults 0 0
none      /sys  sysfs   defaults 0 0
/dev/sdh /ebs1 xfs noatime 0 0
/dev/sdi /ebs2 xfs noatime 0 0

To get the /ebs2 work, I need to add nouuid to fstab options.

   /dev/sdi /ebs2 xfs noatime,nouuid 0 0

http://developer.amazonwebservices.com/connect/thread.jspa?messageID=114594
http://adumont.serveblog.net/2007/03/31/xfs-and-lvm-snapshots/