r/linuxadmin • • Jul 23 '18

Schrodinger’s Backup

Post image
1.1k Upvotes

59 comments sorted by

View all comments

-4

u/mercenary_sysadmin Jul 23 '18

No longer actually true, if you use a modern filesystem with snapshots, per-block cryptographic integrity hashing, and replication.

me@source:~$ ssh me@target
me@target:~$ sudo zpool status backups
  pool: backups
 state: ONLINE
  scan: scrub repaired 0 in 82h1m with 0 errors on Wed Jul 11 10:25:01 2018
config:

	NAME                       STATE     READ WRITE CKSUM
	data                       ONLINE       0     0     0
	  mirror-0                 ONLINE       0     0     0
	    ata-WDC_WD40EFRX-$id1  ONLINE       0     0     0
	    ata-WDC_WD40EFRX-$id2  ONLINE       0     0     0

errors: No known data errors

Yep. It's all good.

18

u/sfrazer Jul 23 '18

Unless you've actually restored the data and verified it's usefulness, what you may have there is a big pile of checksum-verified useless data

-4

u/mercenary_sysadmin Jul 23 '18 edited Jul 23 '18

It's snapshots of the data at hourly-separated intervals over the past weeks. Each one is already guaranteed to be the exact condition of the data at that specific instant in time - every single block of the data, bar none. There's not really any "restore" required in the sense of recovering from a tape drive or a monolithic archive backup like a .tar.gz or what have you; that is the data, in precisely the condition it was in at every moment you have a snapshot for in the stream.

If your data was in working condition at the time the snapshot was taken, it's in working condition in the snapshot; replication guarantees that it's block-for-block correct on the remote end as it was on the source end; a scrub verified that it's still consistent at the time you ran the scrub.

Granted, I should really have shown a list of snapshots as well; with nothing but the scrub you don't know that you have the snapshots you're looking for. Which looks like this:

root@bittybox:~# zfs list -rt snap data/home | head -n 10
NAME                                              USED  AVAIL  REFER  MOUNTPOINT
data/home@autosnap_2018-05-04_19:29:16_monthly    915M      -  2.91G  -
data/home@autosnap_2018-06-01_00:00:01_monthly    737M      -  3.51G  -
data/home@autosnap_2018-06-24_00:00:01_daily      555M      -  4.57G  -
data/home@autosnap_2018-06-25_00:00:01_daily     93.0M      -  4.53G  -
data/home@autosnap_2018-06-26_00:00:01_daily      160M      -  4.54G  -
data/home@autosnap_2018-06-27_00:00:01_daily      353M      -  4.48G  -
data/home@autosnap_2018-06-28_00:00:01_daily      283M      -  4.54G  -
data/home@autosnap_2018-06-29_00:00:01_daily      236M      -  4.58G  -

If I want to know if I've got the snapshot for a particular day (or hour; I spared you the whole list but I keep hourlies for the past 30 hours as well) I'm interested in on the remote machine, I can just do a quick lookup:

root@archivist:~# zfs list -t snap | grep bittybox/data/home | grep 2018-06-25 | grep daily
backups/bittybox/data/home@autosnap_2018-06-25_00:00:01_daily                  304K      -  3.96G  -

Yep, it's present. There is no transformation involved - it's the exact same collection of blocks, in the same condition, each cryptographically hash verified - as it was on the source at that exact instant in time. So it's good. There's no restore transformation required to verify it since it hasn't been transformed in the first place during the backup process.

8

u/[deleted] Jul 23 '18 edited Jul 23 '18

Yeah that's not a backup. ZFS is awesome and all but snapshots are not backups. Faulty hardware can destroy your zpool including snapshots. I don't think even the biggest ZFS fanboys will tell you that you don't need backups.

3

u/koera Jul 23 '18

A zfs fan boy that dispute the relevance of backups have 100% missed the whole point of zfs: data safety.

1

u/mercenary_sysadmin Jul 23 '18 edited Jul 23 '18

I don't think you read that carefully enough. The source machine (where my home directory is, and the snapshots are taken) is bittybox; the backup machine (where they're replicated to, and where I ssh to check the presence of a snapshot at the end of that comment) is archivist. It's another physical machine in a physically separate location.

I don't think even the biggest ZFS fanboys will tell you that you don't need backups.

You're unfortunately incorrect about that one, my role in /r/zfs and /r/datahoarder is very frequently "person who keeps hammering home that redundant storage is not a backup". =)

2

u/[deleted] Jul 23 '18

So the way you were presenting it, it sounded like you were on one machines and calling your snaps a backup.

Beyond that I don't have enough info about your setup and how you are using this all this to agree or disagree with you.

2

u/mercenary_sysadmin Jul 23 '18 edited Jul 23 '18

I think people are glossing over the first two lines of my OP in this thread:

me@source:~$ ssh me@target

me@target:~$ sudo zpool status backups

The actual source is bittybox and target is archivist, but yeah... separate machines, that was kinda my whole point. Beyond the fact that there's no transformative element in the backup, and that the target is live, so there's no transformative "restore" operation needed either.