Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
bundle s3 AMI to EBS
#!/bin/bash
mkdir /mnt/ebs
mkfs.ext3 ${EBS_DEVICE}
mount ${EBS_DEVICE} /mnt/ebs
mkdir /mnt/tmp
rsync -av --exclude=/mnt/ --exclude=/proc/ / /mnt/tmp/
rm /mnt/tmp/root/.bash_history
rm /mnt/tmp/home/*/.bash_history
rm /mnt/tmp/etc/ssh/ssh_host_*
rm /mnt/tmp/etc/ssh/moduli
rm /mnt/tmp/etc/udev/rules.d/*persistent-net.rules
#ensure that ami init scripts will be run
chmod u+x /mnt/ebs/etc/init.d/ec2-init-user-data
rm /mnt/ebs/var/lib/ec2
#clear out log files
cd /mnt/tmp/var/log
for i in `ls ./**/*`; do
echo $i && echo -n> $i
done
# rsync --stats -avx --exclude-from=excludes.txt / /mnt/ebs/
cd /mnt/tmp
# tar cpS ./ | cpipe -vt -b 1024 | gzip -c | tar zxpS -C /mnt/ebs/
tar -cSf - -C ./ . | tar xvf - -C /mnt/ebs/
mv /mnt/ebs/mnt/tmp/* /mnt/ebs/ #FIX THIS UGLYNESS
umount /mnt/ebs
echo ''
echo "
sudo -s
mkdir /mnt/ebs
mkfs.ext3 ${EBS_DEVICE}
mount ${EBS_DEVICE} /mnt/ebs
mkdir /mnt/tmp
rsync -av --exclude=/mnt/ --exclude=/proc/ / /mnt/tmp/
rm /mnt/tmp/root/.bash_history
rm /mnt/tmp/home/*/.bash_history
rm /mnt/tmp/etc/ssh/ssh_host_*
rm /mnt/tmp/etc/ssh/moduli
rm /mnt/tmp/etc/udev/rules.d/*persistent-net.rules
#ensure that ami init scripts will be run
chmod u+x /mnt/ebs/etc/init.d/ec2-init-user-data
rm /mnt/ebs/var/lib/ec2
#clear out log files
cd /mnt/tmp/var/log
for i in `ls ./**/*`; do
echo $i && echo -n> $i
done
# rsync --stats -avx --exclude-from=excludes.txt / /mnt/ebs/
cd /mnt/tmp
# tar cpS ./ | cpipe -vt -b 1024 | gzip -c | tar zxpS -C /mnt/ebs/
tar -cSf - -C ./ . | tar xvf - -C /mnt/ebs/
mv /mnt/ebs/mnt/tmp/* /mnt/ebs/ #FIX THIS UGLYNESS
umount /mnt/ebs
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.