I am attempting to create an EBS-backed image from a running instance, similar to this post on SO. I'm using primarily these sites as references:
I successfully created the EBS volume, ran mkfs.ext3
against it (I formatted the whole drive, not a partition -- is this the problem, perhaps?) and used the following rsync
command to make a copy of the filesystem:
rsync --stats -avv --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=/mnt/* --exclude=/proc/* --exclude=/tmp/* --exclude=/sys/* --exclude=/dev/* --exclude=/production --exclude=/media / /mnt/ebs-root/
(where /media
and /production
are directories mounted from other EBS volumes, and /mnt/ebs-root/
is the new EBS volume which will contain the image)
the rsync works well enough, I can unmount the volume, snapshot it, and use the AWS console to make a bootable image... but when it boots, I can't access it over the web/ssh (after changing its elastic IP in the AWS console).
I noticed that I might need to edit some files in the new EBS volume (like /etc/fstab) but I'm not sure. Here's the contents of my /mnt/ebs-root/etc/fstab, anyway:
# Legacy /etc/fstab
# Supplied by: ec2-ami-tools-1.3-34544
/dev/sda1 / ext3 defaults 1 1
/dev/sda2 /mnt ext3 defaults 0 0
/dev/sda3 swap swap defaults 0 0
/dev/sdp1 /production ext3 defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
I'm way outside my knowledge base here and hoping someone can point me in the right direction. Thanks in advance.
The problem was that I attempted to image the instance while it was running. I figured since nobody was accessing the site that I could image it while running, but apparently not. Here's what I ran:
/etc/init.d/apache2 stop
/etc/init.d/mysql stop
and then I re-ran my rsync
command from above, and the instance is now reachable by SSH! (I have a new problem now, but that's for another topic ;)
Thanks Jonners for the tips.