Shared block device file system (cluster file system without networking)

blockclusterfilesystemslocking

Is there any file system that can be mounted multiple times and supports concurrent file access for Linux? Basically I want something like a cluster file system but without the need to have a running network for a distributed lock manager. That can be very handy in connection with virtual machines that can share data with the host or another VM without the need to create a network link. This I want to avoid to keep the network architecture secure (virtual machine in DMZ) but share large files. No need to scale it up, just two machines that mount the same block device.

Shouldn't it be possible to have file locking information right on the disk?

Best Answer

I would guess that you can give N VMs and access to the same block device but only read only. You note that word guess.

Things will fall over quickly if any of the VMs start modifying things since any disk caching the other VMs will now be invalid.

The difficulty in having file locking information on disk is that no one has done that yet. Without deep thought, the idea of an atomic read/modify/write transaction on a disk is probably the base problem.

I guess that you could take a typical file system that is already multi-threaded, figure out where the lock(s) is/are used and change that to some sort of read/modify/write operation on the disk.

The other problem with read/modify/write on the disk is that if you do a lot of locking, your performance will be pretty bad since every change to anything on the disk requires:

  • lock the disk (seek, read/modify/write)
  • read the sector you want to change (seek/read)
  • make the change and write (write)
  • unlock the disk (seek, read/modify/write)

It probably doesn't help, but I would look at something like BSD Jails as a more lightweight VM system if you really don't want networking up.