Chapter 33. Shared and Distributed Storage

A disk attached to one server is simple because only that server can reach it. The moment a second server needs the same data, the disk is no longer the hard part: ownership, locking, failure detection, and the network between the hosts become the design. Two nodes that both believe they may write the same blocks do not provide high availability; they provide a fast route to a corrupted filesystem. This chapter is about the mechanisms Debian provides for sharing storage without giving up that certainty.

The chapter follows four models. A shared block device exports a raw LUN over iSCSI and lets each host treat it as a local disk, with multipath covering path failure. A cluster filesystem such as GFS2 adds a distributed lock manager so several hosts can mount one filesystem safely. Ceph turns many servers and their disks into block, file, and object services with no single data server. Finally, a clustered file service built from DRBD, Pacemaker, and NFS shows how ownership moves as one ordered unit and how a client recovers. The first three are infrastructure; the last is the operational test that proves the infrastructure behaves when a node is lost.

The practice environment has three storage hosts, an independent client, and a witness:

Role Host Data network (eth1) Cluster network (eth2) Disposable devices Main services
Storage and target storage1 192.168.234.11/24 192.168.235.11/24 /dev/vdb, /dev/vdc, /dev/vdd iSCSI target, Ceph monitor/manager/OSD/MDS/RGW
Storage and initiator storage2 192.168.234.12/24 192.168.235.12/24 /dev/vdb, /dev/vdc iSCSI initiator, GFS2/DRBD node, Ceph monitor/OSD
Storage and initiator storage3 192.168.234.13/24 192.168.235.13/24 /dev/vdb, /dev/vdc iSCSI initiator, GFS2/DRBD node, Ceph monitor/OSD
Independent client client1 192.168.234.14/24 - - RBD, CephFS, S3, and NFS client
Quorum witness witness1 192.168.234.15/24 - - Corosync QDevice for a two-node variant

Every guest also has a management address on a separate libvirt network that no exercise touches, so a mistake in the practice networks does not remove the SSH session used to repair it. The two practice networks are isolated; they carry no route to the host or the Internet. All five guests run on one hypervisor, so the lab demonstrates the storage software and the ownership protocols, not physical rack or power redundancy.

Chapter 33 practice topology

Figure 33.1. The five practice hosts. iSCSI portals, the Ceph public network, and the NFS service address use eth1; Corosync, DRBD, and Ceph replication use eth2. The witness holds no data.

Commands entered in john's ordinary shell begin with $; commands entered in a root shell begin with #. The prompt marker is not typed. The practice account has passwordless sudo so the examples stay short, and the commands are unchanged on a system where sudo asks for a password. If you enter a root shell with sudo -i, leave it with exit, and remember that root's ~ is not /home/john.

Create the practice workspace on each host that needs files:

$ mkdir -p ~/debian-handbook/shared-storage

The command normally prints nothing. The client uses this directory for the RBD export, the S3 object, and the NFS backup. Service paths such as /etc/ceph, /etc/iscsi, /srv/shared, and /var/lib/ceph remain where the packages require them; the workspace is only for practice data and downloads.

In this section