<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Groove Labo &#187; EC2</title>
	<atom:link href="http://labo.opengroove.com/blog/category/vm/ec2/feed/" rel="self" type="application/rss+xml" />
	<link>http://labo.opengroove.com/blog</link>
	<description>株式会社オープングルーヴの開発者のブログ</description>
	<lastBuildDate>Tue, 28 Sep 2010 06:09:57 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Amazon EC2でAMIの作成(ec2-bundle-vol)に失敗</title>
		<link>http://labo.opengroove.com/blog/2009/07/21/amazon-ec2%e3%81%a7ami%e3%81%ae%e4%bd%9c%e6%88%90ec2-bundle-vol%e3%81%ab%e5%a4%b1%e6%95%97/</link>
		<comments>http://labo.opengroove.com/blog/2009/07/21/amazon-ec2%e3%81%a7ami%e3%81%ae%e4%bd%9c%e6%88%90ec2-bundle-vol%e3%81%ab%e5%a4%b1%e6%95%97/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 11:13:39 +0000</pubDate>
		<dc:creator>sugimoto</dc:creator>
				<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">http://labo.opengroove.com/blog/?p=201</guid>
		<description><![CDATA[Amazon EC2 でインスタンスをいつでも複製/復元できるよう自分用のAMIを作成していたところ、ec2-bundle-vol に失敗しました。 -bash-3.2# ec2-bundle-vol -d /mnt -k xxxxx.pem -c xxxxx.pem -u xxxx-xxxxx-xxxx Please specify a value for arch [i386]: Copying / into the image file /mnt/image... Excluding: /sys /proc /dev/pts /proc/sys/fs/binfmt_misc /dev /media /mnt /proc /sys /mnt/image /mnt/img-mnt 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.001797 seconds, 584 MB/s [...]]]></description>
			<content:encoded><![CDATA[<p>
Amazon EC2 でインスタンスをいつでも複製/復元できるよう自分用のAMIを作成していたところ、ec2-bundle-vol に失敗しました。
</p>

<pre>
-bash-3.2# ec2-bundle-vol -d /mnt -k xxxxx.pem -c xxxxx.pem  -u xxxx-xxxxx-xxxx
 Please specify a value for arch [i386]:
 Copying / into the image file /mnt/image...
 Excluding:
          /sys
          /proc
          /dev/pts
          /proc/sys/fs/binfmt_misc
          /dev
          /media
          /mnt
          /proc
          /sys
          /mnt/image
          /mnt/img-mnt
 1+0 records in
 1+0 records out
 1048576 bytes (1.0 MB) copied, 0.001797 seconds, 584 MB/s
 mke2fs 1.39 (29-May-2006)
 ERROR: execution failed: "rsync -rlpgoD -t -r -S -l --exclude /sys --exclude /proc --exclude /dev/pts --exclude /proc/sys/fs/binfmt_misc --exclude /dev --exclude /media --exclude /mnt --exclude /proc --exclude /sys --exclude /mnt/image --exclude /mnt/img-mnt -X /* /mnt/img-mnt 2>&#038;1 > /dev/null"
</pre>

<p>
つい1日前には同じインスタンスから実行できたのに。。。
</p>

<p>
rsync コマンドが実行エラーってなってます。
ec2-bundle-vol がrsyncコマンドを実行して、途中で失敗したようです。
</p>

<p>
ネットで調べてみると、rsyncコマンドの実行エラーで失敗する理由として、2つのパターンがあるようです。
</p>

<h4>1. volume保存用の領域が足りない</h4>

<p>
AMI保存用のイメージファイルを作成中にインスタンスのディスク領域を使いきった場合、エラーとなるようです。
この場合は、インスタンス内のいらないファイルを削除するしかないですね。。
</p>

<h4>2. rsync実行中にファイルが削除されたりしてしまった</h4>

<p>
rsyncコマンドの途中で対象となっているファイルやディレクトリが変更されると、コマンドが失敗します。
</p>

<p>
プログラムの動作中に ec2-bundle-vol を起動すると、rsyncコマンドが失敗してしまうことがあるということ。
</p>

<p>
エラーメッセージの中にあるrsyncコマンドを直接実行すると、どちらが原因かわかるようです。
</p>

<pre>
-bash-3.2# rsync -rlpgoD -t -r -S -l --exclude /sys --exclude /proc --exclude /dev/pts --exclude /proc/sys/fs/binfmt_misc --exclude /dev --exclude /media --exclude /mnt --exclude /proc --exclude /sys --exclude /mnt/image --exclude /mnt/img-mnt -X /* /mnt/img-mnt
file has vanished: "/var/nagios/spool/checkresults/check1n3woE"
rsync warning: some files vanished before they could be transferred (code 24) at main.c(892) [sender=2.6.8]
</pre>

<p>
/var/nagios/spool にあるファイルがなくなったということです。
</p>

<p>
<a href="http://www.nagios.org/">nagios</a>はサーバー監視用のサービスですね。確かに昨日インストールしました。AMIを作成する間は、止めてしまいましょう。
</p>

<pre>
sudo /etc/init.d/nagios stop
</pre>

<p>
nagiosを止めたら ec2-bundle-vol コマンドが成功し、無事にAMIが作成できました。めでたしめでたし。
</p>

<p>
Daemon のようなプログラムは実行しているという認識が低いので、要注意ですね。
</p>
]]></content:encoded>
			<wfw:commentRss>http://labo.opengroove.com/blog/2009/07/21/amazon-ec2%e3%81%a7ami%e3%81%ae%e4%bd%9c%e6%88%90ec2-bundle-vol%e3%81%ab%e5%a4%b1%e6%95%97/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

