automatic hard linking (COW filesystems)

Ben Scott dragonhawk at gmail.com
Tue Sep 30 17:45:00 EDT 2008


On Tue, Sep 30, 2008 at 5:33 PM, Michael ODonnell
<michael.odonnell at comcast.net> wrote:
> But how do you guarantee that the filesytem is snapshotted
> in a consistent state?

  The filesystem driver in the kernel generally has mechanisms to make
sure all filesystem structures are consistent.

  The trickier part is the data in the files.  Restoring a snapshot is
more-or-less the same as rebooting the computer after having instantly
halted it at that point in time (same as, for example, a power failure
(no UPS)).  Most application software finds this at least a little
traumatic.  It's certainly not something I'd want to have to do to a
financial database or the like.

  For a more mundane example, if your word processor is in the middle
of saving a change to your document when the snapshot happens, it's
going to leave a half-written file behind.  That file will probably be
garbage.  Hopefully your word processor uses the "write new file, move
new file over old file" approach, rather than the "rewrite old file in
place" approach.

  A fairly standard requirement for any "enterprise ready"
application-level software system is the ability to get the on-disk
files into a consistent state for a snapshot.  Sometimes called "hot
backup".  This may not be all that hard.  Transactional semantics are
also generally a part of this kind of thing.  That's typically done by
writing a change set to a journal, checkpointing the journal, then
committing the change in the journal to the main file(s).  To make a
snapshot, just temporarily defer committing to main and let the
journal grow larger.

  OTOH, in many cases, we (IT admins) just accept that random files
that are being written during a snapshot might be trashed.  For a
general-purpose file share full of word processor documents,
spreadsheets, and the like, that may well be perfectly reasonable.  At
work, I've got a script that mails nastygrams^W polite reminders to
any users who leave data files open overnight (when the backup runs).
It is actually pretty effective.  :)

-- Ben


More information about the gnhlug-discuss mailing list