Convert a server running from Instance Store to EBS

  • Create 1 EBS volume (in the same availability zone that your instance is running)
  • Attach this volume to your EC2 instance store (from the console)
  • Format it as ext3
mkfs.ext3 /dev/sdf
  • Mount it
mkdir /mnt/ebs
mount /dev/sdf /mnt/ebs
  • Copy the root file system to the EBS (make sure to stop all relevant services like MySQL to ensure files are closed and flushed)
rsync -avHx / /mnt/ebs
rsync -avHx /dev /mnt/ebs
  • Sync and unmount
sync && umount /mnt/ebs
  • Create a snapshot of that volume
  • Register the ami based on that snapshot
  • No labels