The Problem with Single Storage Paths
In enterprise virtualization and database environments, Ubuntu servers rarely rely on internal hard drives. Instead, they connect to massive external Storage Area Networks (SANs) via iSCSI or Fibre Channel protocols. This allows hundreds of terabytes of storage to be provisioned and shared instantly.
However, connecting a server to a SAN introduces a Single Point of Failure (SPOF). If the server is connected to the SAN via a single Fibre Channel switch, and that switch loses power, the server instantly loses access to its disks. The database crashes, and data corruption can occur.
To achieve high availability, enterprise architectures use redundant hardware: two Host Bus Adapters (HBAs) in the server, connected to two separate physical switches, which connect to two separate controllers on the SAN.
The problem is that the Linux kernel will see this as multiple independent paths to the exact same disk. If a 1TB LUN is presented over four paths, Linux will mount it as /dev/sdb, /dev/sdc, /dev/sdd, and /dev/sde. Writing to these block devices independently will destroy the filesystem.
The solution is Device Mapper Multipathing (multipathd). This daemon aggregates the multiple physical paths into a single, highly available virtual block device, providing instant failover and load balancing.
Step 1: Installing the Multipath Tools
On modern Ubuntu Server deployments, the multipath daemon is not always installed or enabled by default.
Update your apt repositories and install the tools:
sudo apt update
sudo apt install multipath-tools -y
Once installed, you must generate the initial configuration file and start the service.
sudo multipath -a
sudo systemctl enable multipathd
sudo systemctl start multipathd
Step 2: Identifying the Storage LUNs
Before configuring the multipath daemon, ensure your iSCSI or Fibre Channel connections are established. You can view all block devices currently seen by the kernel using:
lsblk
You should see multiple disks (e.g., sdb, sdc, sdd) with identical sizes. To confirm they are the exact same physical disk, you must compare their World Wide Identifiers (WWID).
sudo /lib/udev/scsi_id -g -u -d /dev/sdb
sudo /lib/udev/scsi_id -g -u -d /dev/sdc
If the WWID string (e.g., 3600508b4000156d700012000000b0000) is identical across the devices, they are paths to the same underlying SAN LUN.
Step 3: Configuring multipath.conf
By default, multipathd will attempt to automatically group devices with matching WWIDs. However, to ensure stable naming conventions and optimal load balancing algorithms, you should explicitly configure the /etc/multipath.conf file.
sudo nano /etc/multipath.conf
A standard enterprise configuration includes defining user-friendly aliases for the WWIDs, rather than relying on the 32-character hex strings.
defaults {
user_friendly_names yes
find_multipaths yes
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
no_path_retry queue
}
multipaths {
multipath {
wwid 3600508b4000156d700012000000b0000
alias db_storage_lun01
}
}
In this configuration, path_grouping_policy multibus instructs the kernel to load balance read/write operations actively across all available paths simultaneously, doubling or quadrupling the available bandwidth.
Step 4: Applying the Configuration
Save the file and restart the multipath daemon to apply the new aliases and pathing policies:
sudo systemctl restart multipathd
Now, run the multipath topology command to verify the aggregation:
sudo multipath -ll
The output will show your new virtual device (db_storage_lun01) sitting on top of the physical paths (sdb, sdc, etc.), with their current states listed as active ready.
Step 5: Formatting and Mounting the Virtual Device
From this point forward, you must never write data to the raw /dev/sdb block devices. All filesystem operations must be directed to the virtual device created by the device mapper.
The virtual device is mapped to the /dev/mapper/ directory.
To format the new high-availability LUN with the XFS filesystem:
sudo mkfs.xfs /dev/mapper/db_storage_lun01
You can then mount this device permanently by adding it to your /etc/fstab file exactly as you would a standard partition.
Conclusion
Device Mapper Multipathing is the critical software layer that translates redundant SAN hardware into actual high availability for the Linux kernel. By configuring multipathd, Ubuntu administrators ensure that fiber cuts, switch reboots, and HBA failures result in zero downtime and zero data corruption for their most mission-critical applications.