LoginSignup
13
15

More than 5 years have passed since last update.

OSのオンラインバックアップ

Last updated at Posted at 2015-02-20

Clonezillaやddが遅すぎたので調べた。

前提:

  • 更新の激しいサーバには向いていない。SMTPサーバやDNSサーバ、WEBサーバ程度なら良い。
  • DBサーバはDBの更新出来ないようにしてから実施すること。

今のDISK構成

  • バックアップ対象(sda,sdbの構成)

    • /boot/efi ・・・ /dev/sda1, fat ?
    • /boot ・・・ /dev/sda2, ext3
    • / ・・・ /dev/sdb1, xfs
  • バックアップ格納先

    • /media ・・・ sshfs:192.168.100.6:/mnt/3tb/sshfs/

パッケージインストール

yum install -y sshfs dump xfsdump

sshfsマウント

sshfs 192.168.100.6:/mnt/3tb/sshfs/ /media

/boot/efi/

efi
# cd /boot/efi
# tar czf /media/efi.tar.gz *

/boot/

# dump -0f - /boot | gzip > /media/boot.gz 

/

# xfsdump -l0 - /dev/sdb1 | gzip > /media/slash.gz

dumpしてみた

dumpしてみた
# /sbin/dump -0f - / | gzip --fast > $WORKDIR/slash.gz
  DUMP: Date of this level 0 dump: Sat Mar  7 06:18:57 2015
  DUMP: Dumping /dev/sda3 (/) to standard output
  DUMP: Label: /
  DUMP: Writing 10 Kilobyte records
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 5474392 blocks.
  DUMP: Volume 1 started with block 1 at: Sat Mar  7 06:28:48 2015
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: 93.02% done at 16973 kB/s, finished in 0:00
  DUMP: Volume 1 completed at: Sat Mar  7 06:34:11 2015
  DUMP: Volume 1 5615080 blocks (5483.48MB)
  DUMP: Volume 1 took 0:05:23
  DUMP: Volume 1 transfer rate: 17384 kB/s
  DUMP: 5615080 blocks (5483.48MB)
  DUMP: finished in 323 seconds, throughput 17384 kBytes/sec
  DUMP: Date of this level 0 dump: Sat Mar  7 06:18:57 2015
  DUMP: Date this dump completed:  Sat Mar  7 06:34:11 2015
  DUMP: Average transfer rate: 17384 kB/s
  DUMP: DUMP IS DONE

リストア

参考

CentOSのISOでレスキューモードで起動。
パーティションを分けてrestoreを実施

# fdisk /dev/vda
# mkfs.ext3 /dev/vda1
# mkfs.ext3 /dev/vda2
# mount /dev/vda2 /mnt/slash
# cd /mnt/slash

/

カレントディレクトリにリストア
# zcat /mnt/nfs/slash.gz | restore -r -f -

/boot

カレントディレクトリにリストア
# mount /dev/vda2 /mnt/slash/boot
# cd /dev/vda2 /mnt/slash/boot
# zcat /mnt/nfs/boot.gz | restore -r -f -

etc/fstab修正

  • Diskのパス(/dev/vda1等)とマウントポイントを要確認。
    • swapを無効化にした場合、swapの行を削除

grub

# mount --bind /proc proc
# mount --bind /dev dev
# mount --bind /sys sys
# chroot .

grub-install "/dev/hdx does not have any corresponding BIOS drive" error

以下のDiskのパスを修正

  • /boot/grub/device.map
  • 初めてパーティショニングした場合は、一度再起動するとよい。
ラベルを付ける場合
# e2label /dev/vda2 /
# e2label /dev/vda1 /boot
13
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
15