Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 5723  / 2 Years ago, fri, august 26, 2022, 9:34:45

I'm planing to buy an external raid array (hardware raid5). My intention is to outfit it with 4 disks initially and encrypt it using luks and dm-crypt. My question is: Will I be able to hot swap disks and grow the encrypted raid adding one or two more disks to a total of 6?



I see no reason why not, but better safe than sorry. So is dm-crypt stable against growing partition size?


More From » hardware

 Answers
0

Yep, you certainly can.


howto do it



First I needed to add the additional drives to the array as hot spares with the commands:



mdadm --add /dev/md2 /dev/sdc3

/dev/md2 being the raid, sdc3 the additional disk.



Then I told the array to grow [...] with:



"mdadm --grow -n 12 /dev/md2".


Now I waited around 16 hours for the array to restructure itself to the new layout. [...] Check cat /proc/mdstat to watch the progress.


Then I needed to tell the encrypted partition it was bigger. [...]



cryptsetup luksOpen /dev/md2 storage
cryptsetup resize storage

"storage" being the label of the encrypted device as in /dev/mapper/sotrage.



If this was a LVM partition, I'd have needed to do a pvresize instead of the above. Finally, I had to increase the size of the file-system. [...]



resize2fs /dev/mapper/storage


Do you lose any data on the array while doing this? Nope, it preserves all the data. I had run a "dd if=/dev/md2 of=/dev/zero" before doing the reshape on it, to make sure that there weren't any bad blocks on any of the drives before doing the reshape. Running this sort of verify can find marginal sectors that aren't normally used, and it's an important part of running a RAID array. Also, make sure that you don't have a failed drive before running the reshape.



Other useful bits:



You can't grow the file-system until the RAID resizing is completed.


Is it safe to do the RAID-5 resize while the device is in use? Yes, it should be. It's designed to keep track of where it is so you can even reboot while it's growing the array, and it will pick up where it left off.



Source: http://www.tummy.com/journals/entries/jafo_20080502_154339


[#44028] Saturday, August 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uccase

Total Points: 473
Total Questions: 100
Total Answers: 110

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
;