So, LVM and RAID can create virtual storage devices that can span multiple physical HDDs. After creating logical volumes or a RAID device, the usual thing to do is format the device with a filesystem.

Why does mkfs.ext4 work when ext4 is not a clustered filesystem?

From what I know each partition on each HDD has a local filesystem of a certain type (ext2,ext3,ext4,ntfs,fat32...). If we combine partitions from multiple different HDDs shouldn't a clustered filesystem be required?

What happens if multiple processes try to modify the same file, when a clustered filesystem isn't used?

  • 3
    RAID divorces the clustering from the filesystem (and OS). With RAID, the management of the physical drive cluster is managed at the (preferably) hardware level, so the fact that your virtual block device actually consists of (say) ten sets of spinning platters is not seen by the OS.
    – DopeGhoti
    May 15 '17 at 16:43
  • @DopeGhoti hardware RAID is nice (or RAID on a SAN), but you also get RAID with fake RAID, md RAID, LVM RAID, RAID in ZFS or btrfs... May 15 '17 at 19:35
  • Hence the "preferably" parenthetical. Which is why fake RAID is called fake RAID, for example.
    – DopeGhoti
    May 15 '17 at 20:16

A clustered filesystem is one that can handle multiple computers largely independently accessing the same storage. So it has to deal with, for example, the underlying storage can change unexpectedly (because one of the other computers wrote to it).

Compare that to RAID1 (for example, because it's simple to understand): all that does is take the filesystem's request to "write data X to sector Y on device A" and instead write X to sector Y on devices B and C. Or the filesystem's request to "read sector Y on device A" to a read of sector Y on either B or C (which contain the exact same data). It's completely transparent the filesystem—RAID presents a block device that behaves exactly as block devices are expected to.

Basically, a block device is expected to (this isn't a formal definition):

  • allow read/write to sectors in arbitrary order
  • if you write data D to sector X, then any amount of time later read sector X, it should return D.

RAID devices do that (in fact, they do it better than actual disks). A shared disk, as you'd use for a clustered filesystem, does not: in particular, it violates the second bullet point, as another machine may have written data D₂ to that sector in the meantime.

LVM functions similar to RAID in this respect, as it's just remapping sector numbers, but in a way that preserves the block device behavior. It may, for example, send sectors 1-100 to device A and sectors 101-200 to device B, but that still preserves those behaviors (provided A and B behave, of course).


From what I know each partition on each HDD has a local filesystem of a certain type (ext2,ext3,ext4,ntfs,fat32...). If we combine partitions from multiple different HDDs

you can't combine partitions of type ext2,ext3,ext4,ntfs,fat32...

you can only combine partitions which have been formatted with type LVM PV, RAID ...

The result is a virtual block device, like the block device for a partition. You can format it with any block filesystem or none. (With LVM, the PVs are combined into a Volume Group, which you can then create a number of Logical Volumes on. The LVs are the virtual block devices).

Clustered filesystems provide a totally different service. They can allow a single storage device, to be mounted as a filesystem by multiple different computers at the same time. This is of less general applicability, e.g. to start with it's only interesting if you're going to have several computers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.