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

Re: Mounting from multiple devices



On 9/14/20 11:03 AM, Gregor Haas wrote:
Hi all,

First off, thank you for developing NBD. I've really been enjoying using it
recently - accessing raw block devices over a network fits very well into
my various use cases.

However, I've found some conflicting documentation about the _safety_ of
accessing an exported block device from multiple clients. Notably, the
sourceforge page (https://nbd.sourceforge.io/) states that "if someone has
mounted NBD read/write, you must assure that no one else will have it
mounted". In contrast, the documentation in the current Linux tree (
https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/blockdev/nbd.rst)
does omits this sentence, implying that it is okay for multiple clients to
mount NBD read/write.

Let's say I have an ext4 filesystem on an NBD. Is it safe for me to mount
this filesystem on multiple clients?

No.  It is not safe to mount an ext4 image from parallel clients.  Ever.

There are some clustered filesystems that are designed to be network safe, and can tolerate having multiple clients (whether one writer and multiple readers, or even multiple writers), because the writers take care to coordinate with each other before overwriting the same portion of the shared storage (in fact, that shared access is _how_ clustered filesystems are able to hand off control between which machine in the cluster is currently serving storage). But most non-clustered filesystems (ext4 included) assume that they have exclusive control over the block storage, and you can cause massive corruption if that assumption doesn't hold because you mounted in parallel through a second user.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply to: