我目前使用本地 USB 驱动器备份 Fedora Linux 服务器rsync
。到目前为止,这似乎满足了我的需求,但我认为还有更好的方法。很久以前,我曾经使用磁带,但现在备份服务器所需的磁带备份价格远远超出了我的承受范围。自动化备份会更好。虽然我想我可以自动执行当前的rsync
备份,但这意味着要一直开着 USB 驱动器。
有什么想法吗?
答案1
我使用的解决方案是找到一个不介意在家里安装小型无风扇服务器的朋友。然后我有一个自动 rsync 脚本,它可以在夜间运行,将我的数据同步到远程位置。
答案2
我使用以下方式备份我的服务器表里不一到 amazon S3。我每季度进行一次完整备份,每晚进行一次增量备份。效果很好。
答案3
我用快照它使用 rsync 并且可以很好地执行增量/完整备份。
我编写了一个 shell 脚本,从 cron 作业运行该脚本来挂载磁盘,运行 rsnapshot,然后卸载磁盘,因此它不会一直被挂载。
以下是我使用的脚本。第一个是 /usr/local/sbin/backup.sh,它基本上是执行实际工作的脚本的包装器,捕获其输出和退出状态,然后将结果通过电子邮件发送给 root:
#!/bin/sh
#
# Run the dobackup script, capturing the output and then mail it to the
# backup alias person with the right subject line.
#
BACKUP_TYPE=daily
if [ "a$1" != "a" ] ; then
BACKUP_TYPE=$1
fi
/usr/local/sbin/dobackup.sh ${BACKUP_TYPE} < /dev/null > /tmp/backup.txt 2>&1
RET=$?
SUBJECT="${BACKUP_TYPE} backup for $(hostname) (ERRORS)"
if [ "a$RET" = "a0" ] ; then
SUBJECT="${BACKUP_TYPE} backup for $(hostname) (successful)"
elif [ "a$RET" = "a2" ] ; then
SUBJECT="${BACKUP_TYPE} backup for $(hostname) (WARNINGS)"
fi
mail -s "$SUBJECT" root < /tmp/backup.txt
exit $RET
这是 /usr/local/sbin/dobackup.sh,它是真正的主力:
#!/bin/sh
#
# Perform the backup, returning the following return codes:
#
# 0 - backup successful
# 1 - errors
# 2 - backup successful, but with warnings.
#
if [ -e /dev/sdb1 ] ; then
BACKUP_DEV=/dev/sdb1
else
echo "No backup device available."
echo "CANNOT CONTINUE WITH BACKUP."
exit 1
fi
BACKUP_DIR=/mnt/backup
BACKUP_TYPE=daily
if [ "a$1" != "a" ] ; then
BACKUP_TYPE=$1
fi
echo "Performing ${BACKUP_TYPE} backup."
umount $BACKUP_DEV 2> /dev/null
mount $BACKUP_DEV $BACKUP_DIR
if [ "a$?" != "a0" ] ; then
echo "Error occurred trying to mount the external drive with the following command:"
echo " mount $BACKUP_DEV $BACKUP_DIR"
echo "CANNOT CONTINUE WITH BACKUP."
exit 1
fi
date
rsnapshot $BACKUP_TYPE
RET=$?
date
if [ "a$RET" = "a0" ] ; then
echo "Snapshot performed successfully."
elif [ "a$RET" = "a2" ] ; then
echo "Snapshot performed, but with warnings."
else
echo "Snapshot had errors (returned ${RET})."
fi
umount $BACKUP_DIR
if [ "a$?" != "a0" ] ; then
echo "Error occurred trying to unmount the external drive with the following command:"
echo " umount $BACKUP_DIR"
exit 1
fi
exit $RET
修改BACKUP_DEV
和BACKUP_DIR
变量以适应。
答案4
大多数答案在这个问题中也适用于此处。提到的大多数工具在 Linux 上都可以正常工作。