[linux-lvm] How do you mount a snapshot?

Andreas Dilger adilger at turbolinux.com
Mon Dec 11 18:35:13 UTC 2000


David Gould writes:
> On Fri, Dec 08, 2000 at 09:30:50PM +0100, Christian Limpach wrote:
> > > Ok, so we are agreeing, it does not work on ext2 either unless you sync
> > > and do not write between the sync and the snapshot. Doable, but not
> > exactly
> > > "safe".
> > 
> > hmm, I think it works for ext2 because you can always mount an ext2
> > filesystem even if it's in an inconsistent state.  This is what happens
> > everytime when your machine panics and you need to fsck your disks during
> > the reboot, the root filesystem is mounted read-only...  It's my
> 
> Ok, but then you have an inconsistant filesystem. Which is not exactly
> what I think of as "works" or "safe". My point was that snapshots are
> great, but don't make the problem of consistancy magically disappear.

Actually, the LVM snapshot code does an fsync_dev() call right before
the snapshot is created, so the window in which the filesystem can
become inconsistent is very small.  For ext2 this is relatively safe,
because fsync_dev() will flush everything to disk.  For ext3 and reiserfs,
the fsync_dev() isn't enough because it may only flush the data to the
journal, and these filesystems will (currently) refuse to mount with a
dirty journal on a read-only device.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert



More information about the linux-lvm mailing list