Rebuilding MD RAID5 on Ubuntu 11 (Bullseye) with 3 Disks of 2TB, Adding a New 2TB Disk
In this article, we will discuss the process of rebuilding a MD RAID5 array on Ubuntu 11 (Bullseye) after adding a new 2TB disk to an existing array of 3 disks, each of which is also 2TB. We will cover the key concepts involved in this process, including creating and managing RAID arrays, adding new disks to an existing array, and recovering from a situation where the array has been unmounted manually.
Background
RAID (Redundant Array of Independent Disks) is a technology that allows multiple physical disks to be combined into a single logical unit. This can provide a number of benefits, including improved performance, increased data security, and greater storage capacity. There are several different RAID levels, each of which is suited to a particular set of use cases. RAID 5 is a popular choice for many users because it offers a balance between performance, data protection, and storage capacity.
In this article, we will be working with a RAID 5 array that is composed of three 2TB disks. We will be adding a fourth disk of the same size to the array, with the goal of increasing the storage capacity of the array while preserving the existing data and maintaining the redundancy provided by RAID 5.
Creating and managing RAID arrays
On Ubuntu 11 (Bullseye), RAID arrays can be managed using the mdadm tool. This tool can be used to create, manage, and monitor RAID arrays, as well as to add new disks to existing arrays. To create a new RAID array using mdadm, you would first use the mdadm --create command, which has the following syntax:
mdadm --create /dev/mdX --level=RAID_level device1 device2 ...
Where /dev/mdX is the name of the new RAID array, RAID_level is the RAID level you wish to use (in this case, RAID 5), and device1, device2, etc. are the devices (disks) that you want to include in the array. For example, if you wanted to create a new RAID 5 array using three 2TB disks, you would use the following command:
mdadm --create /dev/md0 --level=raid5 /dev/sda /dev/sdb /dev/sdc
Once the RAID array has been created, it can be monitored using the mdadm --detail command. This command shows the current status of the array, including information about the devices that are included, the state of the array, and any errors that may have occurred. To display the detail for the array we created in the previous example, you would use the following command:
mdadm --detail /dev/md0
Adding new disks to an existing RAID array
Adding a new disk to an existing RAID array is a relatively straightforward process. First, you need to ensure that the new disk is properly formatted and partitioned. This can be done using the fdisk or parted tools. Once the disk is ready, it can be added to the RAID array using the mdadm --add command, which has the following syntax:
mdadm --add /dev/mdX device
Where /dev/mdX is the name of the existing RAID array and device is the new disk that you want to add to the array. For example, if you wanted to add a new 2TB disk to the RAID 5 array we created earlier, you would use the following command
mdadm --add /dev/md0 /dev/sdd
Once the new disk has been added to the RAID array, it will begin syncing with the existing data. This process is known as "resyncing" and can take some time to complete, depending on the size of the array and the speed of the disks. You can monitor the progress of the resync using the mdadm --progress command.
Recovering from a lost array
In some cases, it may be necessary to recover a RAID array after it has been unmounted manually or due to a power failure. This process is known as "rebuilding" the array and can be done using the mdadm --re-add command. This command has the same syntax as the mdadm --add command, and is used in the same way. For example, if you needed to recover a RAID array after the array was unmounted manually, you would use the following command
mdadm --re-add /dev/md0 /dev/sda
Once the array has been rebuilt, it should be returned to its normal state. However, it is still important to check the array for errors and ensure that it is functioning properly. This can be done using the mdadm --detail and mdadm --verify commands.
In this article, we have discussed the process of rebuilding a MD RAID5 array on Ubuntu 11 (Bullseye) after adding a new 2TB disk to an existing array of 3 disks, each of which is also 2TB. We have covered the key concepts involved in this process, including creating and managing RAID arrays, adding new disks to an existing array, and recovering from a situation where the array has been unmounted manually.
- Types of references: Books, Articles, Online resources
- Books: "Linux RAID and LVM" by Tony Bautts, "Pro Ubuntu Server Administration" by Kyle Rankin and Ben Whaley
- Articles: "Understanding RAID levels" on Linux.com, "Managing RAID arrays on Ubuntu" on DigitalOcean
- Online resources: "MD RAID HOWTO" on tldp.org, "RAID - Linux RAID Wiki" on wiki.linux-raid.org