Gentoo Archives: gentoo-user

From: Iain Buchanan <iaindb@××××××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] kernel notification of file system changes
Date: Thu, 06 May 2010 02:19:42
Message-Id: 1273112234.20354.67.camel@localhost
In Reply to: Re: [gentoo-user] kernel notification of file system changes by Iain Buchanan
1 On Thu, 2010-05-06 at 08:54 +0930, Iain Buchanan wrote:
2
3 > but it's an angle to follow. I wonder how max_user_watches would handle
4 > being 100k or more... no doubt you just need some RAM?!
5 >
6 > thanks,
7
8 To answer my own questions, I'm now trying this:
9
10 # echo 100000 >/proc/sys/fs/inotify/max_user_watches
11
12 $ time sudo find / -xdev -type d | sudo inotifywatch -v -t 1 -e modify,attrib,move,create,delete,delete_self,unmount --fromfile -
13 Establishing watches...
14 Total of 71169 watches.
15 Finished establishing watches, now collecting statistics.
16 Will listen for events for 1 seconds.
17 total modify filename
18 6 6 /tmp/
19 2 2 /dev/
20
21 real 0m3.177s
22 user 0m0.768s
23 sys 0m1.378s
24
25 This sets up a watch on all directories under / that aren't part of
26 another filesystem, and then exits after one second. It's quite fast :)
27
28 The idea, off the top of my head, would be this:
29 1. inotifywatch as above but without the time restriction
30 2. wait for it to finishing "setting up"
31 3. rsync the whole directory structure to the backup
32 4. continuously do this loop:
33 1. get list of changes from inotifywatch
34 2. rsync those changes
35
36 Unfortunately inotifywatch only returns output on ctrl-c, which I don't
37 want to do or you loose anything changed between instances. This could
38 be changed to another signal, no doubt.
39
40 How does that sound for a continuous running backup? This is starting
41 to stray OT from Gentoo, but your thoughts are welcome :)
42 --
43 Iain Buchanan <iaindb at netspace dot net dot au>
44
45 One cannot make an omelette without breaking eggs -- but it is amazing
46 how many eggs one can break without making a decent omelette.
47 -- Professor Charles P. Issawi