On Tue, Jan 11, 2000 at 09:48:16AM +0530, Krishna Sreehasam wrote:
> hi,
> I have a problem with syncing of data on to the SCSi disk. I have a
> SCSI disk pack connected to two machines acting as a shared disk. The
> problem is if I write data from one machine and then try to read it from
> the other, the data is not visible. I mounted the partition on machine1
> and then tried to write some data. It was visible then. Then, I unmounted
> it and mounted the same partition from the machine2. The data which
> I wrote was not visible there. I think it is a syncing problem. Any
> ideas,explanations,suggestionsans solutions are extremely welcome. please
> do mail me if you need any extra information.
A setup with two hosts sharing a disk is possible, but be aware of the fact,
that both kernels buffer the data, which they read from disk or which they
want to write to the disk. One kernel can not know, that the other changed
a file.
This is no problem, if you don't have the same partition mounted on both
computers.
If you want to do that, you can mount it ro on both boxes. That won't give
any problems, as one can not change the data behind the other one's back.
If you want to write to a shared partition, things get really complicated.
You can mount a partition rw on one box and ro on another one. The box,
which has the partition mounted ro might crash, but you won't corrupt your
filesystem, at least. This will most possibly happen, if you mount rw on
more than one host.
About the ro/rw setup: For the rw mounting host, everything is fine. What he
can read from disk, is what he expects, because he's the only one changing
data on it. But the other host won't get a consistent view of the
filesystem. He has some data in its cache and reads some more from disk,
while the filesystem was changed in between. Inconsistent data will in the
best case result in wrong data being read and in the worst case, after a lot
of ext2-fs warnings, you might crash your kernel, because not every
inconsistency was being checked against.
Even if it did not cache the data, the data on disk is not guaranteed to be
consistent, unless the other host did flush its buffers (by sync, flushb or
umount) and write everything back to disk. After doing this, the ro host
should tell your ro kernel to forget about his buffers by using flushb.
To conclude: Better only mount it rw at one box an not at all from the
other; then umount it and mount it on the other. This is safe, if you use
flushb before mounting. Or mount it ro twice.
Or: Use the network facilities to share the FS, like NFS or NBD.
Regards,
--
Kurt Garloff <[EMAIL PROTECTED]> [Eindhoven, NL]
Physics: Plasma simulations <[EMAIL PROTECTED]> [TU Eindhoven, NL]
Linux: SCSI, Security <[EMAIL PROTECTED]> [SuSE Nuernberg, FRG]
(See mail header or public servers for PGP2[RSA] and GPG[DSA] public keys.)
PGP signature