Advice on runtime directories ala .snapshot

Shane Adams adamsch1 at yahoo.com
Thu Feb 22 21:26:58 UTC 2007


Sorry I wasn't clear earlier.  I'd like to emulate how netapp drops a .snapshot directory in any subdirectory of a snapshotted filesystem.

It seemed natural to do this dynamically on a per-request basis.  

After reading your response I happened upon nullfs, and I'm now thinking that would be the right area to look at?  At *least* for simplicity?

Screwing around on a netapp I found all .snapshot directory entries had the same ino, while subdirectories, like nightly_0, nightly_1 etc. had seemingly unique ino's, which would indicate to me they are persisting them somehow, or not, and they cache them as long as possible/necessary.

Shane

----- Original Message ----
From: Oliver Fromme <olli at lurza.secnetix.de>
To: freebsd-fs at FreeBSD.ORG; adamsch1 at yahoo.com
Sent: Sunday, February 18, 2007 11:53:53 PM
Subject: Re: Advice on runtime directories ala .snapshot

Shane Adams wrote:
 > I've been thinking about how I could add a "virtual" directory entry
 > similar to netapp, namely a .snapshot.  Obviously I'd want to do this
 > at runtime, but I'm having trouble attacking this problem.

There's no precedent for such a thing in FreeBSD currently.
The closest thing would be the ".snap" directory used for
FreeBSD's snapshot feature, or maybe even the historical
"lost+found" directory.  But both of them are created
statically in the file system, and they represent ordinary
directory entries without any magic.

You will find purely synthetic files and directories only
in the synthetic file systems such as procfs or devfs.

 > I've been looking at the ufs_lookup routines, seems thats the only
 > place to tackle such a feature?  Or possibly inject a .snapshot entry
 > as the last entry read in a call to ufs_readdir ?

It would be easier to give advice if we knew what you're
actually trying to implement.  Personally, I think it's not
a good idea to mix real and synthetic entries within the
same file system.  Or at least there should be _very_ good
reasons for doing so, and very careful consideration of all
possible cases.  For example, what's supposed to happen in
case of a conflict, i.e. if there is already a real entry
with the same name (".snapshot") with some contents?

 > I believe doing a ls -la on a netapp will not return the .snapshot
 > directory, only explicitly nameing the directory will achieve the
 > effects you want.

That behaviour is configurable.  On a NetApp filer you can
configure per volume whether the .snapshot directory
appears only in the mount point directory, or in every
directory below it.  In the case of a NetApp it's not a big
problem to manage such synthetic directories, because it
has full controll over its file system.  Clients can only
access it remotely (NFS, SMB, ...), so from the clients'
viewpoint the whole file system is kind of "synthetic".

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
Any opinions expressed in this message are personal to the author and may
not necessarily reflect the opinions of secnetix GmbH & Co KG in any way.
FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"If you think C++ is not overly complicated, just what is a protected
abstract virtual base pure virtual private destructor, and when was the
last time you needed one?"
        -- Tom Cargil, C++ Journal





More information about the freebsd-fs mailing list