On Fri, 28 May 2004 [EMAIL PROTECTED] wrote:
> On Fri, May 28, 2004 at 03:31:36PM +0800, Pong wrote: > > how about writing a script which checks a known directory/file > > on the mounted disk. then run it under crond. if the disk has been > > physically removed, the script will send an alert: syslog, email, etc... > > > > If the disk has been physically removed, this will cause a very long > hang on accessing the file, and a lot of kernel-level errors within > syslog. It can take up to several minutes for the kernel to decide that > something is very wrong, and you'll have a syslog that is up to 100k > larger for your troubles. > i dont have a removable drive to verify that but i did test it on a floppy. a) if the file has been previously accessed, a 'read' operation will succeed even if the floppy disk is no longer there. that is due to the disk cache. b) so the checking script must access a non-existent file first on the mounted fs to force the kernel vfs layer to invalidate the cached contents of the removed disk. c) the script should now then access the target file. because the disk cache would have been updated by then, an error we are expecting should return. and it did, and it all elapsed on what seemed like a brief second i checked syslog, and it took 3.8k per failed access. now of course, 3.8k is alot and 100k is even a small figure but the script can be made intelligent to prevent hosing the logs. and i suppose the length of 'hang' on accessing a removed fs will depend on how smart the drive engine is. meron pa bang mas matagal ng 5 seconds ngayon? pong -- Philippine Linux Users' Group (PLUG) Mailing List [EMAIL PROTECTED] (#PLUG @ irc.free.net.ph) Official Website: http://plug.linux.org.ph Searchable Archives: http://marc.free.net.ph . To leave, go to http://lists.q-linux.com/mailman/listinfo/plug . Are you a Linux newbie? To join the newbie list, go to http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie
