<?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>Everlinux's Blog &#187; Xen</title>
	<atom:link href="http://everlinux.com/blog/category/xen/feed" rel="self" type="application/rss+xml" />
	<link>http://everlinux.com/blog</link>
	<description>Sempre vivendo, aprendendo e blogando... :)</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:13:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fazendo backup das suas VM’s do Xen: Atualizado</title>
		<link>http://everlinux.com/blog/2008/05/12/fazendo-backup-das-suas-vm%e2%80%99s-do-xen-atualizado</link>
		<comments>http://everlinux.com/blog/2008/05/12/fazendo-backup-das-suas-vm%e2%80%99s-do-xen-atualizado#comments</comments>
		<pubDate>Mon, 12 May 2008 19:44:21 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2008/05/12/fazendo-backup-das-suas-vm%e2%80%99s-do-xen-atualizado/</guid>
		<description><![CDATA[O script anterior foi atualizado contando com algumas melhorias sugeridas pelos seus usuários, como: - Agora ele é escrito em Inglês, para maior portabilidade com outros usuários do xen ao redor do mundo; - Você pode fazer backup de somente uma máquina específica, não é mais necessário esperar todo o laço terminar para ver o [...]]]></description>
			<content:encoded><![CDATA[<p>O <a href="http://www.everlinux.com/blog/2008/04/03/fazendo-backup-das-suas-vms-do-xen/">script anterior</a> foi atualizado contando com algumas melhorias sugeridas pelos seus usuários, como:</p>
<p>- Agora ele é escrito em Inglês, para maior portabilidade com outros usuários do xen ao redor do mundo;</p>
<p>- Você pode fazer backup de somente uma máquina específica, não é mais necessário esperar todo o laço terminar para ver o resultado do mesmo;</p>
<p>- Script parametrizado e funcões sub-divididas e</p>
<p>- Pequenos problemas corrigidos.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Backup of Xen VM's</span>
<span style="color: #666666; font-style: italic;"># Tiago Cruz - tiagocruz@everlinux.com</span>
<span style="color: #666666; font-style: italic;"># v 1.0	Mar/2008 - Initial version, just backup all VM's</span>
<span style="color: #666666; font-style: italic;"># v 1.1 May/2008 - Now we have functions and parameters</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #007800;">BACK</span>=<span style="color: #ff0000;">&quot;_snap&quot;</span>
<span style="color: #007800;">LOG</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>backup.<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #666666; font-style: italic;"># root partition to backup (&quot;/&quot;)</span>
<span style="color: #666666; font-style: italic;"># usually the second it's swap</span>
<span style="color: #007800;">ROOT</span>=<span style="color: #ff0000;">&quot;1&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/mnt/back&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/data/backup&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>backup
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> showHelp<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>        
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Use the following parameters: &quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;          help   = Show this help&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;          all    = Backup of all VM's&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;          list   = List all VM's from this domain&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;          &lt;vm&gt;   = Backup one specific VM&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ex: back_xen.sh tomcat_shop&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> listVM<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;List of VM's avaliables:&quot;</span>
	<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>xm list <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'(Name|Domain-0)'</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> backXen <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backuping machine <span style="color: #007800;">$i</span>...&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Please, look the progress on <span style="color: #007800;">$LOG</span>&quot;</span>
	listVM <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Machine <span style="color: #007800;">$i</span> does not exist, aborting!&quot;</span>
		<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
	<span style="color: #000000; font-weight: bold;">fi</span>	
	backup
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup of <span style="color: #007800;">$i</span> completed successfully!!!&quot;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup finalized on <span style="color: #780078;">`date`</span> with load <span style="color: #780078;">`cat /proc/loadavg | cut -c 1-14`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;==============================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;==============================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> backAll <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #007800;">VMS</span>=<span style="color: #000000; font-weight: bold;">`</span>xm list <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'(Name|Domain-0)'</span><span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$VMS</span>; <span style="color: #000000; font-weight: bold;">do</span>
		backup
	<span style="color: #000000; font-weight: bold;">done</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup finalized on <span style="color: #780078;">`date`</span> with load <span style="color: #780078;">`cat /proc/loadavg | cut -c 1-14`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;==============================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;==============================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> backup <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;==============================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup <span style="color: #007800;">$i</span> started on <span style="color: #780078;">`date`</span> with load <span style="color: #780078;">`cat /proc/loadavg | cut -c 1-14`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	<span style="color: #007800;">DEVICE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> ^disk <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">&quot;Vol_LVM&quot;</span> <span style="color: #ff0000;">'{print $2}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> , <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Virtual Machine <span style="color: #007800;">$i</span> uses <span style="color: #007800;">$DEVICE</span> as storage device&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
	lvcreate <span style="color: #660033;">--snapshot</span> <span style="color: #660033;">-L</span> 15G <span style="color: #660033;">-n</span> <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DEVICE</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error <span style="color: #007800;">$i</span>: creating LVM <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> 
&nbsp;
	kpartx <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
	<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span><span style="color: #007800;">$ROOT</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error <span style="color: #007800;">$i</span>: mounting <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span><span style="color: #007800;">$ROOT</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> 
&nbsp;
	<span style="color: #007800;">SIZE1</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-hP</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $3}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> Used<span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #007800;">SIZE2</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-hP</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> Size<span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup of /dev/mapper/Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span><span style="color: #007800;">$ROOT</span> - <span style="color: #007800;">$SIZE1</span> of <span style="color: #007800;">$SIZE2</span> used&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	<span style="color: #c20cb9; font-weight: bold;">tar</span> zcf <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span>-xen.tar.gz <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error <span style="color: #007800;">$i</span>: creating /LVM/backup/<span style="color: #007800;">$i</span>.tar.gz&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> 
&nbsp;
	<span style="color: #007800;">SIZE3</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> <span style="color: #000000; font-weight: bold;">/</span>LVM<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span>-xen.tar.gz  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $5}'</span><span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Created /LVM/backup/<span style="color: #007800;">$i</span>-xen.tar.gz with <span style="color: #007800;">$SIZE3</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
	<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
	<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error <span style="color: #007800;">$i</span>: umounting <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> 
	kpartx <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error <span style="color: #007800;">$i</span>: deleting partition mappings <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> 
&nbsp;
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Removing snapshot already backuped <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
	lvremove <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$#&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	showHelp
&nbsp;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span> 
	list<span style="color: #7a0874; font-weight: bold;">&#41;</span>	listVM	<span style="color: #000000; font-weight: bold;">;;</span>
	all <span style="color: #7a0874; font-weight: bold;">&#41;</span>	backAll	<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #7a0874; font-weight: bold;">help</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>	showHelp <span style="color: #000000; font-weight: bold;">;;</span>
	 <span style="color: #000000; font-weight: bold;">*</span>  <span style="color: #7a0874; font-weight: bold;">&#41;</span>  	<span style="color: #007800;">i</span>=$<span style="color: #000000;">1</span>; backXen <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<p>Caso tenha problemas com o copy-past, você pode pegar o mesmo aqui: <a href="http://www.everlinux.com/tiago/shell/back_xen.sh.txt">back_xen.sh.txt</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2008/05/12/fazendo-backup-das-suas-vm%e2%80%99s-do-xen-atualizado/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fazendo backup das suas VM&#8217;s do Xen</title>
		<link>http://everlinux.com/blog/2008/04/03/fazendo-backup-das-suas-vms-do-xen</link>
		<comments>http://everlinux.com/blog/2008/04/03/fazendo-backup-das-suas-vms-do-xen#comments</comments>
		<pubDate>Thu, 03 Apr 2008 14:06:51 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2008/04/03/fazendo-backup-das-suas-vms-do-xen/</guid>
		<description><![CDATA[Se você usa o Xen, usa Storage Devices sob LVM, e acha importante ter um backup das mesmas, você pode utilizar/ adaptar este pequeno script que tira um snapshot e em seguida faz um &#8220;tar.gz&#8221; de todo o &#8220;/&#8221; da sua VM, e a guarda em um local para que você possa restaura-lo caso necessário. [...]]]></description>
			<content:encoded><![CDATA[<p>Se você usa o Xen, usa Storage Devices sob LVM, e acha importante ter um backup das mesmas, você pode utilizar/ adaptar este pequeno script que tira um snapshot e em seguida faz um &#8220;tar.gz&#8221; de todo o &#8220;/&#8221; da sua VM, e a guarda em um local para que você possa restaura-lo caso necessário. <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Backup das VM's do Xen</span>
<span style="color: #666666; font-style: italic;"># Tiago Cruz - tiagocruz@everlinux.com</span>
<span style="color: #666666; font-style: italic;"># Mar/2008</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin
&nbsp;
<span style="color: #007800;">VMS</span>=<span style="color: #000000; font-weight: bold;">`</span>xm list <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'(Name|Domain-0)'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">BACK</span>=<span style="color: #ff0000;">&quot;_snap&quot;</span>
<span style="color: #007800;">LOG</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>backup
<span style="color: #666666; font-style: italic;"># Particao root, geralmente a segunda eh swap</span>
<span style="color: #007800;">ROOT</span>=<span style="color: #ff0000;">&quot;1&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/mnt/back&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/dados/backup&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>dados<span style="color: #000000; font-weight: bold;">/</span>backup
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$VMS</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;=================================================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup <span style="color: #007800;">$i</span> iniciado em <span style="color: #780078;">`date`</span> com load de <span style="color: #780078;">`cat /proc/loadavg`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #007800;">DEVICE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> disk <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">&quot;Vol_LVM&quot;</span> <span style="color: #ff0000;">'{print $2}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> , <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Maquina Virtual <span style="color: #007800;">$i</span> usa <span style="color: #007800;">$DEVICE</span> como storage device&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
        lvcreate <span style="color: #660033;">--snapshot</span> <span style="color: #660033;">-L</span> 15G <span style="color: #660033;">-n</span> <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DEVICE</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Erro <span style="color: #007800;">$i</span>: criando LVM <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
        kpartx <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span><span style="color: #007800;">$ROOT</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Erro <span style="color: #007800;">$i</span>: montando <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span><span style="color: #007800;">$ROOT</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
        <span style="color: #007800;">SIZE1</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-hP</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $3}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> Used<span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #007800;">SIZE2</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-hP</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> Size<span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup de /dev/mapper/Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span><span style="color: #007800;">$ROOT</span> - <span style="color: #007800;">$SIZE1</span> de <span style="color: #007800;">$SIZE2</span> usados&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #c20cb9; font-weight: bold;">tar</span> zcf <span style="color: #000000; font-weight: bold;">/</span>dados<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span>-xen.tar.gz <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Erro <span style="color: #007800;">$i</span>: criando /dados/backup/<span style="color: #007800;">$i</span>.tar.gz&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
        <span style="color: #007800;">SIZE3</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> <span style="color: #000000; font-weight: bold;">/</span>dados<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span>-xen.tar.gz  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $5}'</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Criado /dados/backup/<span style="color: #007800;">$i</span>-xen.tar.gz com <span style="color: #007800;">$SIZE3</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
        <span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>back<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Erro <span style="color: #007800;">$i</span>: desmontando <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        kpartx <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM-<span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Erro <span style="color: #007800;">$i</span>: desmapeando <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
&nbsp;
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Removendo snapshot ja backupeado <span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
        lvremove <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>Vol_LVM<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$i</span><span style="color: #007800;">$BACK</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup finalizado em <span style="color: #780078;">`date`</span> com load de <span style="color: #780078;">`cat /proc/loadavg`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;=================================================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;=================================================================&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG</span></pre></div></div>

<p>Trecho do log:</p>
<blockquote><p>Backup ora_busca iniciado em Fri Mar 28 05:02:53 BRT 2008 com load de 1.31 1.33 1.21<br />
Maquina Virtual ora_busca usa ora_busca como storage device<br />
  Logical volume &#8220;ora_busca_snap&#8221; created<br />
Backup de /dev/mapper/Vol_LVM-ora_busca_snap1 &#8211; 16G de 95G usados<br />
Criado /dados/backup/ora_busca-xen.tar.gz com 4.9G<br />
Removendo snapshot ja backupeado ora_busca_snap<br />
  Logical volume &#8220;ora_busca_snap&#8221; successfully removed
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2008/04/03/fazendo-backup-das-suas-vms-do-xen/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Clonando VM&#8217;s no XEN</title>
		<link>http://everlinux.com/blog/2008/02/07/clonando-vms-no-xen</link>
		<comments>http://everlinux.com/blog/2008/02/07/clonando-vms-no-xen#comments</comments>
		<pubDate>Thu, 07 Feb 2008 18:16:48 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2008/02/07/clonando-vms-no-xen/</guid>
		<description><![CDATA[1-) Estou armazenando as VMs no LVM: # lvcreate -Ay -L 60G -n vm00 Vol_LVM # lvcreate -Ay -L 60G -n vm01 Vol_LVM # lvcreate -Ay -L 60G -n vm02 Vol_LVM 2-) Estou usando o &#8220;partimage-0.6.7_beta2.tar.bz2&#8243;, pois a versão stable não funciona bem em 64 bits: 3-) A primeira VM deve ser instalada/ configurada manualmente/normalmente. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1-)</strong> Estou armazenando as VMs no LVM:</p>
<p><code>	# lvcreate -Ay -L 60G -n vm00 Vol_LVM<br />
	# lvcreate -Ay -L 60G -n vm01 Vol_LVM<br />
	# lvcreate -Ay -L 60G -n vm02 Vol_LVM<br />
</code><br />
<strong>2-)</strong> Estou usando o &#8220;partimage-0.6.7_beta2.tar.bz2&#8243;, pois a versão stable não funciona bem em 64 bits:</p>
<p><strong>3-)</strong> A primeira VM deve ser instalada/ configurada manualmente/normalmente. Depois você pode tirar uma cópia dela:</p>
<p><code>	# kpartx -a /dev/mapper/Vol_LVM-vm01<br />
	# partimage -z1 save /dev/mapper/Vol_LVM-vm01p1 /LVM/vm01p1.partimg.gz</code><br />
ou<br />
<code>	# partimage -z0 -c -d -f0 save /dev/mapper/Vol_LVM-vm01p1 /LVM/vm01p1.partimg<br />
	# kpartx -d /dev/mapper/Vol_LVM-vm01</code></p>
<p>PS: Note que se você usar compressão (-z1) a geração da imagem vai demorar mais para ser criado, porém com o tamanho bem menor (515M vs 3.7GB) . A restauração da mesma também será mais lenta.</p>
<p><strong>4-)</strong> Com base na primeira VM:</p>
<p><code># fdisk -l /dev/mapper/Vol_LVM-vm00<br />
Disk /dev/mapper/Vol_LVM-vm00: 64.4 GB, 64424509440 bytes<br />
255 heads, 63 sectors/track, 7832 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>                   Device Boot      Start         End      Blocks   Id  System<br />
/dev/mapper/Vol_LVM-vm00p1   *           2        7395    59392305   83  Linux<br />
/dev/mapper/Vol_LVM-vm00p2            7396        7832     3510202+  82  Linux swap / Solaris<br />
</code></p>
<p>Você poderá preparar um arquivo, por exemplo, /tmp/parttable, com as especificações das demais partições.<br />
1,7394,83,*<br />
7395,,82,-</p>
<p>Estou usando uma partição primária para o raiz &#8220;/&#8221; (tipo 83) com ~ 60 GB e o restante para swap (tipo 82).</p>
<p>Você poderá usar o sfdisk e especificar os dados em: sectors, blocks, cylinders ou megabytes.</p>
<p><strong>5-)</strong> Crie as partições para a segunda VM:</p>
<p><code>	# dd if=/dev/zero of=/dev/mapper/Vol_LVM-vm01 count=1 bs=512<br />
	# sfdisk -uC /dev/mapper/Vol_LVM-vm01 < /tmp/parttable</code></p>
<p>Se preferir, simplesmente faça o processo manualmente:<br />
# fdisk /dev/mapper/Vol_LVM-vm01</p>
<p><strong>6-)</strong> Crie a SWAP para o segundo device:</p>
<p>Será necessário usar o "kpartx" para "mapear" as partições que existem dentro do device LVM:</p>
<p><code>	# kpartx -a /dev/mapper/Vol_LVM-vm01<br />
	# ll /dev/mapper/Vol_LVM-vm01*<br />
	# mkswap /dev/mapper/Vol_LVM-vm01p2<br />
</code><br />
<strong>7-)</strong> Restaure a imagem da primeira VM:</p>
<p>- Restauração com GZIP:</p>
<blockquote><p>	# partimage restore /dev/mapper/Vol_LVM-vm02p1 /LVM/vm01p1.partimg.gz<br />
        Time elapsed: 10m:59sec<br />
        Speed: 5.16 GiB/min<br />
        Data copied: 56.64 GiB</p></blockquote>
<p>- Restauração sem GZIP:</p>
<blockquote><p>	# partimage restore /dev/mapper/Vol_LVM-vm03p1 /LVM/vm01p1.partimg.000<br />
        Time elapsed:  1m:15sec<br />
        Speed: 2.90 GiB/min<br />
        Data copied: 3.62 GiB</p></blockquote>
<p><strong> <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </strong> Monte a VM e troque endereços de IP, hostname e MAC Address:<br />
<code>	# mount /dev/mapper/Vol_LVM-vm01p1 /mnt/xen/<br />
        # vi /mnt/xen/etc/sysconfig/network-scripts/ifcfg-eth0<br />
        # vi /mnt/xen/etc/sysconfig/network<br />
        # vi /mnt/xen/etc/hosts</code></p>
<p>PS: Use o macgen.py para alterar o MAC address:</p>
<blockquote><p>$ cat macgen.py<br />
	#! /usr/bin/python<br />
	# macgen.py script generates a MAC address for Xen guests<br />
	#<br />
	import random<br />
	mac = [ 0x00, 0x16, 0x3e,<br />
	random.randint(0x00, 0x7f),<br />
	random.randint(0x00, 0xff),<br />
	random.randint(0x00, 0xff) ]<br />
	print ':'.join(map(lambda x: "%02x" % x, mac))</p></blockquote>
<p><strong>9-) </strong>Desmonte a partição, e arrume seu /etc/xen/vm02:</p>
<p><code>	# umount /mnt/xen<br />
	# kpartx -d /dev/mapper/Vol_LVM-vm02<br />
</code></p>
<p>Utilize o "uuidgen" para gerar um novo UUID para sua VM.<br />
Não esqueça de trocar também o MAC no campo "vif" e o device LVM, ex:</p>
<blockquote><p>name = "vm02"<br />
uuid = "82f89076-487e-4de5-ab4a-99ce07c586eb"<br />
maxmem = 1000<br />
memory = 800<br />
vcpus = 1<br />
bootloader = "/usr/bin/pygrub"<br />
on_poweroff = "destroy"<br />
on_reboot = "restart"<br />
on_crash = "restart"<br />
vfb = [ "type=vnc,vncunused=1,keymap=en-us" ]<br />
disk = [ "phy:/dev/Vol_LVM/vm01,xvda,w" ]<br />
vif = [ "mac=00:16:3e:5a:02:a6,bridge=xenbr0" ]
</p></blockquote>
<p><strong>10-) </strong>Inicie a VM e corra para o abraço:</p>
<p>	<code># xm create vm02 -c</code></p>
<p>Em caso de problemas, consulte este artigo: <a href="http://www.everlinux.com/blog/2007/12/04/xen-dicas-rapidas-e-problemas-resolvidos/">Xen: Dicas rápidas e problemas resolvidos</a></p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2008/02/07/clonando-vms-no-xen/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Xen &#8211; Dicas rápidas e problemas resolvidos</title>
		<link>http://everlinux.com/blog/2007/12/04/xen-dicas-rapidas-e-problemas-resolvidos</link>
		<comments>http://everlinux.com/blog/2007/12/04/xen-dicas-rapidas-e-problemas-resolvidos#comments</comments>
		<pubDate>Tue, 04 Dec 2007 16:02:43 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2007/12/04/xen-dicas-rapidas-e-problemas-resolvidos/</guid>
		<description><![CDATA[1-) Problemas com o reconhecimento do disco durante o boot: &#8220;Booting from Hard Disk Boot from Hard Disk failed: coud not read the boot disk FATAL: No bootable device&#8221; Verifique qual é o device utilizado em seu arquivo de configuração. Máquinas Para-Virtualizadas geralmente utilizam &#8216;xvda&#8217;: disk = [ 'phy:/dev/Vol_LVM/xen_01,xvda,w', ] Máquinas Full-Virtualizadas (HVM) geralmente utilizam-se [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1-) Problemas com o reconhecimento do disco durante o boot:</strong></p>
<p><em>&#8220;Booting from Hard Disk<br />
Boot from Hard Disk failed: coud not read the boot disk<br />
FATAL: No bootable device&#8221;</em></p>
<p>Verifique qual é o device utilizado em seu arquivo de configuração. Máquinas Para-Virtualizadas geralmente utilizam &#8216;xvda&#8217;:</p>
<p><code>disk = [ 'phy:/dev/Vol_LVM/xen_01,xvda,w', ]</code></p>
<p>Máquinas Full-Virtualizadas (HVM) geralmente utilizam-se de &#8216;hda&#8217; ou &#8216;sda&#8217;.</p>
<p><code>disk = [ 'phy:/dev/Vol_LVM/xen_01,hda,w', ]</code></p>
<p>Para saber mais sobre os tipos de virtualizações existentes, consulte este post: <a href="http://www.everlinux.com/blog/2007/04/27/falando-um-pouco-sobre-virtualizacao/">Falando um pouco sobre Virtualização</a></p>
<p><strong>2-) Se a sua placa de rede não é reconhecida depois do boot:</strong></p>
<p>Experimente alterar o config da VM de<br />
<code>vif = [ 'mac=00:xx:xx:xx:xx:bc, bridge=xenbr0', ]</code></p>
<p>Para:<br />
<code>vif = [ 'type=ioemu, mac=00:xx:xx:xx:xx:bc, bridge=xenbr0', ]</code></p>
<p>Utilizando uma virtualização de um Red Hat 7.2, deu certo e apareceu a tal da Realtek <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>3-) Se o &#8216;xm console&#8217; não funcionar&#8230;</strong></p>
<p>- Altere o /etc/inittab (do guest) da seguinte forma:<br />
<code>...<br />
# Console do Xen<br />
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav</p>
<p># Run gettys in standard runlevels<br />
1:2345:respawn:/sbin/mingetty tty1<br />
2:2345:respawn:/sbin/mingetty tty2<br />
...</code></p>
<p>- Dê um reload no inittab:<br />
<code># /sbin/init q<br />
</code><br />
- Altere o /etc/securetty para permitir o login de root via console:<br />
<code>...<br />
tty11<br />
xvc0<br />
</code><br />
- Se o device não existir, crie-o:<br />
<code># mknod /dev/xvc0 c 250 187</code></p>
<p><strong>4-) Para gerar um UUID para uma nova máquina virtual:</strong></p>
<p><code># uuidgen</code></p>
<p><strong>5-) Para gerar um MAC-ADDRESS para outra máquina virtual:</strong></p>
<p><code>#! /usr/bin/python<br />
# macgen.py script generates a MAC address for Xen guests<br />
#<br />
import random<br />
mac = [ 0x00, 0x16, 0x3e,<br />
random.randint(0x00, 0x7f),<br />
random.randint(0x00, 0xff),<br />
random.randint(0x00, 0xff) ]<br />
print ':'.join(map(lambda x: "%02x" % x, mac))</code></p>
<p>Acredite: Seu roteador não vai gostar de encontrar duas máquinas com IP&#8217;s diferentes e MAC-ADDRESS iguais&#8230; <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2007/12/04/xen-dicas-rapidas-e-problemas-resolvidos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trabalho acadêmico sobre o Xen</title>
		<link>http://everlinux.com/blog/2007/05/22/trabalho-academico-sobre-o-xen</link>
		<comments>http://everlinux.com/blog/2007/05/22/trabalho-academico-sobre-o-xen#comments</comments>
		<pubDate>Tue, 22 May 2007 17:10:42 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Apresentação]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2007/05/22/trabalho-academico-sobre-o-xen/</guid>
		<description><![CDATA[Este é um trabalho acadêmico realizado pelos meus alunos do 3 Semestre do curso de Tecnologia em Redes de Computadores, da FAENAC em São Caetano do Sul. Os alunos fizeram algo muito interessante: Em um notebook P4 com 512 MB de RAM rodando Windows XP, instalaram o Ubuntu Feisty 7.04 dentro de um Vmware, e [...]]]></description>
			<content:encoded><![CDATA[<p>Este é um trabalho acadêmico realizado pelos meus alunos do 3 Semestre do curso de Tecnologia em Redes de Computadores,  da <a href="http://www.faenac.edu.br/cur_especifico.asp?IdCurso=25&#038;IdCategoria=4">FAENAC</a> em São Caetano do Sul.</p>
<p>Os alunos fizeram algo muito interessante: Em um notebook P4 com 512 MB de RAM rodando Windows XP, instalaram o Ubuntu Feisty 7.04 dentro de um Vmware, e dentro desta máquina virtual configuraram um <a href="http://www.everlinux.com/blog/category/xen/">Xen</a> para rodar uma <a href="http://www.everlinux.com/blog/2007/04/27/falando-um-pouco-sobre-virtualizacao/">para-virtualização</a> do Ubuntu Edgy 6.10.</p>
<p>Uma pena que eles esqueceram de colocar as fontes das consultas, mas eu sei que uma delas foi retirada do <a href="https://help.ubuntu.com/community/XenVirtualMachine/XenOnUbuntuFeisty">Wiki do Ubuntu</a>, a qual eu mesmo escrevi. E antes que eu esqueça, sim eles serão penalizados por esquecerem de citar a fonte! <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>A apresentação deles está bem recheada de ScreenShoots das configurações, mas você pode usar o Wiki se quiser fazer algo parecido (está mais legível). </p>
<p>Alunos:<br />
Cezimar Nascimento / Diego Carvalho / Jose Wilter Frazão /  Josiel Borges e Rodolfo Domingues</p>
<p>Link para download: <a href='http://www.everlinux.com/blog/wp-content/uploads/2007/05/apresentacao_xen.zip' title='Apresentação Acadêmica sobre o XEN'>Apresentação Acadêmica sobre o XEN</a></p>
<p>Abraços a todos</p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2007/05/22/trabalho-academico-sobre-o-xen/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instalar guest OS com mais de um CD no XEN</title>
		<link>http://everlinux.com/blog/2007/05/11/instalar-guest-os-com-mais-de-um-cd-no-xen</link>
		<comments>http://everlinux.com/blog/2007/05/11/instalar-guest-os-com-mais-de-um-cd-no-xen#comments</comments>
		<pubDate>Fri, 11 May 2007 18:24:36 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2007/05/11/instalar-guest-os-com-mais-de-um-cd-no-xen/</guid>
		<description><![CDATA[Uma dica rápida, colaboração do meu amigo Deny C. Luchetti: Um problema de usar o virt-manager da Red Hat (também presente no Mandriva 2007.1!) para criar e administrar máquinas virtuais é o fato de que você simplesmente não consegue trocar de CD durante a instalação do guest OS, conforme eu havia comentado no artigo anterior [...]]]></description>
			<content:encoded><![CDATA[<p>Uma dica rápida, colaboração do meu amigo Deny C. Luchetti:</p>
<p>Um problema de usar o <a href="http://virt-manager.et.redhat.com/">virt-manager</a> da Red Hat (também presente no <a href="http://www.everlinux.com/blog/2007/05/07/breve-analise-do-mandriva-spring-20071/">Mandriva 2007.1</a>!) para criar e administrar máquinas virtuais é o fato de que você simplesmente não consegue trocar de CD durante a instalação do guest OS, conforme eu havia comentado no artigo anterior sobre o <a href="http://www.everlinux.com/blog/2007/05/02/xen-no-red-hat-es-5/">Xen no Red Hat ES 5</a> <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>O que acontece é uma pequena salada: O Xen não faz a instalação, ele executa uma versão modificada do qemu para faze-lo. E para trocar os CD&#8217;s pelo qemu existe um pequeno truque, bem documentado por sinal. O que não bem estava documentado era que o Xen da Red Hat chama o VNC por padrão quando você pede o console da máquina, e infelizmente, as teclas de atalho do qemu não funcionam dentro do VNC. Entendeu? Se não, leia de novo :-p</p>
<p>Para resolver isso, basta desabilitar o VNC no arquivo de configuração gerado pelo virt-manager (nota: o console gráfico continua funcionando, e até mais rápido!), mais ou menos assim:</p>
<blockquote><p>name = &#8220;suse93&#8243;<br />
builder = &#8220;hvm&#8221;<br />
memory = &#8220;500&#8243;<br />
disk = [ 'phy:/dev/lvm/xen_suse93,hda,w', 'file:/home/dluchetti/suse93.iso,hdc:cdrom,r',]<br />
vif = [ 'type=ioemu, mac=00:16:3e:36:5b:9b, bridge=xenbr1',]<br />
uuid = &#8220;e4e85bc7-b244-9d85-ec7a-b06728e6c70c&#8221;<br />
device_model = &#8220;/usr/lib64/xen/bin/qemu-dm&#8221;<br />
kernel = &#8220;/usr/lib/xen/boot/hvmloader&#8221;<br />
vnc=0<br />
vncunused=0<br />
apic=0<br />
acpi=0<br />
pae=1<br />
vcpus=1<br />
boot=&#8221;d&#8221;<br />
ne2000=1<br />
serial = &#8220;pty&#8221;<br />
on_reboot   = &#8216;restart&#8217;<br />
on_crash    = &#8216;restart&#8217;
</p></blockquote>
<p>E, finalmente, para trocar a ISO do qemu e continuar a instalação, basta fazer assim:</p>
<p>Teclar &#8220;CRTL+ALT+2&#8243;  (atenção, não é F2!) e digitar:</p>
<blockquote><p>(qemu) eject cdrom<br />
(qemu) change cdrom /caminho/para/a/segunda/iso/arquivo.iso</p></blockquote>
<p>Facinho né?<br />
Abraços e boas virtualizações para vocês <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2007/05/11/instalar-guest-os-com-mais-de-um-cd-no-xen/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Usando o Xen para rodar o Windows XP ou 2003</title>
		<link>http://everlinux.com/blog/2007/05/04/usando-o-xen-para-rodar-o-windows-xp-ou-2003</link>
		<comments>http://everlinux.com/blog/2007/05/04/usando-o-xen-para-rodar-o-windows-xp-ou-2003#comments</comments>
		<pubDate>Sat, 05 May 2007 01:10:38 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2007/05/04/usando-o-xen-para-rodar-o-windows-xp-ou-2003/</guid>
		<description><![CDATA[Existe um pequeno truque para instalar corretamente o Windows XP ou o Windows 2003 sob um Hypervisor do Xen (na versão 3.0.3, pelo menos). Na verdade existem dois truques: - O primeiro é logo na primeira etapa da Instalação, quando ele ainda está na tela de &#8220;Detectando Hardware&#8221;, algo assim&#8230; é logo a primeira tela [...]]]></description>
			<content:encoded><![CDATA[<p>Existe um pequeno truque para instalar corretamente o Windows XP ou o Windows 2003 sob um Hypervisor do Xen (na versão 3.0.3, pelo menos). Na verdade existem dois truques:</p>
<p>- O primeiro é logo na primeira etapa da Instalação, quando ele ainda está na tela de &#8220;Detectando Hardware&#8221;, algo assim&#8230; é logo a primeira tela depois do boot com o CD ou imagem de instalação. Nesse momento, o Xen ainda não entrou em cena, é apenas uma versão modificada do Qemu iniciando a instalação. Mas de qualquer forma, não sei porque raios, a instalação trava em uma tela preta (black screen) e não sai de lá.</p>
<p>Bom, é necessário apertar a tecla F6 e escolher um tipo de computador diferente para o Qemu se ligar e continuar a instalação. Na verdade, devido a um pau do Qemu/Xen, a tecla F6 não funciona e você <strong>deve teclar F5 </strong>no lugar (mesmo com o windão pedindo a tecla F6!!!).</p>
<p>Na lista que aparece, você deverá escolher <strong>&#8220;Standard PC&#8221;</strong> e mandar continuar, como você pode ver na imagem abaixo:</p>
<p><a href='http://www.everlinux.com/blog/wp-content/uploads/2007/05/win2k3_xen_1.png' title='Instalação XEN'><img src='http://www.everlinux.com/blog/wp-content/uploads/2007/05/win2k3_xen_1.thumbnail.png' alt='Instalação XEN' /></a></p>
<p>Depois a instalação vai continuar normalmente&#8230; até a VM reiniciar e não encontrar mais o CD para continuar a instalação&#8230; isso porque não é mais o Qemu, e sim o XEN que entra em ação e pode ser que você (ou alguma GUI como o <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Virtualization-en-US/virt-install-wizard.html">virt-manager</a> na Red Hat) não tenha colocado a linha do CD-ROM no arquivo de configuração do xen, portanto adicione-a:</p>
<p>O arquivo deve ter uma entrada parecida com essa:</p>
<blockquote><p>     disk = [ 'file:/dados/winxp.img,hda,w' ]</p></blockquote>
<p>Deverá ficar mais ou menos assim: </p>
<blockquote><p> disk = [ 'file:/dados/winxp.img,hda,w','file:/tmp/winxp.iso,hdc:cdrom,r', ]</p></blockquote>
<p><a href='http://www.everlinux.com/blog/wp-content/uploads/2007/05/win2k3_xen_2.png' title='Instalação Windows 2003'><img src='http://www.everlinux.com/blog/wp-content/uploads/2007/05/win2k3_xen_2.thumbnail.png' alt='Instalação Windows 2003' /></a></p>
<p>Depois você pode criar sua máquina novamente para continuar a instalação do seu Windão <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p># xm create winxp</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2007/05/04/usando-o-xen-para-rodar-o-windows-xp-ou-2003/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Xen no Red Hat ES 5</title>
		<link>http://everlinux.com/blog/2007/05/02/xen-no-red-hat-es-5</link>
		<comments>http://everlinux.com/blog/2007/05/02/xen-no-red-hat-es-5#comments</comments>
		<pubDate>Wed, 02 May 2007 21:51:58 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/2007/05/02/xen-no-red-hat-es-5/</guid>
		<description><![CDATA[O Red Hat Enterprise Server 5, assim como o Fedora Core 6 tem agora suporte a virtualização &#8220;nativo de fábrica&#8221;, com a garantia pela produtora do mesmo. A documentação está muito bem feita, conforme você pode ver nesses links Virtualization e aqui RHEL-5-manual Virtualization Para fazer a instalação do RH AS 5 como guest do [...]]]></description>
			<content:encoded><![CDATA[<p>O Red Hat Enterprise Server 5, assim como o Fedora Core 6 tem agora suporte a virtualização &#8220;nativo de fábrica&#8221;, com a garantia pela produtora do mesmo.</p>
<p>A documentação está muito bem feita, conforme você pode ver nesses links <a href="http://www.redhat.com/rhel/virtualization/">Virtualization </a> e aqui <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Virtualization-en-US/index.html">RHEL-5-manual Virtualization</a></p>
<p>Para fazer a instalação do RH AS 5 como guest do XEN, para-virtualizado ou com a virtualização full, o melhor caminho é você descompactar todas as ISO&#8217;s do RH e copiar tudo para uma único diretório acessível via http ou NFS.</p>
<p><code># mkdir /mnt/redhat<br />
# mount -o loop /iso/rhel-5-server-x86_64-disc1.iso /mnt/redhat<br />
# cp -av /mnt/redhat /var/www/html/redhat</code></p>
<p>(algo assim, para todas as ISO&#8217;s)</p>
<p>A interface gráfica do red hat pergunta direto a URL caso o sistema seja para-vitualizado, caso não seja, passe o parâmetro abaixo para o instalador para que você possa continuar a instalação via web (isso é necessário porque não é possível alterar as ISO&#8217;s durante a instalação &#8212; o que deverá ser corrigido no próximo release do RH AS 5)</p>
<p><code>linux askmethod</code></p>
<p>Como nem tudo são flores, para iniciar a máquina virtual você pode pegar esse erro:</p>
<blockquote><p># xm create -c  vm02</p>
<p>I get the following error:<br />
Using config file &#8220;/etc/xen/xm02&#8243;.<br />
Traceback (most recent call last):<br />
 File &#8220;/usr/bin/pygrub&#8221;, line 26, in ?<br />
  import grub.fsys<br />
ImportError: No module named fsys
</p></blockquote>
<p>Este workaround pode te ajudar:<br />
<code># cp -va /usr/lib64/python2.4/site-packages/grub/ /usr/lib/python/<br />
#  ls -l /usr/lib/python/grub/<br />
total 44<br />
drwxr-xr-x 3 root root 4096 Apr 27 17:16 fsys<br />
-rw-r--r-- 1 root root 7733 Oct 15  2006 GrubConf.py<br />
-rw-r--r-- 1 root root 8785 Mar  8 13:35 GrubConf.pyc<br />
-rw-r--r-- 1 root root 8785 Mar  8 13:35 GrubConf.pyo<br />
-rw-r--r-- 1 root root    0 Oct 15  2006 __init__.py<br />
-rw-r--r-- 1 root root  131 Mar  8 13:35 __init__.pyc<br />
-rw-r--r-- 1 root root  131 Mar  8 13:35 __init__.pyo<br />
</code></p>
<p>Um exemplo do arquivo de configuração gerado:</p>
<blockquote><p># cat vm02<br />
# Automatically generated xen config file<br />
name = &#8220;vm02&#8243;<br />
memory = &#8220;1024&#8243;<br />
disk = [ 'phy:/dev/vol_lvm/xen_vm02,xvda,w', ]<br />
vif = [ 'mac=00:16:3e:64:5c:e9, bridge=xenbr1', ]<br />
vfb = ["type=vnc,vncunused=1"]<br />
uuid = &#8220;cf3861bd-9174-b58c-af84-768e251af31a&#8221;<br />
bootloader=&#8221;/usr/bin/pygrub&#8221;<br />
boot=&#8221;/dev/xvda2&#8243;<br />
vcpus=1<br />
on_reboot   = &#8216;restart&#8217;<br />
on_crash    = &#8216;restart&#8217;
</p></blockquote>
<p>É isso ae!<br />
Boa sorte com as VM&#8217;s <img src='http://everlinux.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2007/05/02/xen-no-red-hat-es-5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xen no Ubuntu Feisty beta</title>
		<link>http://everlinux.com/blog/2007/03/29/xen-no-ubuntu-feisty-beta</link>
		<comments>http://everlinux.com/blog/2007/03/29/xen-no-ubuntu-feisty-beta#comments</comments>
		<pubDate>Thu, 29 Mar 2007 12:45:17 +0000</pubDate>
		<dc:creator>Tiago Cruz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.everlinux.com/blog/?p=5</guid>
		<description><![CDATA[Recentemente instalei o Ubuntu Feisty beta em uma máquina Dell Optiplex GX620 (Pentium D 2.80 GHz e 1 GB RAM), infelizmente sem o suporte a virtualização via hardware, mas mesmo assim uma máquina realmente muito potente. Aproveitei a experiência para atualizar o Wiki do Ubuntu com os procedimentos para subir uma VM rodando a última [...]]]></description>
			<content:encoded><![CDATA[<p>Recentemente instalei o Ubuntu Feisty beta em uma máquina Dell Optiplex GX620 (Pentium D 2.80 GHz e 1 GB RAM), infelizmente sem o suporte a virtualização via hardware, mas mesmo assim uma máquina realmente muito potente.</p>
<p>Aproveitei a experiência para atualizar o Wiki do Ubuntu com os procedimentos para subir uma VM rodando a última versão estável do mesmo, no caso a edgy. É impressionante notar como o projeto Xen está amadurecendo e ficando cada vez mais integrado as distribuições Linux como um todo.</p>
<p>Caso você esteja interessado, pode seguir o link<br />
<a href="https://help.ubuntu.com/community/XenVirtualMachine/XenOnUbuntuFeisty">do passo-a-passo postado no Wiki do Ubuntu</a>, mas infelizmente ainda tem muita para fazer por lá, esse é apenas uma atualização do tutorial antigo que falava sobre o Edgy.</p>
]]></content:encoded>
			<wfw:commentRss>http://everlinux.com/blog/2007/03/29/xen-no-ubuntu-feisty-beta/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  everlinux.com/blog/category/xen/feed ) in 0.78170 seconds, on Jul 30th, 2010 at 8:37 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Jul 30th, 2010 at 9:37 pm UTC -->