Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a cronned job on a production web server that requires tarring up files from across the filesystem. It runs for about 105 minutes, and during that time, Apache starts swapping because all that reading of a few gigs of files has expanded the amount of memory for the filesystem cache.

The data that tar is reading doesn't need to live in the filesystem cache. It's going into the tarfile and that's it. Is there something where we can say like tar cvf whatever/ --no-system-file-buffer-reads? My reading of man tar doesn't turn up anything that looks like it would help.

You don't have to point out that this can be seen as a "Doc, it hurts when I go like that! So don't go like that" situation. Somehow we need to dump files into a tar file, so not going like that isn't an option.

share|improve this question

I think this has been answered here:

There is the nocache utility, which can prepended to a command like ionice and nice. It works by preloading a library which adds posix_fadvise with the POSIX_FADV_DONTNEED flag to any open calls.

In simple terms, it advises the kernel that caching is not needed for that particular file; the kernel will then normally not cache the file. See here for the technical details.

It does wonders for any huge copy jobs, e. g. if you want to backup a multi terabyte disk in the background with the least possible impact on you running system, you can do something along nice -n19 ionice -c3 nocache cp -a /vol /vol2.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.