You are not logged in.

#1 2017-09-28 22:51:34

misanthropist
Member
Registered: 2017-09-17
Posts: 8

How to get a consistent backup of an ext4 fs while it is rw mounted

Like the title says, how can I make a consistent backup of an ext4 filesystem while it is mounted read/write. With ZFS I can easily create a snapshot, which I can then tar or use ZFS' built-in send feature. Having recently migrated from FreeBSD, I'm also used to dump, which can use the snapshot feature of UFS. Neither of these take changes that happen to the fs while it is being backed up into account, however that's one of the points. While the backup may be slightly outdated, it is consistent. Are there any tools that can do something similar with an ext4 fs?

edit: Eventually I'll likely move to ZFS on root, as ZFS is a filesystem with which I'm pretty familiar. However, I've not yet familiarized myself enough with the Linux booting process and how to properly configure the boot loader to dare venture into that. Thus, in the meantime I'd like to be able to get consistent backups of my ext4 / while the system is running.

Last edited by misanthropist (2017-09-29 01:00:37)

Offline

#2 2017-09-29 07:18:01

seth
Member
Registered: 2012-09-03
Posts: 49,960

Re: How to get a consistent backup of an ext4 fs while it is rw mounted

https://github.com/amir73il/next3-utils … shots-TODO

"Not" - you can make lvm snapshots when using lvm, though.

Online

#3 2017-09-29 11:27:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to get a consistent backup of an ext4 fs while it is rw mounted

I was considering suggesting btrfs when I first read your question, but it's not really an answer on how to get snapshots on ext4 ... because the answer to that is that "you can't".  But ...

misanthropist wrote:

edit: Eventually I'll likely move to ZFS on root

Now I'll suggest btrfs smile

Btrfs is still considered "experimental" and is not as mature as ZFS, but the former is more well integrated in linux.  It doesn't take much to get a full btrfs system in linux, and it is well documented.  Going full zfs in linux (I believe) requires compiling your own kernel and working around a handful of issues.  It's been done - I even remember recent threads on it on these forums - but that thread existed because the OP was running into problems.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2017-09-29 19:21:19

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: How to get a consistent backup of an ext4 fs while it is rw mounted

ZFS does not need a custom kernel but does need the out of tree zfs and spl modules and relevant user space utils compiling as covered on ZFS.
The main issue if you use ZFS for / is when a there is a kernel upgrade you need to generate updated zfs and spl modules.  The none dkms zfs packages in AUR will prevent the kernel upgrade as
the installed zfs and spl modules required exact matching kernel versions.  You could use the archzfs repo or you can generate updated modules in a clean chroot
add them to a local repo then proceed with the kernel upgrade (you could skip using the local repo but you would have to work around pacman's dependancy checking)

Offline

#5 2017-09-29 20:17:46

misanthropist
Member
Registered: 2017-09-17
Posts: 8

Re: How to get a consistent backup of an ext4 fs while it is rw mounted

@Trilby I've considered btrfs, and I may well end up using it on /. However, considering that raid 5 and 6 are said to be fatally flawed in btrfs' implementation (https://wiki.archlinux.org/index.php/Bt … ile_system), I won't use it exclusively. I have a large ZFS pool configured as raidz2, i.e. it can cope with two disks failing (so my system is already ZFS enabled, I've just not put / on it). My / resides on a single disk, so no raid. I've been considering mirroring it, but I'd need to do some hardware upgrades for that, as I have no SATA ports nor PCIe slots free.

@loqs After reading Trilby's answer, I've been researching / both on ZFS and btrfs, so most, but not all, of what you say, I've already found out. And though I don't have / on ZFS, I ran into some troubles with kernel upgrade yesterday (4.12 to 4.13), as pacman tried to upgrade zfs-dkms before spi. I spotted it, and was able to successfully issue the dkms install command manually after everything else had been upgraded but before rebooting, and everything went well.

Offline

#6 2017-10-07 21:53:57

misanthropist
Member
Registered: 2017-09-17
Posts: 8

Re: How to get a consistent backup of an ext4 fs while it is rw mounted

I went ahead and tranferred my / to ZFS, to at least try it out. It went quite well, and my system is up and running. A bit of a problem occurred with GRUB though. grub-mkconfig isn't particularly clever, and it generated non-working grub.cfg, which I had to edit by hand. Specifically it sets root=ZFS=zroot, but it should be zfs=zroot (without the root= bit). Other than that only an annoyance; during boot I get a message that zroot can't be imported as no such pool exists, followed by a message saying "no available pools to import", but the system boots fine, with all my pools imported and automounted.

Offline

Board footer

Powered by FluxBB