Question: tracking filesystem changes?

Deomid Ryabkov myself at rojer.pp.ru
Wed Feb 2 06:00:28 PST 2005


Milan Obuch wrote:

>>>>>>This could be a custom filesystem wrapper for UFS that would report
>>>>>>name of the file/directory being changed.
>>>>>>            
>>>>>>
>>>>>Couldn't you use kqueue system to monitor the directory-file?
>>>>>          
>>>>>
>>>>I could, if I hadn't near 10 millions of them.
>>>>        
>>>>
>>>Hm. I meant monitoring the directory itself, as a file, then parsing
>>>the directory list to determine what has changed. But with 10M files,
>>>probably nothing would work...
>>>      
>>>
>>these are 10M of static documents, the daily change is minmal.
>>the question is: where it is the appropriate place to collect those
>>changes? the right way seems to implement a customs filesystem, but would
>>it possible to obtain a full path at that level?
>>
>Did you consider using fam (file alteration monitor) from ports?
>  
>
No, won't do the trick either.
I cannot afford setting up watchdogs for every file or even every directory.
And I'm essentially "interested" in every one of them (for mirroring 
purposes).
A more general approach is needed.
E.g., if an unlink call is issued and an inode is within a particular 
filesystem (luckily, most of our data
already lives on or can be easily moved to a separate filesystem), a 
notice is sent to some userland daemon:
"file /www/xxx/yyy.shtml is unlinked". Or opened for writing, or 
renamed... etc.
The file is then scheduled for distribution to mirrors.
The idea seems simple and straightforward, yet I don't know if it is 
achievable.

The essential part is obtaining the full pathname of the file (won't 
bother with hardlinks at first, they aren't used here).
Could that be done with the FreeBSD's filesystem (vnode/vfs?) code? 
(which I'm not familiar with)

--
Deomid Ryabkov aka Rojer
myself at rojer.pp.ru
rojer at sysadmins.ru
ICQ: 8025844

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3228 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20050202/8abe0812/smime.bin


More information about the freebsd-hackers mailing list