6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rsyncでdumpの同期

6
Last updated at Posted at 2016-04-18

rsyncでdumpの同期

  • LXCコンテナのバックアップ先にNFSを指定するととんでもなく時間がかかる。
    • 120GBで17〜23時間程。(ローカルでは1時間50分〜2時間10分程)
  • これはLXCコンテナ内のファイルを一個ずつNFS先に転送してから圧縮するのが原因。
    • ローカルでバックアップしたものをNFSに転送することにした。

準備

  • rsyncでミスった時の被害を減らすため、一般ユーザ(user1)を作成して実施する。
一般ユーザに権限付与
chown -R user1:users /mnt/pve/nfssrv/

cron

user1にて実施
30 2 * * * (/home/user1/bin/rsync_dump.sh)

この時間は、おそらくこのくらいにバックアップ終わってそうだな、という時間を指定した。
(6時間おきとかに実行してもいいかも。)

バックアップスクリプト

/home/user1/bin/rsync_dump.sh
# !/bin/sh

# nfssrvをマウントしているか確認
grep nfssrv /proc/mounts > /dev/null
if [ ! $? -eq 0 ];then
    echo "/mnt/pve/nfssrv/dump/ is not mount."
    exit 1
fi

# rsync -a --delete -h --list-only \
rsync -a --delete -h \
  --include='*.lzo' \
  --include='*.log' \
  --exclude='*' \
  /mnt/g1000_1/dump/ /mnt/pve/nfssrv/dump/

参考

6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?