I'm looking for a backup tool for ext4 which can take a copy from a running filesystem like /var with no collisions in the system after recovering such a filesystem. I know BSD dump has an '-L' option, which tells him to work on a snapshot. But neither dump nor dumpe2fs from repositories have such an option. I've read about a patchset for ext4 providing snapshot support, but replies about it are very different, so I'm here to ask about your experience with this patchset.
Backup or snaphot tool for ext4
backupext4
Related Solutions
I will just provide a short answer because I think this is being overthought.
If you read the main kernel wiki about the btrfs (sub-)commands, you will find that there are two commands for:
- making a "backup":
btrfs-send
- and restore:
btrfs-restore
Just in case, this means that it is not (designed to be) a backup, but to be an snapshot filesystem, with the idea of rolling back if needed, not as a backup but as "flexible".
Therefore — no, do not use it as backup — use it as a versioned filesystem where you can test things and go back. Don't rely on it.
A lot of the work can be isolated. There are a lot of the commonly edited files in /etc which can be mirrored in /usr/local/etc
. Put your local changes in those, and generally they'll be picked up.
rc.conf
is a bit messy, but you can put one line in there to grab stuff from elsewhere. periodic.conf
works in much the same way.
rc.d
files (if any) can go in /usr/local/etc/rc.d
, separating them from the system ones.
You don't have to edit syslog.conf
or newsyslog.conf
because you can use small files in /usr/local/etc/{newsyslog,syslog}.conf.d
to do what you want. Copying over these directories is much easier than editing the original single files. There are various other directories that end in .d where you can put small files that are all executed as part of the original single file.
Beware of syslog.conf.d
. You have to end all the filenames in there with .conf
or they are ignored!
There are also (for example, in /etc
and /boot
) files ending in .local
. These include /boot/loader.conf.local
. These are not nicely detached from the main system directories, but the fact that they are named like that makes them easier to notice and maintain.
If you have kernel configuration files, keep them in (say) /root/config
. Then, before a buildkernel, make symbolic links to them in /sys/i386/conf
(or wherever). Otherwise, an update to /usr/src
will wipe them out - it's easier to recreate the symlink than it is to recreate (or even restore) the kernel config file.
Bear in mind that not all of these useful secondary files exist by default. That's why you have to look at manual pages for the 'main' files to see what alternatives are available.
In summary
For each of the files you find yourself editing, read its man page carefully. In most cases, you can edit or create a local file or put files in a local directory. This centralises nearly all of it under /usr/local/etc
.
Best Answer
dump
does not need a switch to work on a snapshot. Just make the snapshot with LVM, and dump it.I have a nightly cron job that does just that, using a 5 level tower of hannoi backup pattern. This means I only have to do a full backup every several months when I feel like the level 1 dumps dumps are getting too large. Level 1 dumps are made on the 1st and 17th of the month.