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.
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.