Tag Archives: ebs

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/

Amazon EC2 and EBS mount point tip

After a few experimentation on Amazon EC2 and its new feature(Amazon EBS), I was able to share some tips for an EBS device formatted as XFS. Always make sure that the file permission belongs to the correct user(s) UID when you start using the mounted EBS device(unless of course if its a newly created/formatted).

Check this group for further discussion: http://groups.google.com/group/ec2ubuntu/browse_thread/thread/f44fb3ae0e068919

Thanks to Eric Hammond for posting my name on his MySQL Amazon EBS tutorial. http://ec2ebs-mysql.notlong.com