Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do i disable the linux file cache on a xfs partition (both read an write).

We have a xfs partition over a hardware RAID that stores our RAW HD Video. Most of the shoots are 50-300gb each so the linux cache has a hit-rate of 0.001%.

I have tryed the sync option but it still fills up the cache when copinging the files.
( about 30x over per shoot :P )

/etc/fstab:

/dev/sdb1 /video xfs sync,noatime,nodiratime,logbufs=8 0 1

Im running debian lenny if it helps.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

there is a solution which perfectly fits your use case: http://code.google.com/p/pagecache-mangagement/

After checking out the source code:

svn checkout http://pagecache-mangagement.googlecode.com/svn/trunk/ pagecache-mangagement-read-only

issue

make
sudo cp *.so /usr/local/lib/
sudo cp *.sh /usr/local/bin/

then, you can start whatever application you want with

pagecache-mangagement.sh <App>

and the App won't fill up your caches!

share|improve this answer
1  
This was just what I needed for a different job, same problem. Now my other programs can use there cache where it's more useful. –  complistic Jun 5 '13 at 4:47

This cannot be done cleanly. If you require this for certain applications then they should be modified to pass O_DIRECT to their open(2) calls.

share|improve this answer
    
The files are written/read with various 3rd party applications... mv, md5sum, samba and the like. I maybe able to replace some of these with my own C app in the future... but as far as i can tell samba dosnt have a O_DIRECT option. –  complistic Feb 8 '11 at 6:48
    
This seems to be the closet i could get. I'm now using O_DIRECT to copy from P2 card to the HDD and then again from P2 card to md5sum for checking. This removes the useless half of the cache so the only things that are cached video files on the HDD. –  complistic Apr 12 '11 at 21:14

man raw. You can bind a raw device that bypasses the cache with that. It has some restrictions. I've only used it with CD/DVD devices, so I don't know how well it will work for you.

share|improve this answer
    
Does the raw command bind the divice in a way i can mount my xfs partition to /video for use with samba? The documentation and google results seem to be a bit vague. –  complistic Feb 8 '11 at 6:37
    
You shouldn't mix them. I think you can mount the new raw device instead. –  Keith Feb 8 '11 at 6:39
    
Okay I will test this on an old blank drive when I get a chance. –  complistic Feb 8 '11 at 6:55

Your Answer

 
discard

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.