Filip Sneppe
2007-Sep-12 22:53 UTC
userspace tool to freeze/thaw ext3 to create consistent snapshots
Hi everyone, Suppose one has an ext3 filesystem on a SAN LUN. I would like to know if it is possible to freeze this ext3 filesystem into something consistent from a filesystem point of view, then trigger the SAN's snapshotting functionality, and then thaw the ext3 filesystem to resume I/O. This would allow near-instantaneous snapshot backups without having to use LVM or LVM snapshots.>From googling around, I understand that:- LVM can take consistent snapshots at the FS level, and from posts to LKML, I understand that all Linux filesystems now support suspending I/O activity during these snapshots as a requirement for LVM snapshotting. - XFS has a userspace command "xfs_freeze [-u] mountpoint" which appears to do exactly what I want to achieve with ext3 - GFS has a userspace command "gfs_tool [un]freeze mountpoint" which appears to do the same thing So, my questions are: - Is this currently possible from userspace with ext3 ? If not, is this hard to write ? (I am not an expert programmer, but from looking at the XFS and GFS userspace code, things are done totally differently) - Given that all Linux FS support suspending of I/O operations, is it technically possible to write a generic userspace tool to do just that: freezing/thawing I/O requests to a mountpoint from userspace, no matter what the underlying FS is ?>From the various posts with similar questions that pop up onvarious mailing lists and support forums, it would appear to me that there is some level of interest/demand for this type of feature. Regards, Filip
Jérôme Petazzoni
2007-Sep-12 23:52 UTC
userspace tool to freeze/thaw ext3 to create consistent snapshots
Filip Sneppe wrote:> Hi everyone, > > Suppose one has an ext3 filesystem on a SAN LUN. > I would like to know if it is possible to freeze this ext3 filesystem > into something > consistent from a filesystem point of view, then trigger the SAN's snapshotting > functionality, and then thaw the ext3 filesystem to resume I/O. This > would allow > near-instantaneous snapshot backups without having to use LVM or > LVM snapshots. >I think (but I might be wrong) that this feature is not implemented - yet - for ext3fs. However, LVM2 should allow to create read-write snapshots. Therefore, you can snapshot whenever you want, then mount the snapshot, like you would mount an ? unclean ? filesystem (i.e. the log will be replayed, and that's it). One might argue that this could give unconsistent snapshots ; however (the gurus will tell if I'm wrong) since your programs are running when you do the snapshot, it should not change anything whether you do a ? hot ? snapshot or a ? thawed ? snapshot. regards
Andreas Dilger
2007-Sep-13 00:24 UTC
userspace tool to freeze/thaw ext3 to create consistent snapshots
On Sep 13, 2007 00:53 +0200, Filip Sneppe wrote:> Suppose one has an ext3 filesystem on a SAN LUN. > I would like to know if it is possible to freeze this ext3 filesystem > into something > consistent from a filesystem point of view, then trigger the SAN's snapshotting > functionality, and then thaw the ext3 filesystem to resume I/O. This > would allow > near-instantaneous snapshot backups without having to use LVM or > LVM snapshots.You could probably make an ioctl to ext3 to do this, calling the existing code to flush the journal during snapshots.> So, my questions are: > - Is this currently possible from userspace with ext3 ? If not, is this > hard to write ? (I am not an expert programmer, but from looking at the > XFS and GFS userspace code, things are done totally differently) > - Given that all Linux FS support suspending of I/O operations, > is it technically possible to write a generic userspace tool to do just > that: freezing/thawing I/O requests to a mountpoint from userspace, > no matter what the underlying FS is ?Yes, if there is a common ioctl or syscall - the filesystems themselves have a common method to do the freeze/thaw. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.