I just got a new remote root-access server with 2 1TB disks in a Raid 1 configuration, running Debian (squeeze). Before installing my stuff on it, I'd like to switch to Raid 10 if I can. All the instructions I can find, for example Best way to grow Linux software RAID 1 to RAID 10, are for going from a 2-disk Raid 1 to a four disk Raid 10. Anyone have experience of making the move I have in mind, i.e. w/o any extra disks?
3 Answers
The easy/safe way (rather than trying to do it in place):
- Use
fsarchiverto take copies of the filesystem(s) that will be migrated between the old array and the new array- Have a second backup copy of the data regardless
- Unmount filesystems, stop and destroy the old array
- Create the new array; see this question about raid10, f2 for some details
- e.g.
mdadm --create /dev/md0 -n2 -l10 -pf2 /dev/sda1 /dev/sdb1
- e.g.
- Restore the filesystem(s) using
fsarchiver - Check mount points and if this was your root drive, re-install the bootloader
You could use btrfs which can convert between raid levels on a mounted filesystem. And supports different data and metadata raid levels, is a cow fs with all the benefits that brings (cow can be turned of for files/directories for which it's not well suited (vms, dbs...), protects against bit rot, supports deduplication, compression, .. but does have it's own set of problems - snapshots aren't recursive which isn't intuitive, raid1 only stores two copies of the data even if you have 5 drives, btrfs specific mount options can't be set separately for each subvolume, some people don't trust it due to critical flaws in it's raid5/6 that were discovered last year and still haven't been fixed.
Imo there is no reason to use raid5 (with today's drive sizes we are past the point where a second drive failing during a rebuild is extremely unlikely) or 6 (will have the same problem as raid5 in 2019-2020 and is extremely slow especially for writes (about as fast as a single drive) and the other levels are not flawed as far as we know. Compared to raid10 that is almost as fast as raid0, almost as safe as raid1 and unless you are using a lot of drives the space penalty is negligible (raid10 = n/2 usable capacity, raid6 = n-2 usable capacity... unless you have a lot of drives the difference is very small and if you do have a lot of drives then raid6 might not be good enough and you would need triple parity to be safe).
Parity based raid is dead.
- 111