Deleting software RAID device with swap partition during Ubuntu installation.
If you want to use HDD’s on which a raid array was created in a previous server setup we recommend to reset the HDD’s removing all existing partitions and raid arrays before starting a fresh installation using the Ubuntu installer (or any other Linux OS installer). Instructions on how to perform a full reset can be found in this post.
If however you forgot to reset your HDD’s the Ubuntu installer might not be able to remove an existing software raid device which is used as swap partition.
If you try to delete the RAID array with the intaller “delete MD device”, you might get the following the error message:
“Failed to delete the software raid device. There was an error deleting the software RAID device. It may be in use.”
In our case the kernel created a raid array “/dev/md127” which was used as swap partition (remains from a previous installation). The Ubuntu installer does not provide any option to switch off swap therefore this procedure needs to be done manually in a separate console.
So let’s hit “CTRL-ALT-F2” on the keyboard to open a console.
Next switch off swap on the “md127” device with the following command :
# swapoff /dev/md127
Athough we could stop and delete the MD device in the console we don’t want to confuse the Ubuntu installer hence we are returning to the installer by hitting “CTRL-ALT-F1” on the keyboard to resume the installation process and delete the array there.