Skip to content

Use Linux RAID and LVM together to make it so you can add disks to your RAID array

License

Notifications You must be signed in to change notification settings

stevecoug/expandable-raid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expandable-raid

Use Linux RAID and LVM together to add disks to your RAID array without stopping it, similar to how a Drobo works. I have no idea how Drobo actually accomplishes this, but this script will accomplish some of the same magic.

Usage

expandable-raid.pl --create [--level RAIDLEVEL] [--chunk CHUNKKB] [--layout LAYOUT] --vg VOLGROUP --partitions PART1,PART2,PART3 [--dryrun]
expandable-raid.pl --extend --vg VOLGROUP --raid RAIDDEV --partition PART1 [--dryrun]
expandable-raid.pl --remove --vg VOLGROUP --raid RAIDDEV [--dryrun]
expandable-raid.pl --version
expandable-raid.pl --help

Setting EXPRAID_DEBUG forces  "--dryrun mode". 

Filesystem hints

You can achieve better performance from your filesystem if it is properly aligned to your RAID devices. See the following page for more information: http://erikugel.wordpress.com/2011/04/14/the-quest-for-the-fastest-linux-filesystem/

This page has a calculator for the ext4 filesystem's tuning parameters: http://uclibc.org/~aldot/mkfs_stride.html

How it works

Have you ever wanted to have a Drobo-like ability to add a disk to your RAID array and have the storage just expand to fill it? I’ve been toying around with a way to do just that.

The theory is that you create stripes across your disks of RAID arrays, and then combine them into an LVM volume group. In order to expand onto another disk, you do the following:

  1. Create partitions on the new disk the same size as the partitions in your existing RAID device stripes
  2. Add those partitions to the volume group, if you need free space during the expansion

Once you've done that, use expandable-raid.php to extend your RAID arrays. You will need to run it once for each RAID device in your volume group. It will:

  1. Remove the new partition from the volume group, if applicable
  2. Use pvmove to move all logical volumes off of the existing RAID device
  3. Use vgreduce to remove the RAID device from the volume group
  4. Use pvremove to make it no longer an LVM pv
  5. Stop the RAID device with mdadm, and zero the superblocks
  6. Recreate the RAID device with mdadm, including the new partition
  7. Make the new RAID device an LVM pv with pvcreate
  8. Add the new pv to the volume group using vgextend

Roadmap

In the future, this utility may handle the partition management as well, but that is a little more tricky. I'll probably also rewrite it in Perl or Python, since those are more likely to be already installed on a server.

License and copyright

Copyright (c) 2013 Steve Meyers.

Perl translation (c) 2013 Steve Meyers, David Oswald.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

About

Use Linux RAID and LVM together to make it so you can add disks to your RAID array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published