Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a hypothetical situation in which I installed my operating system using a RAID1 mirror. At some point I decided that this setup was overkill, my machine isn't system critical, I value doubling my storage space more than speedy recovery, I'm doing routine backups, etc...

Short of backing up my system volume and repartitioning, or otherwise starting over, is there a way I can reconfigure my RAID1 array to only expect one disk so that mdadm no longer reports a Degraded state?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

You can set the number of disks in a RAID-1 array to whatever you want (well, any positive integer), including 1. Simply remove all but the one component you want to keep with mdadm --remove, then set the number of components to 1:

mdadm /dev/md999 --grow --force -n 1

By the way, conversely, if you think you might want to make a mirror of a disk or partition, it is a good idea to set it up as a single-component RAID-1 array from the start. (You can do it later by shrinking the filesystem by 128kB and creating a superblock, but it's a lot easier to create the array first and then put a filesystem on it.)


It's possible to turn the single remaining component into a standalone volume: stop the array with mdadm --stop, then use mdadm --zero-superblock on the component volume. Since the md superblock is at the end of the component volume, whatever filesystem that was on the RAID-1 volume is also directly accessible on each component volume. If you do this, you'll even be able to enlarge the filesystem by 64kB to 128kB (depending on alignment). All in all, it's possible, but hardly worth the trouble. I recommend keeping the mirror with a single component — who knows, maybe you'll want to replicate it again one day (if nothing else, RAID-1 reconstruction is a very fast way of copying the contents of a disk to another disk, and it doesn't mind that the disk is mounted at the time).

share|improve this answer
1  
"if you think you might want to make a mirror of a disk or partition, it is a good idea to set it up as a single-component RAID-1 array from the start." This is actually one intention, to be able to optionally add a disk to be mirrored at a later time. Thanks much! –  andyortlieb Oct 27 '10 at 19:46
4  
I found this answer useful in a situation where I started with one RAID1 partition and later added another partition. This is how you create a single-component RAID1: mdadm --create /dev/md0 --level=1 --force --raid-devices=1 --metadata 1.2 /dev/sdd1 –  Antti Sykäri Mar 1 '11 at 6:45

If that were my machine, I'd just pull one of the disks and try to boot it up, it should work just fine. You've got backups so you could take this as a learning experience should something go awry. The next step would be disabling the RAID without clearing any data, which I've got zero experience doing with a Linux software RAID, so I'd be of no help there, but it should be possible AFAIK.

share|improve this answer
    
If it were mine, I would probably do the same to be honest. But as I said I need mdadm to not report a Degraded state as I'll be doing certain reporting on that. Thanks for your input though. –  andyortlieb Oct 27 '10 at 19:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.