|JP Vossen on 11 Apr 2013 15:40:49 -0700|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|[PLUG] Speaking of Linux RAID1|
I've been getting SMART errors for a couple of weeks so I RMA'd the drive with Western Digital (painless). They 2nd day aired me a replacement, though I have mixed feelings about it. The bad drive is a 1TB Green drive, the new one is a 2TB non-Green. Since it's a RAID1 I can't use the extra TB and in this case the non-Green part doesn't matter. But depending on use-case I may really prefer the Green drives, and if I RMA one I'd really prefer a same-for-same replacement. :-/
I have a script to do the dirty work but it's basically: mdadm --manage /dev/md0 --fail /dev/sda1 # /boot mdadm --manage /dev/md1 --fail /dev/sda2 # / mdadm --manage /dev/md0 --remove /dev/sda1 mdadm --manage /dev/md1 --remove /dev/sda2 ### HOT SWAP SATA drive while the system is still up and running! ### /sbin/sfdisk -d /dev/sdb | /sbin/sfdisk /dev/sda mdadm --manage /dev/md0 --add /dev/sda1 mdadm --manage /dev/md1 --add /dev/sda2 /sbin/grub-install /dev/sda /sbin/grub-install /dev/sdb # Just in caseDO NOT MESS THE ABOVE UP!!! If you get any part of it wrong you will nuke your data! That's why I have a good backup and a script to do it, because what "it" is changes depending on which drive is bad and what partitions it's using for what.
Also note the sfdisk trick of reading the partitions of the good disk and writing to the new one automatically. I forget where I stole that from, but it's awesome.
Other handy stuff: ## Keep an eye on re-sync progress cat /proc/mdstat --or-- watch -d cat /proc/mdstat ## Wait for (and time) the re-sync to finish time mdadm --wait /dev/md1If/when the other drive goes and I get a second 2TB replacement, I can swap it in as above, then resize everything using 'fdisk' and the LVM tools then 'resize2fs'. I've already done that once, as this server and OS install started out on 500G. Pretty cool.
None of the above discusses encryption, though that drive *is* encrypted. The encryption (LUKS) is at a different layer and Just Works. And it's nice that I don't have to care about wiping the RMA'd drive!
Also, these mirror drives will Just Work, no matter what. I don't have to care about motherboard RAID support, RAID controllers, or anything else. Even if I split them up (e.g. to clone the server) it all Just Works.
Later, JP ----------------------------|:::======|------------------------------- JP Vossen, CISSP |:::======| http://bashcookbook.com/ My Account, My Opinions |=========| http://www.jpsdomain.org/ ----------------------------|=========|------------------------------- "Microsoft Tax" = the additional hardware & yearly fees for the add-on software required to protect Windows from its own poorly designed and implemented self, while the overhead incidentally flattens Moore's Law. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug