This guide covers building a software RAID1 mirror with LVM on Ubuntu using two 10TB drives. The combination of mdadm for mirroring and LVM for volume management provides redundancy against single drive failure while maintaining the flexibility to resize, snapshot, or extend storage without repartitioning.
Overview
The storage stack consists of mdadm software RAID1 at the base layer, with LVM physical volumes, volume groups, and logical volumes built on top of the RAID device. This arrangement allows the RAID layer to handle data redundancy while LVM manages space allocation and provides advanced features such as snapshots and online resizing.
The array is immediately usable but will perform an initial synchronization in the background. On 10TB drives this process can take several hours. Monitor sync progress:
cat/proc/mdstat
Save the array configuration to ensure it reassembles correctly after reboot:
Reboot the server (it may take longer to reboot than before if there is some automatic disk checking mechanism for new disks) and check md2 is still there with cat /proc/mdstat:
Verify LVM physical volumes, volume groups, and logical volumes:
sudopvssudovgssudolvs
Confirm the filesystem is mounted and available:
df-h/mnt/storage
Advantages of This Configuration
Online resizing is possible using lvextend and resize2fs without unmounting the filesystem. This is useful when adding additional storage to the volume group, such as a third mirrored pair of drives.
LVM snapshots provide a consistent point-in-time copy of data, useful for backups or before making risky changes to the filesystem.
The volume group can be divided into multiple logical volumes at any time without repartitioning. This allows separation of different use cases such as media storage, backup repositories, or virtual machine images into distinct volumes.
Monitoring and Maintenance
RAID1 redundancy only provides protection if drive failures are detected promptly. Configure email notifications for RAID events:
sudodpkg-reconfiguremdadm
Check array health regularly using either method:
cat/proc/mdstatsudomdadm--detail/dev/md0
The Ubuntu mdadm package installs a monthly mdcheck cron job by default to verify array consistency. Monitor the results of these automated checks, particularly after they run.
AI assistance is used on this site for language, formatting, and turning research into a consistent template. It is not used to perform the underlying research or verify technical claims. Every command, configuration, and step in this post is tested by hand before publication.
Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text.
Setting Up RAID1 with LVM on Ubuntu
This guide covers building a software RAID1 mirror with LVM on Ubuntu using two 10TB drives. The combination of mdadm for mirroring and LVM for volume management provides redundancy against single drive failure while maintaining the flexibility to resize, snapshot, or extend storage without repartitioning.
Overview
The storage stack consists of mdadm software RAID1 at the base layer, with LVM physical volumes, volume groups, and logical volumes built on top of the RAID device. This arrangement allows the RAID layer to handle data redundancy while LVM manages space allocation and provides advanced features such as snapshots and online resizing.
This process destroys all data on both drives. Verify device names with lsblk before executing any commands:
Output should show the disks intended for this purpose, not the device names:
Install the required packages:
Remove any existing partition tables or filesystem signatures from both drives:
BEFORE that happens, make sure the device names are consistent, the following commands will WIPE the drives.
Create the RAID1 Array
Build the RAID1 array using both drives:
The array is immediately usable but will perform an initial synchronization in the background. On 10TB drives this process can take several hours. Monitor sync progress:
Save the array configuration to ensure it reassembles correctly after reboot:
Reboot the server (it may take longer to reboot than before if there is some automatic disk checking mechanism for new disks) and check md2 is still there with cat /proc/mdstat:
The synchronisation will take a long time, just ignore it for now. The array is meantime usable.
Configure LVM
Initialize the RAID device as an LVM physical volume:
Create a volume group named vg_data on the physical volume:
Create a logical volume using all available space in the volume group. The volume group can be divided into multiple logical volumes if needed:
Format and Mount the Filesystem
Create an ext4 filesystem on the logical volume:
Create a mount point and mount the filesystem:
Add an entry to /etc/fstab to mount the filesystem automatically on boot:
Reboot and check it all came up.
Verify Configuration
Check RAID array status:
Verify LVM physical volumes, volume groups, and logical volumes:
Confirm the filesystem is mounted and available:
Advantages of This Configuration
Online resizing is possible using lvextend and resize2fs without unmounting the filesystem. This is useful when adding additional storage to the volume group, such as a third mirrored pair of drives.
LVM snapshots provide a consistent point-in-time copy of data, useful for backups or before making risky changes to the filesystem.
The volume group can be divided into multiple logical volumes at any time without repartitioning. This allows separation of different use cases such as media storage, backup repositories, or virtual machine images into distinct volumes.
Monitoring and Maintenance
RAID1 redundancy only provides protection if drive failures are detected promptly. Configure email notifications for RAID events:
Check array health regularly using either method:
The Ubuntu mdadm package installs a monthly mdcheck cron job by default to verify array consistency. Monitor the results of these automated checks, particularly after they run.
AI assistance is used on this site for language, formatting, and turning research into a consistent template. It is not used to perform the underlying research or verify technical claims. Every command, configuration, and step in this post is tested by hand before publication.