I'm trying to figure out how to add RAID 1 to my CentOS NAS server. Today I have 2x3TB disks in a non-RAID configuration. I'm using LVM to manage a few logical volumes to partition my data. I'm not using close to the full 6TB capacity, but I want the room to expand in the future. I'm also backing up regularly off-site with CrashPlan, but I want to ensure that a disk failure won't mean days of downtime to restore data.
So my plan is to buy 2 more 3TB disks to setup RAID 1. I want to make it so the new disks and paired with old ones, since the old ones are now a couple years old and more likely to fail.
Today I'm using roughly 1.6 TB of the 6TB capacity, so I think I can do some moving around and minimize the risk of losing the data. Can anyone point me to a guide or help make sure these steps will work? I know that there is some risk that something will go wrong so I'll have backups available, but I want to make sure these steps should work with low risk to save myself some time.
- First I'll consolidate the 6TB LVM VG to one PV. So if /dev/sdb1 and /dev/sdc1 are my old drives, I'll shrink some of my LV's (resize2fs, lvresize), move everything onto sdb1 (pvmove), and remove sdc1 from the VG (vgreduce).
- Next I'll add a new drive and create a RAID 1 in the BIOS settings for sdc1 and the new drive (call it sdd1). Let's call this rda1 (I don't know what naming is used but just to be clear in my steps).
- Add rda1 to my VG (vgextend)
- Move all LV's to rda1 (pvmove)
- Remove sdb1 from the VG (vgreduce)
- Add the other new drive and create a RAID 1 in BIOS for sdb1 and new drive 2 (sde1). Let's call this rdb1.
- Add rdb1 to my VG (vgextend)
Finally, I'd really like to redistribute the data across both RAID's so that it's not all just sitting on the one. Does it make sense for me to just manually move some of the LV's to the other RAID disk? Can I just add striping somehow and let the data be evenly distributed, or would I have to re-create the LV's to do that?
Here is a quick overview of my current setup (I also have an SSD with the OS install and LVM, but I'm just showing the data drives):
$ sudo pvdisplay --- Physical volume --- PV Name /dev/sdb1 VG Name vg_media PV Size 2.73 TiB / not usable 19.00 MiB Allocatable yes PE Size 32.00 MiB Total PE 89424 Free PE 19792 Allocated PE 69632 PV UUID D0Z3Fn-40Yr-akkx-TsLH-n5iM-LQNc-vdLbMf --- Physical volume --- PV Name /dev/sdc1 VG Name vg_media PV Size 2.73 TiB / not usable 19.00 MiB Allocatable yes PE Size 32.00 MiB Total PE 89424 Free PE 40272 Allocated PE 49152 PV UUID 4A1tD5-Rj2I-IdZX-2FPS-4KmS-WnjT-TcAGPf $ sudo vgdisplay --- Volume group --- VG Name vg_media System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 4 Open LV 4 Max PV 0 Cur PV 2 Act PV 2 VG Size 5.46 TiB PE Size 32.00 MiB Total PE 178848 Alloc PE / Size 118784 / 3.62 TiB Free PE / Size 60064 / 1.83 TiB VG UUID wneSMl-nllf-9yaO-GGv2-iDGv-n4vK-mVfGjk $ sudo lvdisplay --- Logical volume --- LV Path /dev/vg_media/library LV Name library VG Name vg_media LV UUID AOs1yk-sVQE-f6sI-PstX-txtm-mu2d-mgJj4W LV Write Access read/write LV Creation host, time srv.mattval.us.to, 2013-05-13 02:37:31 -0700 LV Status available # open 1 LV Size 1.00 TiB Current LE 32768 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 --- Logical volume --- LV Path /dev/vg_media/photos LV Name photos VG Name vg_media LV UUID 2DWA1Q-MYTH-1bqq-QgW3-7LiJ-3jNe-v9WXlK LV Write Access read/write LV Creation host, time srv.mattval.us.to, 2013-05-13 02:37:48 -0700 LV Status available # open 1 LV Size 1.00 TiB Current LE 32768 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:3 --- Logical volume --- LV Path /dev/vg_media/projects LV Name projects VG Name vg_media LV UUID 027kQC-dSSJ-Bo40-Xmpa-8ELo-hbGD-jZITBJ LV Write Access read/write LV Creation host, time srv.mattval.us.to, 2013-05-13 02:38:01 -0700 LV Status available # open 1 LV Size 1.50 TiB Current LE 49152 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:4 --- Logical volume --- LV Path /dev/vg_media/docs LV Name docs VG Name vg_media LV UUID El10u0-yYeW-XekC-TP7t-xF9t-qLgz-aFU8AQ LV Write Access read/write LV Creation host, time srv.mattval.us.to, 2013-05-13 02:38:15 -0700 LV Status available # open 1 LV Size 128.00 GiB Current LE 4096 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:5
Actual used sizes are docs=100GB, library=500GB, photos=350GB, projects=620GB