[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] local mounted readonly and exported read write



On Tue, Apr 10, 2012 at 11:18:05AM -0300, Salatiel Filho wrote:
> Hi guys , i have a doubt.
> If i have a device , let's say /dev/sdb2 which is mounted locally read
> only, and this same device is exported using nbd , and mounted
> readwrite by the client. If the client writes to the Filesystem , this
> can lead to data corruption ?

Yes, as in, "reads from /dev/sdb2 on the server will probably only get
you garbage after a while". This is because there's nothing in nbd
telling the filesystem layer that things have changed in the block
device it's working with, and that the data it's cached is no longer
valid.

There are filesystems who are written to support such a mode of
operation (e.g., GFS2), but don't try this with "normal" filesystems
like ext4.

Also, note that "mount -o ro" will still try to write to the filesystem
if the journal is dirty. Arguably this is a bug in the kernel.

> Or the local filesystem will just be unable to see the changes until
> it is remounted ?

No, it doesn't work that way.

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a



Reply to: