Howto: Add disk to Linux RAID

2
21
How to add disk to linux RAID setups
How to add disk to linux RAID setups

How to add disk to linux RAID on Sabayon 5

 

**This is a legacy article which does not meet some of our quality standards. While it may contain useful information, is retained here for legacy reasons only.**

(Of course the same basic commands apply across any linux system running mdadm).

Forgive the lack of formatting with this, but I figure I’ll post it before it gets lost and format it later 🙂

After the hardware is installed do the following:

fdisk /dev/yourdisk

press n for new partition

Accept defaults for largest size disk if that’s what you want to do (most likely)

Press ? To change the partition type to Raid Autodetect

press w to exit fdisk

Ensure your existing array is built and running

# mdadm –assemble /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

# mount /dev/md0 /mnt/data1

# mdadm /dev/yourexisting array –add /dev/yournewdisk

mdadm: added /dev/sdf1

# mdadm –detail /dev/md0

You should see a list similar to this showing your new drive currently added as a hot spare

Number Major Minor RaidDevice State

0 8 17 0 active sync /dev/sdb1

1 8 33 1 active sync /dev/sdc1

2 8 49 2 active sync /dev/sdd1

3 8 65 3 active sync /dev/sde1

4 8 81 – spare /dev/sdf1

Now you’re ready to roll….. 🙂

# mdadm –grow –raid-devices=5 /dev/md0

Donald Scripts # mdadm –grow –raid-devices=5 /dev/md0

mdadm: Need to backup 768K of critical section..

mdadm: … critical section passed.

Every 2.0s: cat /proc/mdstat Wed Sep 16 18:18:20 2009

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty]

md0 : active raid5 sdf1[4] sdb1[0] sde1[3] sdd1[2] sdc1[1]

2930279808 blocks super 0.91 level 5, 64k chunk, algorithm 2 [5/5] [UUUUU]

[>………………..] reshape = 0.1% (1176912/976759936) finish=816.4min speed=19915K/sec

unused devices: <none>

Check the filesystem e2fsck!

Donald Scripts # e2fsck -pv /dev/md0

/dev/md0: clean, 87382/183148544 files, 634355575/732569952 blocks (check in 5 mounts)

Donald Scripts # resize2fs -p /dev/md0

resize2fs 1.41.9 (22-Aug-2009)

Resizing the filesystem on /dev/md0 to 976759936 (4k) blocks.

Begin pass 1 (max = 7452)

Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The filesystem on /dev/md0 is now 976759936 blocks long.