1

I have shared storage which is mounted (read-only) on SERVER1, and mounted (read-write) on SERVER2.

SERVER2 is writing data to a file. SERVER1 is reading data from that file.

The file poling is <100ms, which is fast, but lets just say it's necessary.

SERVER1 is accessing the filesystem cache, and not showing new data in the file. I can drop_caches which then returns the latest data in that file, but this process drops all file caches on SERVER1, which is not what I want to do, and it takes too long to process.

I have tried using the cat command, as well as dd if=/path/to/file -iflag=direct, but that doesn't work either. It returns an error. The flag seems not to be supported for files. Any idea on how to read a file directly from a disk, or how to disable filesystem cache for a file/directory/mount point?

I would also consider disabling file cache system-wide, but thats not my first preference, this is just for the one file. Google doesn't return a way to do this either, as most forum posts argue against such action.

Thanks!

user1955162
  • 296
  • 3
  • 16

1 Answers1

2

Do not do this. I repeat: Do not do this!

You will get cluster headaches out of this. If metadata changes in meantime, it could cause crashes and/or invalid data returned. These filesystems are not designed to work like this. Do not use them that way. This is especially bad idea with ZFS. If you really have to, use something very very basic, without journals and advanced features (like ext2 or maybe vfat).

Either use clustered filesystem (gfs, ocfs, cxfs), or some networked filesystem (glusterfs,cifs,nfs).

And just by the way. DirectIO is not implemented in ZFS On Linux. It will work on base filesystems (ext{2,3,4}, xfs, etc.)

Fox
  • 3,977
  • 18
  • 23
  • 1
    Yeah, the OP's approach sounds very wrong, but they should explain why they're doing it this way. – ewwhite Jun 29 '15 at 11:58
  • 1
    @ewwhite You're right. I'd like to hear the explanation. But even if he has a perfect reason, I'm going to tell him to stay away. It's so wrong, I can't even explain. – Fox Jun 29 '15 at 14:04