Mar 232014
Remember: everything you do, happens on your own risk. Steps below CAN CAUSE DATA LOSS. Do not run in production without understanding what you are doing and testing it in development environment beforehand.
And don’t blame me if it doesn’t work for you.
Before: 5 disks in RAID5 with LUKS -encryption and LVM
After: 7 disks in RAID6 with LUKS -encryption and LVM
RAID details: # mdadm –detail /dev/md0
- Add spare drive to RAID5-array:
# mdadm --add /dev/md0 /dev/sdf
- Convert RAID5 to RAID6:
# mdadm --grow /dev/md0 --level=6 --raid-devices=6 --backup-file=/root/raidbackup
- WAIT for the array to rebuild itself (will take a while):
# cat /prod/mdstat
- After rebuild, add another drive to RAID6-array:
# mdadm --add /dev/md0 /dev/sdg
- Take the drive into use (adding makes it a spare):
# mdadm --grow /dev/md0 --level=6 --raid-devices=7 --backup-file=/root/raidbackup
- WAIT for the array to rebuild itself (will take a while):
# cat /proc/mdstat
- Grow the RAID6-array to the maximum size:
# mdadm --grow /dev/md0 --size=max
- Open encrypted disk (if not already open):
# cryptsetup luksOpen /dev/md0 crypt
- Resize encrypted disk:
# cryptsetup resize /dev/mapper/crypt
- Resize LVM physical volume:
# pvresize /dev/mapper/crypt
And now you have more space what you can manage with LVM.
Note: If i remember correctly, 7. can be combined with 5.:
-
# mdadm --grow /dev/md0 --level=6 --raid-devices=7 --size=max --backup-file=/root/raidbackup
– and resizing could be done while the array is rebuilding, but just to be sure we are on the safe side…