RogerBW's Blog

Building a File Server 4: maintenance 18 October 2017

In this (probably final) part of the series on building a file server, I'll talk about keeping the thing running once you've got it. This is specific to the ZFS approach.

Scrub once a week or so (this reads every piece of data to make sure they're still legible). I think Debian zfs packages now come with a once-a-month crontab; that could work too.

zpool scrub storage

Take snapshots at least every day, quite possibly more often. This is your backup in case you accidentally delete or overwrite a file. I keep seven days of snapshots, deleting the oldest one just after the latest one's been added. You can do this on the entire pool, recursing down the individual filesystems on it (which is what these commands do), or to individual filesystems. Snapshot data are accessible within the filesystem under .zfs/snapshots/NAME.

zfs snapshot -r storage@NEWNAME
zfs destroy -r storage@OLDNAME

If you have a second server also running ZFS, you can do incremental backups (e.g. from the previous day's snapshot to the one you've just taken). Look into zfs send and zfs receive for that; the syntax will vary based on your needs. I end up doing

zfs send -R -I LASTSNAP FILESYSTEM@THISSNAP |ssh BACKUPSERVER "/sbin/zfs receive -F FILESYSTEM"

Check the health of the pool every so often (use a Nagios plugin, or look at the output of zpool status). When you need to replace a disc, in theory hot-swap bays let you do this without downtime, but in practice it's always easier to shut the machine down for the hardware swap.

Use your list of disc serial numbers (see, that's why I told you to make it) to confirm that you're pulling the right disc. Drop in the new one, reboot, and:

zpool replace -o ashift=12 storage pci-0000…

where the last parameter is the disc ID shown by zpool status as having failed. ZFS will start resilvering at once (copying data back onto that disc).

When it's time to expand your array, put in another slab of discs, get the new path IDs, and:

zpool add -o ashift=12 storage raidz2 /dev/disk/by-path/pci-0000…

When doing a replace or add with new discs, you may get a warning that a disc "does not contain an EFI label but it may contain partition information in the MBR". The easiest way round this is to use the -f flag, though the usual provisos apply; make sure you're not overwriting a disc with data on it.

Tags: computing

See also:
Building a File Server 1: planning
Building a File Server 2: hardware
Building a File Server 3: software

Comments on this post are now closed. If you have particular grounds for adding a late comment, comment on a more recent post quoting the URL of this one.

Search
Archive
Tags 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s 2010s 3d printing action aeronautics aikakirja anecdote animation anime army astronomy audio tech base commerce battletech beer boardgaming bookmonth chain of command children chronicle church of no redeeming virtues cold war comedy computing contemporary cornish smuggler cosmic encounter coup cycling dead of winter doctor who documentary drama driving drone ecchi economics espionage essen 2015 essen 2016 essen 2017 essen 2018 existential risk falklands war fandom fantasy film firefly first world war flash point food garmin drive gazebo geodata gin gurps gurps 101 harpoon historical history horror hugo 2014 hugo 2015 hugo 2016 hugo 2017 hugo 2018 hugo-nebula reread in brief avoid instrumented life kickstarter learn to play leaving earth linux mecha museum mystery naval non-fiction one for the brow opera perl photography podcast politics powers prediction privacy project woolsack pyracantha quantum rail ranting raspberry pi reading reading boardgames social real life restaurant reviews romance rpg a day rpgs science fiction scythe second world war security shipwreck simutrans smartphone south atlantic war squaddies stationery steampunk stuarts suburbia superheroes suspense television the resistance thirsty meeples thriller tin soldier torg toys trailers travel vietnam war war wargaming weather wives and sweethearts writing about writing x-wing young adult
Special All book reviews, All film reviews
Produced by aikakirja v0.1