FSArchiver - Live system backup

About

FSArchiver can be used to backup linux operating systems when they are running. In other words, if you have linux installed on your hard disk, and it’s currently running, you can make a backup of that disk using fsarchiver. It’s called a live backup or hot backup. All you need is an fsarchiver binary, an another filesystem where to save the archive. It can be on another partition on the hard-disk, or a network file-system such as Samba of NFS.

Backup with a snapshot

If the partitions you want to save are LVM (Logical volume Manager) Logical-Volumes, and it you have free extents in the Volume-Group, then you can make a filesystem snapshot of these Logical-Volumes. A snapshot if a frozen copy of a Logical-Volume made at a given time. After that time, the original partition can still be modified normally, and the snapshot provides a consistent filesystem that can be backed up. To create an LVM snapshot, you have to use lvcreate with option --snapshot, and then the snapshot can be mounted read-only on a directory. By default, all the partitions except /boot are configured as Logical-Volumes with recent Redhat-Enterprise and Fedora distributions. You can have the list of all your Logical-Volumes with the command called lvdisplay. If this command is not installed on your system, you are probably not using LVM.

# lvdisplay -c
  /dev/vgmain/distfiles:vgmain:3:1:-1:1:12582912:1536:-1:0:-1:251:21
  /dev/vgmain/misc:vgmain:3:1:-1:1:50331648:6144:-1:0:-1:251:29
  /dev/vgmain/tftpboot:vgmain:3:1:-1:1:1048576:128:-1:0:-1:251:30
  /dev/vgmain/vdisk:vgmain:3:1:-1:1:209715200:25600:-1:0:-1:251:31
  /dev/vgmain/chrooti386:vgmain:3:1:-1:2:1572864:192:-1:0:-1:251:32

You can use rubackup to make fsarchiver backups, and it can automatically create an LVM Snapshot just before the backup, and it will delete just after the backup has been done.

Backup with no snapshot

If your partition are not LVM Logical-Volumes, you can’t make a snapshot. If the partition are not used, it’s recommended to remount it as read-only, with the following command:

mount -o remount,ro /dev/xxx

If the partition cannot be remounted read-only (which is the case of the root filesystem in general), it’s still possible to use fsarchiver to make a backup, but you will have to take extra care. By default, fsarchiver complains if you try to save a filesystem which is mounted in read-write mode. This is because in cannot guarantee that the data will be consistent because files may change during the backup of the filesystem. This is the reason why it shows the following error message, and stops:

# fsarchiver savefs /mnt/archives/gentoo-backup-20090328-01.fsa /dev/sda2 -v
create.c#0642,filesystem_mount_partition(): partition [/dev/sda2] is mounted read/write.
     please mount it read-only and then try again. you can do "mount -o remount,ro /dev/sda2".
     you can also run fsarchiver with option '-A' if you know what you are doing.
removing /mnt/archives/gentoo-backup-20090328-01.fsa

When a filesystem is writeable during the backup, it means changes can be done in files during that time, and there may be inconsistencies in the data. For instance, if you are backing up a web server which is running both Apache and Mysql, the Mysql database refers to files that can be uploaded in the Apache directory from the website. In that case the backup could contains a reference in the database but not the referred file because these files have been backed up already. So you have to know whether or not your system may have such inconsistencies.

If there is no risk of inconsistency, then you can use fsarchiver with option -A to continue the backup of a filesystem which is mounted in read-write mode.

Restoration

If you have a problem on your filesystems, you may want to restore the live-backup you made. You cannot restore a filesystem which is mounted, so it’s necessary to restore from a Linux-Rescue system. We recommend that you use SystemRescue for multiple reasons:

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值