Created
February 19, 2010 08:10
-
-
Save richcole/308540 to your computer and use it in GitHub Desktop.
Making a Boot from EBS Volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Go to console.aws.amazon.com | |
# - launch a spot instance of one of alestic's images (see alestic.com) | |
# - create a 5G EBS volume | |
# - attach the 5G EBS volume to your instance | |
# - log into the instance with ssh | |
set -e -x | |
EBS_DEVICE=/dev/sdf | |
mkfs.ext3 /dev/sdf | |
mkdir -p /emph | |
mount /dev/sdf /emph | |
rsync --stats -av --exclude /root/.bash_history --exclude /home/*/.bash_history --exclude /etc/ssh/ssh_host_* --exclude /etc/ssh/moduli --exclude /etc/udev/rules.d/*persistent-net.rules --exclude /var/lib/ec2/* --exclude=/mnt/* --exclude=/proc/* --exclude=sys --exclude=/dev/shm --exclude=/dev/pts --exclude=/selinux --exclude=/lib/init/rw --exclude=/tmp/* --exclude=/emph / /emph | |
# edit /emph/etc/fstab to mount /dev/sda | |
umount /emph | |
# Go to console.aws.amazon.com | |
# - detach the volume | |
# - create a snapshot of the volume | |
# now install ec2 tools to register the image | |
curl -o ec2-api-tools.zip 'http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip' | |
unzip ec2-api-tools.zip | |
cd ec2-apu-tools-1.3-* | |
apt-get install sun-java6-jre | |
export JAVA_HOME=/usr/lib/jvm/java-6-sun | |
export EC2_HOME=$(pwd) | |
$EC2_HOME/bin/ec2-register --snapshot snap-410b2f28 --description="Debian Squeeze" --name="Debian Squeeze 0001" --architecture i386 --root-device-name /dev/sda | |
This didn't work. The AMI was not able to boot, it had not console output. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment