Archival Notice
This guide was written for legacy Sun Solaris 10 systems using UFS and Solaris Volume Manager (svm). Please note that modern enterprise Solaris 11+ releases and Linux distributions have completely transitioned to ZFS or Linux LVM/MDADM for software mirroring. Please refer to official vendor documentation for historical SVM specifications.
When managing legacy Sun Solaris SPARC or x86 servers in enterprise data centers, protecting your root operating system filesystems against physical hard drive failures is a critical operational requirement. If a primary OS drive experiences a head crash, the server halts immediately unless the root filesystem is mirrored.
Before the widespread adoption of ZFS, Solaris administrators relied on Solaris Volume Manager (SVM) to establish robust software RAID 1 mirroring across traditional UFS slices.
In this guide, I will walk you through the complete systems engineering workflow for configuring UFS software RAID mirroring on Solaris: creating state database replicas (metadb), defining submirrors (metainit), joining mirrors (metattach), and updating boot configurations.
Prerequisites
You will need a Sun Solaris server with root privileges, alongside two identical SCSI hard drives (c0t0d0 representing primary OS and c0t1d0 representing secondary mirror).
Step 1: Creating State Database Replicas (metadb)
Solaris Volume Manager requires state database replicas to track the state and integrity of mirrored metadevices. You must allocate dedicated disk slices (s7) across both drives to store these state databases.
# Create initial state database replicas across primary and secondary drives
metadb -a -f -c 3 c0t0d0s7 c0t1d0s7
# Verify state database allocations
metadb -i
Step 2: Initializing Root Submirrors (metainit)
To mirror the root filesystem (/), initialize two distinct submirrors: d10 representing the primary drive slice (c0t0d0s0) and d20 representing the secondary drive slice (c0t1d0s0).
# Initialize primary root submirror
metainit -f d10 1 1 c0t0d0s0
# Initialize secondary root submirror
metainit d20 1 1 c0t1d0s0
Step 3: Defining and Attaching the Master Mirror (metattach)
Create the master mirror metadevice d0 and attach the primary root submirror d10.
# Initialize master mirror d0 attached to primary submirror d10
metainit d0 -m d10
Updating System Boot Configurations (metaroot)
Before attaching the secondary mirror, update /etc/vfstab and the kernel boot configuration to instruct Solaris to boot directly from metadevice d0 instead of the raw disk slice:
# Update root mounting configuration
metaroot d0
# Verify updated vfstab configuration
grep -i d0 /etc/vfstab
Attaching the Secondary Submirror
Now attach the secondary submirror d20 to initiate background synchronization:
# Attach secondary submirror to master mirror d0
metattach d0 d20
Verify active background synchronization progress:
metastat d0
Step 4: Initializing Secondary Partitions (Swap and Var)
Repeat the mirroring workflow to protect secondary system partitions such as swap (s1) and /var (s3).
Mirroring Swap Partition (d1)
# Initialize swap submirrors
metainit -f d11 1 1 c0t0d0s1
metainit d21 1 1 c0t1d0s1
# Initialize master swap mirror d1
metainit d1 -m d11
metattach d1 d21
Mirroring /var Partition (d3)
# Initialize var submirrors
metainit -f d13 1 1 c0t0d0s3
metainit d23 1 1 c0t1d0s3
# Initialize master var mirror d3
metainit d3 -m d13
metattach d3 d23
Solaris Mirroring Active
Your Sun Solaris operating system is now fully mirrored and resilient against physical disk failures! If the primary hard drive crashes, the server will continue running seamlessly from the secondary submirrors.