LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-08-2014, 02:44 AM   #1
nonoitall
Member
 
Registered: Feb 2005
Posts: 75

Rep: Reputation: 16
Growing and converting an encrypted RAID array


I have a small RAID 5 array on a file server I use at home that consists of three partitions across three drives. So presently, /dev/sdb1, /dev/sdc1 and /dev/sdd1 make up a RAID 5 array and give me /dev/md0. In turn, that RAID device is LUKS encrypted, giving me /dev/mapper/library. That device is formatted with btrfs and mounted on /mnt/library.

I got four more drives in order to increase the array's storage and convert to RAID 6. I've read up on the relevant information, but I just want to make sure I have all my ducks in a row before I get started, so I'd appreciate it if you guys could look over my procedure and make sure I got everything right.

My understanding is that the entire procedure can be carried out online, without needing to unmount or unmap any of the devices in question, correct?

1. Physically install drives
(Can't do much else until this is done. :-P)

2. Partition drives
(No problems foreseen here.)

3. Add partitions to existing RAID array as spares
Okay, here's where we get into stuff I don't do so often. But pretty sure I just do like so:
Code:
mdadm --add /dev/md0 /dev/sd[e-h]1
Assuming those are the devices that correspond to the new drives/partitions, of course. Do I need to add the spares one at a time, or can I do all four in the same command as shown above?

4. Grow the RAID device to use the newly added partitions, whilst converting it to RAID 6
My understanding is that I can do both of these actions in the same step with the following command:
Code:
mdadm --grow /dev/md0 --level=6 -n 7 --backup-file=/path/to/my/backup/file
Of course, the backup file should not reside on the RAID device being modified. This command returns immediately but the actual layout change will take quite some time and can be monitored via cat /proc/mdstat. One question: During the conversion, is the data on the array still as resilient as it was while it was RAID 5? (IE, as long as no more than 1 of the drives fails, the data remains in tact?)

5. Enlarge the encrypted volume
Code:
cryptsetup resize library
AFAIK, this command just pokes the crypt subsystem and asks it to recheck its underlying device's sizes, so it should basically just update the size of /dev/mapper/library to match that of /dev/md0.

6. Enlarge the btrfs file system
Code:
btrfs filesystem resize max /mnt/library

Does it look like I covered everything correctly?

Last edited by nonoitall; 08-08-2014 at 02:45 AM.
 
Old 08-08-2014, 07:12 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,469

Rep: Reputation: Disabled
Quote:
Originally Posted by nonoitall View Post
My understanding is that the entire procedure can be carried out online, without needing to unmount or unmap any of the devices in question, correct?
That matches what I've read about expanding an md device with --grow, but I've never tried changing the RAID level. This guy has, though, and it seems to work just the way you've outlined in your post.
Quote:
Originally Posted by nonoitall View Post
3. Add partitions to existing RAID array as spares
Okay, here's where we get into stuff I don't do so often. But pretty sure I just do like so:
Code:
mdadm --add /dev/md0 /dev/sd[e-h]1
Assuming those are the devices that correspond to the new drives/partitions, of course. Do I need to add the spares one at a time, or can I do all four in the same command as shown above?
The shell will expand "/dev/sd[e-h]1" to "/dev/sde1 /dev/sdf1 /dev/sdg1 /dev/sdh1" before mdadm ever sees it, and yes, mdadm supports adding multiple devices in one operation.
Quote:
Originally Posted by nonoitall View Post
4. Grow the RAID device to use the newly added partitions, whilst converting it to RAID 6
My understanding is that I can do both of these actions in the same step with the following command:
Code:
mdadm --grow /dev/md0 --level=6 -n 7 --backup-file=/path/to/my/backup/file
Of course, the backup file should not reside on the RAID device being modified. This command returns immediately but the actual layout change will take quite some time and can be monitored via cat /proc/mdstat.
The --grow option is always used whenever an array is expanded to use one or more drives that were previously defined as spares, and of course you do need at least one spare to do a RAID5-to-RAID6 conversion.
Quote:
Originally Posted by nonoitall View Post
One question: During the conversion, is the data on the array still as resilient as it was while it was RAID 5? (IE, as long as no more than 1 of the drives fails, the data remains in tact?)
Well, at no point will any stripe be distributed in a non-redundant fashion, so yes, the array should be as resilient as any RAID5 array up to the point where the conversion to RAID6 is complete. However, I have no actual experience with drive failures under such conditions, so I don't really know how the md subsystem handles a drive failure during an array expansion.
Quote:
Originally Posted by nonoitall View Post
Does it look like I covered everything correctly?
Yes, it most certainly does.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing XFS stripe size & width when growing an mdadm raid 5 array? Automatic Linux - Software 2 11-21-2013 05:06 PM
Growing a raid 5 array Richie55 Linux - Server 3 07-28-2010 08:32 AM
growing a RAID array toward the lower block numbers garydale Linux - Server 3 08-25-2009 08:51 PM
please help converting a running system to mirrored raid array farkus888 Linux - Server 1 02-01-2008 06:18 PM
Automatic recoginiton of new hard drives and growing in new space in raid array lewt Linux - Hardware 0 06-01-2006 12:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration