Citrix XenServer/Mondo Rescueを使ってXenServerの仮想ホストへ

Mondo Rescueを使ってXenServerの仮想ホストへ

環境

CentOS 5.4

afio buffer mindi mindi-busybox mondo lzo lzop 

lzo インストール

ダウンロードURL

http://www.oberhumer.com/opensource/lzo/download/

# tar zxvf lzo-2.03.tar.gz
# cd lzo-2.03
# ./configure
# make
# make install

lzop インストール

ダウンロードURL

http://www.lzop.org/

yumリポリトジ追加

# vi /etc/yum.repos.d/mondorescue.repo

[mondorescue]
name=rhel 5 - mondorescue Vanilla Packages
baseurl=ftp://ftp.mondorescue.org/rhel/5
enabled=1
gpgcheck=0

afio/buffer/mi インストール

# yum install afio
# yum install buffer
# yum install mindi

バックアップ

# /usr/sbin/mondoarchive -Oi -F -L -N -s 4200m -d バックアップ保存先ディレクトリ -E バックアップ除外ディレクトリ

■例

# mondoarchive -Oi -F -L -N -s 4200m -d /backup -E /backup

上記コマンドを実行すると、バックアップ保存先ディレクトリにisoイメージ( mondorescue-1.iso)が作成されます。

リストア下準備

"boot:"と表示されたところで、expertと入力します。

boot: expert

# fdisk /dev/hda

※今回は2つのパーティションを作成し、ブート用、LVM用として使います。 ブート用パーティションは256MB、残りをLVM用パーティションに割り当てています。

----------以下 fdiskコマンド----------
Command (m for help): n
Command action: p
Partition number (1-4): 1
First cylinder : enter
Last cylinder : +256M

Command (m for help): n
Command action: p
Partition number (1-4): 2
First cylinder : enter
Last cylinder : enter

Command (m for help): t
Partition number (1-4): 2
Hex Code : 8e

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p
Device   Boot Start  End     Blocks  Id  System
/dev/hda1  *     1   256  2056288+  83     Linux
/dev/hda2       257 1305  8426092+  8e     Linux LVM

Command (m for help): w

----------ここまで----------

■フィジカルボリュームの作成

# pvcreate /dev/hda2
# pvdisplay /dev/hda2

■ボリュームグループの作成 ※この辺のボリュームグループ名は元ホストと合わせた方が良い

# vgcreate Volume00 /dev/hda2
# vgdisplay

■論理ボリュームの作成 ※この辺のボリューム名は元ホストと合わせた方が良い

# lvcreate -L 6144m -n LogVol00 Volume00
# lvcreate -L 2048m -n LogVol01 Volume00
# lvdisplay /dev/Volume00/LogVol00
# lvdisplay /dev/Volume00/LogVol01

LVMを作成したら次に各パーティションをフォーマットします。

# mkfs.ext3 -j /dev/hda1
# mkfs.ext3 -j /dev/Volume00/LogVol00
# mkswap /dev/Volume00/LogVol01

リストア

# mondorestore

mondorestoreコマンドを実行すると簡易GUI画面が表示されます。


How should I restore?: Interactively

Read from: DVD disks

Editing Mountlist:

物理マシンがIDE接続のハードディスクと使っていると/dev/hdaとなっているかと思います。
VMwareではSCSIを使うので、hdaをsdaに変更します。
特殊なデバイスのパスを持っている場合もsd*(sdaやsdb)に変更します。また全てのデバイスのSize(MB)を0MBに修正します。
mountlist例:
Device            Mountpoint     Format  Size(MB)
/dev/sda2                    lvm            lvm              0
/dev/Volume00/LogVol00  /            ext3              0
/dev/sda1                 /boot            ext3              0
/dev/Volume00/LogVol01 swap       swap             0

Are you sure you want to save your mountlist and continue?: Yes

Do you want to erase and partition your hard drives?: No

Do you want to format your hard drives?: No

Do you want me to restore all of your data?: Yes

ここでYesを押すとデータの復元が開始します。

Initialize the boot loader?: Yes

Did you change the mountlist?: Yes

Boot device: /dev/sda

You will now edit fstab and grub.conf:

fstabとgrub.confを修正します。

※LABELを使っている場合、この後に行う作業に失敗してしまうので修正します。
今回の環境はLABEL=/ ⇒ /dev/Volume00/LogVol00 , LABEL=/boot ⇒ /dev/sda1 に変更します。
また、/dev/hdaなどは/dev/sdaに変更します。
grub.confも同様に変更します。

Label your ext2 and ext3 partitions if necessary?: Yes

----------ここまで----------

以上でOSイメージの復元は終了です。

http://blog.livedoor.jp/nslab/archives/621542.html