[CentOS] Preventing the nightly backup from disturbing the cache

Mon Apr 24 21:55:18 UTC 2006
Steve Bergman <steve at rueb.com>

Andy Green wrote:

> Adam Gibson wrote:
>
>
> It's possible to use the flag
>
> O_DIRECT
>

Thanks.  :-)

In case anyone is interested, below is a patch against the current 
centos tar-1.14-9.RHEL4 SRPM.

I've tested it and it seems to do what I wanted.

1. Get the SRPM.
2. rpm -i tar-1.14-9.RHEL4.src.rpm
3. cd /usr/src/redhat/SPEC
4. rpmbuild -bp tar.spec
5. cd ../BUILD/tar-1.14/
6. patch -p1 < /path/to/patchdir/tar_no_cache.patch
7. ./configure
8. make
9. cp src/tar /usr/local/bin/tar_no_cache

tar_no_cache -c -v -f /dev/st0 .


================================================


--- src/create.c.orig   2006-04-24 15:39:00.000000000 -0500
+++ src/create.c        2006-04-24 16:28:13.000000000 -0500
@@ -1373,7 +1373,7 @@
          if (file_dumpable_p (st))
            {
              fd = open (st->orig_file_name,
-                        O_RDONLY | O_BINARY);
+                        O_RDONLY | O_BINARY | O_DIRECT);
              if (fd < 0)
                {
                  if (!top_level && errno == ENOENT)