« HOWTO: Remove RAID ArraysHOWTO: Stop Folding at Home Scaling My CPU »

HOWTO: Expand a RAID 5 by adding another disk

06/12/09

HOWTO: Expand a RAID 5 by adding another disk

You must resize the file system on the new raid system. I use reiserfs so this can be done on the fly while the system is still mounted. If you use ext3 then I believe this has to be done on an unmounted file system. So boot with a rescue disk first.

sudo resize_reiserfs /dev/md0

Now when you check the disk usage with the df command you will see the correct size of the RAID array. The size on my test system has changed from 8Gb to 12Gb, I added a 4Gb disk so this is expected. 4 x 4Gb disks.

 df / -h 
Filesystem            Size  Used Avail Use% Mounted on 
/dev/md0               12G  2.9G  9.2G  24% / 

Finally you will need to update mdadm.conf with the new drive adding it to the existing list. Too find out all the UUIDs on the system you can use

sudo blkid
/dev/sda2: UUID="ae45f189-51eb-47ef-bd09-2fb446c9faee" TYPE="swap"  
/dev/sda1: UUID="a0b4a885-6d24-48c8-b7fc-0000395781f9" TYPE="reiserfs"  
/dev/sdb1: UUID="89c286e1-79cc-bbfa-d62d-508b2fbf3d7b" TYPE="linux_raid_member"  
/dev/sde1: UUID="2796e969-4c73-414f-d62d-508b2fbf3d7b" TYPE="linux_raid_member"  
/dev/sdb1: UUID="6282e69d-0ee3-789c-d62d-508b2fbf3d7b" TYPE="linux_raid_member"  
/dev/sdc1: UUID="89c286e1-79cc-bbfa-d62d-508b2fbf3d7b" TYPE="linux_raid_member"

Edit /etc/mdadm/mdadm.conf and add the new drive to the ARRAY that of disk you have added the new drive to. Do not just copy my UUIDs they will not be the same as yours :DD

sudo nano /etc/mdadm/mdadm.conf
ARRAY /dev/md0 uuid="89c286e1-79cc-bbfa-d62d-508b2fbf3d7b" uuid="  ...

Now you need to rebuild the RAM disk image initrd.

sudo update-initramfs -c -k `uname -r`

Take a look at the man pages for mdadm.conf and update-initramfs.

Pages: 1 · 2 · 3 · 4

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
What can birds and aeroplanes both do?
antispam test