Your cart is currently empty!

How to Remove a Ghost Software RAID Array After Disconnecting a Drive Enclosure in Linux
Experimenting with hardware is at the core of what makes being a tech enthusiast fun. I was offered a challenge of seeing if I could get this 5-drive enclosure would work so that it could be used as a backup solution for a real, practical purpose. For me, this sounded exciting as the plant engineer I am working with was only getting the “blue screen of death” on the Windows systems that he plugged into it. My openSUSE Tumbleweed Framework Laptop 13 had no problem with it the five drives showed up as individual devices that I could utilize. I wanted to see if I could do a software RAID on this, not fully sure if it would be able to use the RAID on another machine seamlessly or not. In short, no, that doesn’t work, at least, it didn’t work for me but I was left with a new problem. I now had this ghost entry of a device /dev/md0 of a RAID array even though I disconnected the devices. I tried removing unsuccessfully and I also couldn’t find an answer searching the web so using my favorite LLM, I was able to get this solved and thought I would share how I did it, just in case there is another knucklehead like me that gets stuck on this.

Software RAID configurations are created with a utility called Multiple Devices Admin, or for short, mdadm. This utility is used to manage and monitor software RAID (Redundant Array of Independent Disks) arrays. The “md” in mdadm refers to the “multiple devices” that make up a RAID array, which are typically represented as /dev/mdX devices. In my case, I had /dev/md0 as it was the first RAID I configured on this machine. One of the cool openSUSE YaST modules is the Partitioner tool. Within this tool, I was able to select the devices and create the RAID, taking any of the mystery out of building a software RAID and making it as easy as pointing and clicking through. After testing out the device to ensure that it would work, which it does, I disconnected from it and proceeded to undo what I had done, but the md0 device was just irritatingly lingering, even after reboots.

After testing out the device to ensure that it would work, which it does, I disconnected from it and proceeded to undo what I had done but the md0 device was just irritatingly lingering, even after reboots. I even tried to delete /dev/md0 but with no success as it would reappear after reboot. The Software RAID configuration decided to linger. I couldn’t not remove this “ghost RAID”.

I appreciate the ease in creating software RAID from the YaST tools. Unfortunately, the removal of the RAID wasn’t a solution I was able to find easily. Thanks to Grok, my go-to LLM, for providing the initial guidance on removing the ghost RAID array by editing /etc/mdadm.conf.
The Solution to Remove the Ghost RAID Array
Cautionary Note: Before proceeding, ensure that the RAID array is truly not in use and any data that may have been stored on it has bee properly backed up.
Optional: Check the Array Status to confirm the RAID array is still active
cat /proc/mdstat
If you see md0 listed, it’s active. You can stop it with:
sudo mdadm --stop /dev/md0
In my case, the array wasn’t active since the drives were disconnected so this step was not necessary.
The solution is very simple, Grok suggested editing the /etc/mdadm.conf file which tells mdadm which RAID arrays to assemble at boot. Here is what I did:
Using my favorite terminal text editor, micro, I opened /etc/mdadm.conf file:
sudo micro /etc/mdadm.conf
Replace “micro” with “nano” or “vim” if you choose.
Then I located the Array definition, in my case it was teh second line containing: ARRAY /dev/md0...

I removed that line then saved the file and exited the editor.
Once completed, reboot your machine and the ghost RAID definition will no longer be present.
Verification
After rebooting the machine, I opened up KDE Partition manager and verified that there was not an entry for /dev/md0.

What is now remaining is my main storage and a drive plugged into my USB port.
Note: Optionally, on some systems, you may need to update the initramfs after editing /etc/mdadm.conf to ensure the changes persist. Run:
sudo update-initramfs -u
This wasn’t necessary for me on openSUSE Tumbleweed but it is is worth trying to see if the array appears after reboot.
Why This Worked
The /etc/mdadm.conf file tells mdadm the drives to assemble for any RAID arrays when the system boots. Even though I had disconnected the drives, the configuration still instructed mdadm to look for /dev/md0, making it appear as a ghost array. Removing the line stopped this behavior.
Final Thoughts
I appreciate the ease in creating software RAID from the YaST tools. Unfortunately, the removal of the RAID wasn’t a solution I was able to find easily. Thanks to Grok, an AI assistant by xAI, for providing the initial guidance on removing the ghost RAID array by editing /etc/mdadm.conf. For a bit, I was incredibly frustrated but this smoothed out my troubles by providing me a whole list of things to try. I have been very skeptical of using such things but lately, these have been incredibly valuable in shortening the time it takes to filter through the vast array of knowledge that is the Internet.

I’m not sure what is going to become of this piece of hardware yet. I do believe that it will need to have a dedicated system driving this in order to effectively utilize the storage devices. I don’t think that there is a way to effectively move this array between computers with any real reliability… but I could be wrong on that.
What this whole exercise has done for me is to give me even more confidence in experimenting with my systems which enhances my confidence in doing and learning. I do believe that this was a great use of my time. Technology continues to get even more fun!
References
Software RAID HOWTO from The Linux Documentation Project – A comprehensive guide to setting up and managing RAID arrays.
Grok, AI assistant by xAI
Top 11 Reasons YaST makes openSUSE Awesome
Discover more from CubicleNate.com
Subscribe to get the latest posts sent to your email.
Leave a Reply