Mbm329 06:13, March 12, 2012 (UTC)

SATA Controller config:

(silk-screen facing you) 4 2 1 3

To Fail a bad disk out of the array:

mdadm /dev/md0 -f /dev/hdg1 -r /dev/hdg1
shutdown, replace disk, boot back up
fdisk /dev/hdg (to create hdg1 w/ same partition size as other drives)
mdadm /dev/md0 -a /dev/hdg1

Doing the initial test:

Create partitions on three initial disks:

fdisk /dev/hde
fdisk /dev/hdg
fdisk /dev/hdi

Create md RAID device:

mdadm -C /dev/md0 -a y -l 5 -n 3 /dev/hd[egi]1

Edit mdadm.conf file and modify the following for future reboots:

DEVICE /dev/hd[egi]1
ARRAY /dev/md0 devices=/dev/hde1,/dev/hdg1,/dev/hdk1

Create new Physical Volume for LVM from md RAID device:

pvcreate /dev/md0

Create new Volume Group for LVM from newly created PV:

vgcreate vgarray /dev/md0

Create new Logical Volume for LVM from newly created VG:

lvcreate -L 300000 -n shared vgarray

Create Filesystem on LV:

mke2fs -j /dev/vgarray/shared

Mount Filesystem on Mountpoint:

mount /dev/vgarray/shared /shared2

Copy files to it from another partition:

cp -a /shared/* /shared/.

Reboot Machine:


Create partition on new disk:

fdisk /dev/hdk

Add new paritition to the md RAID device:

mdadm --add /dev/md0 /dev/hdk1

Use mdadm to grow the md RAID device with the newly added partition:

mdadm --grow /dev/md0  -n 4

Edit /etc/mdadm.conf to add new device to list:

DEVICE /dev/hd[egik]1
ARRAY /dev/md0 devices=/dev/hde1,/dev/hdg1,/dev/hdi1,/dev/hdk1

Check to see how much space is available to md RAID device layer:

dd if=/dev/md0 of=/dev/null bs=1024k

Check to see how much space is available to LVM layer:

pvs -v /dev/md0

Resize the PV to allow for LVM to grow:

pvresize /dev/md0

Extend LV with new space in VG:

lvextend -L 600000 /dev/vgarray/shared

Extend Filesystem:

ext2online /dev/vgarray/shared

Reset everything to try something new:

umount /dev/vgarray/shared
lvremove /dev/vgarray/shared
pgchange -a n vgarray
vgexport /dev/vgarray
mdadm --stop /dev/md0
for dev in e g i k ;do dd if=/dev/zero of=/dev/hd${dev} bs=1024k count=4 ;done

Edit /etc/mdadm.conf and comment out two lines listed above.

Community content is available under CC-BY-SA unless otherwise noted.