If it is a failed drive, then it is best to physically remove it from the system. ConclusionĪt this point, it is up to you to decide what to do with the drive removed from the array. mdadm uses superblocks to determine which member drive belongs to which array, which is why we need to clear it in order to permanently remove a member drive from an array. A single array with three drives is used here for this example, but multiple RAID arrays may exist on a single system. The number of drives will depend upon the array. You should see a message something like this if the RAID array successfully starts: mdadm: /dev/md/1 has been started with 3 drives. This automatically scans superblocks and assembles them into their proper arrays. To start an array with mdadm, we must use the options –assemble and –scan together. Restart the Array sudo mdadm -assemble -scanĬontrary to what might be expected, there is no –start option for mdadm. You cannot switch RAID levels using mdadm without losing data. Depending upon your goal, this might not be the fifth step to perform.Īlso note that if your goal is to change RAID levels, from RAID-0 to RAID-5, then you will need to stop, delete, and recreate a brand new array. These are only ideas to illustrate the process. Step 5 is dependent upon what you are trying to achieve, so it is not possible to list every possibility here. One mistake or typo, and you can lose data on the array. sudo mdadm -add /dev/md1 /dev/sdh <- /dev/sdh is the new drive to add First, add the new drive and then use the –grow option. If you are adding an extra member drive to an existing array, there is no need to recreate it. Usually, the most guaranteed option is to recreate the array with the new number of devices if your plan is to decrease the number of member drives. This part can be tricky because it tends to be array-specific. Suppose there are three drives remaining. If we had four drives to being with, then the array will still expect four drives. Now that one member drive has been removed from the array, we should change the number of drives that the array expects or else the removed drive will appear as a missing drive upon each system restart. (Optional) Change the Number of Devices for the RAID Array If there are multiple drives being removed from the array, then each drive must have its superblock cleared. Clearing the superblock using mdadm is the safest way to remove the RAID information form the removed member drive. This can cause problems and head-scratching. If this member drive is installed in a different computer or used as a normal drive in the same computer, if its superblock is not cleared using mdadm (or gparted with a full partition reset), any existing mdadm installation will try to automatically assemble the drive to its previous array. mdadm does not automatically clear the member drive’s superblock when it is removed from an array. This is the all-important step that is easily overlooked. Each array member drive will have its own superblock to store RAID information. Okay, so the member drive has been removed, but it will still insist that it is part of an array because the former RAID array configuration is still stored on the drive in its superblock. Zero the Superblock on the Removed Member Drive ![]() If you remove a drive from a RAID-5 array that only has three drives, then you will lose all of your data because RAID-5 requires at least three drive to operate. However, if you remove a drive from a RAID-0 array, then you will lose all of your data. In this example, there was an extra hard drive for redundancy (/dev/sde). ![]() Important Note: Only remove a drive from an array that supports removal without losing data. sudo mdadm -fail /dev/sde -remove /dev/sde ![]() We need to tell mdadm to “disconnect” or “remove” the drive as part of /dev/md1’s RAID configuration. Remove the Drive using mdadmĭo not physically remove the drive from the computer yet (if that is your plan). We must stop the array in order to remove a drive permanently, but before that, we must unmount the array if it is mounted and in use by the operating system. Suppose the RAID array is mounted at /media/myraid. ![]() For whatever reason - a failed drive, a new RAID configuration - we want to remove /dev/sde from the existing array /dev/md1. This result shows details about the /dev/md1 array. Let us assume the RAID array is named /dev/md1, and the drive we want to remove permanently is /dev/sde. This article tested these commands on Linux Mint 20 running a RAID array using the software RAID manager mdadm (free from the repository). sudo mdadm –fail /dev/sde –remove /dev/sde.The member drive was removed from the RAID array using mdadm, but the system still sees that drive as part of the array.
0 Comments
Leave a Reply. |