Linux – How to convert a software RAID 1 partition to non-RAID partition

linuxpartitioningraidraid-1software-raid

RAID is not a backup, they say, but only now I can see that what I really need is an (external) backup.

So, I would like to convert a (software) RAID-1 partition to a non-RAID partition (ext4) in my Linux system (Debian 7), but I am clueless how to do it.

My goal is to remove one of the two internal drives of the current RAID 1 setup and use it as a external backup drive, so I can preserve the data on another physical place.

Is there any way to do this conversion to non-RAID without formatting the current RAID partition (/home) in the (future) single internal drive?

Thanks for any advice,
Marcio

Best Answer

This is what I would do to safely remove a RAID-1 managed by mdadm:

  1. Run fdisk -l. This will tell you how many and which arrays you have. In following steps, I'm assuming you only have /dev/md0.

  2. Run mdadm --detail /dev/md0. This will give you information about which physical disks are in use.

  3. Run umount -l /dev/md0, which will allow you to later stop your RAID. The -l flag will do the following, as per its man page:

    -l Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

  4. Run mdadm --stop /dev/md0. This will stop your RAID array.

  5. Erase the superblock on each device in the RAID (should be detailed in the command run in step 2).

    mdadm --zero-superblock /dev/sda
    mdadm --zero-superblock /dev/sdb
    ...
    

That should be it.

Related Question