Remove a drive from unraid
Since I’ve had to do this at least once before, I thought I would borrow the info from the unraid wiki and put it here for my easy reference. For some reason, unraid doesn’t provide this functionality built in. Because “nobody needs to remove drives” and “why would you want to do that” and blah blah blah. Well, I believe my system has gotten out of control with 14 drives and I want to slim it down. Replace old drives with bigger drives and end up with less drives.
My version:
- Stop the array (wait till it finishes, unraid keeps a lot of data in RAM), Settings / Global Share Settings / Remove disk from “Included Disks”
- Record the disk number/names/SNs
- Settings / Disk Settings / change “Tunable (md_write_method) to “reconstruct write”
- Install the unbalance app and use it to move data from the disk.
- Write data to your array, kick off the mover, if you are using cache drives. Make sure nothing is still using the disk.
- SSH in and create folder on the drive: clear-me
- Settings / User Utilities / User Scripts – Run in backgroud. You can click on the log icon to verify it was happy with your folder and will start the clearing process. Feel free to randomly check the logs, but it does take a long time.
- Once complete, stop the array
- Go to Tools then New Config, click on the Retain current configuration box (says None at first), click on the box for All, check the box “I want to do this” and then click Apply
- Go back to main, verify drives are correct, remove the one you just zeroed
- Start the array, check the box that the parity is already valid.
- Just to be safe, kick off a parity check.
Borrowed from here: Shrink Array | Unraid Docs
Procedure
- Make sure that the drive you are removing has been removed from any inclusions or exclusions for all shares, including in the global share settings.
- Make sure the array is started, with the drive assigned and mounted.
- Make sure you have a copy of your array assignments, especially the parity drive. You may need this list if the “Retain current configuration” option doesn’t work correctly.
- It is highly recommended to turn on reconstruct write, as the write method (sometimes called ‘Turbo write’). With it on, the script can run 2 to 3 times as fast, saving hours! In Settings -> Disk Settings, change Tunable (md_write_method) to reconstruct write.
- Make sure ALL data has been copied off the drive; drive MUST be completely empty for the clearing script to work.
- Double check that there are no files or folders left on the drive. Note: one quick way to clean a drive is reformat it! (once you’re sure nothing of importance is left of course!)
- Create a single folder on the drive with the name clear-me – exactly 7 lowercase letters and one hyphen
- Run the clear an array drive script from the User Scripts plugin (or run it standalone, at a command prompt).
- If you prepared the drive correctly, it will completely and safely zero out the drive. If you didn’t prepare the drive correctly, the script will refuse to run, in order to avoid any chance of data loss.
- If the script refuses to run, indicating it did not find a marked and empty drive, then very likely there are still files on your drive. Check for hidden files. ALL files must be removed!
- Clearing takes a loooong time! Progress info will be displayed, in 6.2 or later. Prior to 6.2, nothing will show until it finishes.
- If running in User Scripts, the browser tab will hang for the entire clearing process.
- While the script is running, the Main screen may show invalid numbers for the drive, ignore them. Important! Do not try to access the drive, at all!
- When the clearing is complete, click done and stop the array – do not remove the cleared disk yet.
- Go to Tools then New Config
- Click on the Retain current configuration box (says None at first), click on the box for All, then click on close
- Click on the box for Yes I want to do this, then click Apply then Done
- Return to the Main page, and check all assignments. If any are missing, correct them. Unassign the drive(s) you are removing. Double check all of the assignments, especially the parity drive(s)! If the cleared drive is “hot-swappable” you may now remove the cleared drive and follow the steps below. If it is not, follow the steps below.
- Click the check box for Parity is already valid, make sure it is checked!
- Start the array! Click the Start button then the Proceed button (on the warning popup that will pop up)
- Parity should still be valid, however it’s highly recommended to do a Parity Check
- If you do not have hot swappable drives, you may now safely shutdown your server and remove the cleared drive.