RAID

da1:~ # fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1959 15735636 83 Linux
/dev/sda2 1960 2482 4200997+ 82 Linux swap / Solaris
/dev/sda3 2483 2495 104422+ 83 Linux
/dev/sda4 2496 19457 136247265 5 Extended
/dev/sda5 2496 2508 104391 8e Linux LVM
/dev/sda6 2509 2521 104391 8e Linux LVM
/dev/sda7 2522 2534 104391 8e Linux LVM
/dev/sda8 2535 2547 104391 fd Linux raid autodetect
/dev/sda9 2548 2560 104391 fd Linux raid autodetect
/dev/sda10 2561 2573 104391 fd Linux raid autodetect
/dev/sda11 2574 2586 104391 83 Linux
da1:~ # clear

da1:~ # mdadm –hlp
mdadm: unrecognized option `–hlp’
Usage: mdadm –help
for help
da1:~ # mdadm –help
mdadm is used for building, managing, and monitoring
Linux md devices (aka RAID arrays)
Usage: mdadm –create device options…
Create a new array from unused devices.
mdadm –assemble device options…
Assemble a previously created array.
mdadm –build device options…
Create or assemble an array without metadata.
mdadm –manage device options…
make changes to an existing array.
mdadm –misc options… devices
report on or modify various md related devices.
mdadm –grow options device
resize/reshape an active array
mdadm –incremental device
add a device to an array as appropriate
mdadm –monitor options…
Monitor one or more array for significant changes.
mdadm device options…
Shorthand for –manage.
Any parameter that does not start with ‘-‘ is treated as a device name
or, for –examine-bitmap, a file name.
The first such name is often the name of an md device. Subsequent
names are often names of component devices.

For detailed help on the above major modes use –help after the mode
e.g.
mdadm –assemble –help
For general help on options use
mdadm –help-options
da1:~ # mdadm –create /dev/md0 –level=1 –raid-devices=2 /dev/sda8 /dev/sda9
mdadm: array /dev/md0 started.
da1:~ # array /dev/md
md0 md11 md14 md17 md2 md22 md25 md28 md30 md5 md8
md1 md12 md15 md18 md20 md23 md26 md29 md31 md6 md9
md10 md13 md16 md19 md21 md24 md27 md3 md4 md7
da1:~ # more /proc/partitions
major minor #blocks name

8 0 156290904 sda
8 1 15735636 sda1
8 2 4200997 sda2
8 3 104422 sda3
8 4 1 sda4
8 5 104391 sda5
8 6 104391 sda6
8 7 104391 sda7
8 8 104391 sda8
8 9 104391 sda9
8 10 104391 sda10
8 11 104391 sda11
9 0 104320 md0
da1:~ # mdadm –misc–query /dev/md0
mdadm: unrecognized option `–misc–query’
Usage: mdadm –help
for help
da1:~ # mdadm –misc –query /dev/md0
/dev/md0: 101.88MiB raid1 2 devices, 0 spares. Use mdadm –detail for more detai l.
da1:~ # mdadm –misc –details /dev/md0
mdadm: unrecognized option `–details’
Usage: mdadm –help
for help
da1:~ # mdadm –misc –detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Aug 5 13:57:12 2008
Raid Level : raid1
Array Size : 104320 (101.89 MiB 106.82 MB)
Used Dev Size : 104320 (101.89 MiB 106.82 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Tue Aug 5 13:57:15 2008
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

UUID : 10d82e2a:61ed1aa3:59a6c3d9:358f3540
Events : 0.2

Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
da1:~ # more /proc/partitions
major minor #blocks name

8 0 156290904 sda
8 1 15735636 sda1
8 2 4200997 sda2
8 3 104422 sda3
8 4 1 sda4
8 5 104391 sda5
8 6 104391 sda6
8 7 104391 sda7
8 8 104391 sda8
8 9 104391 sda9
8 10 104391 sda10
8 11 104391 sda11
9 0 104320 md0
da1:~ # mdadm –manage /dev/md0 –fail /dev/sda8
mdadm: set /dev/sda8 faulty in /dev/md0
da1:~ # mdadm –misc –query /dev/md0
/dev/md0: 101.88MiB raid1 2 devices, 0 spares. Use mdadm –detail for more detai l.
da1:~ # mdadm –misc –detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Aug 5 13:57:12 2008
Raid Level : raid1
Array Size : 104320 (101.89 MiB 106.82 MB)
Used Dev Size : 104320 (101.89 MiB 106.82 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Tue Aug 5 14:00:22 2008
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0

UUID : 10d82e2a:61ed1aa3:59a6c3d9:358f3540
Events : 0.3

Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 9 1 active sync /dev/sda9

2 8 8 – faulty spare /dev/sda8
da1:~ # mdadm –manage /dev/md0 –fail /dev/sda9
mdadm: set /dev/sda9 faulty in /dev/md0
da1:~ # mdadm –manage /dev/md0 –remove /dev/sda8
mdadm: hot removed /dev/sda8
da1:~ # mdadm –misc –detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Aug 5 13:57:12 2008
Raid Level : raid1
Array Size : 104320 (101.89 MiB 106.82 MB)
Used Dev Size : 104320 (101.89 MiB 106.82 MB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Tue Aug 5 14:03:07 2008
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

UUID : 10d82e2a:61ed1aa3:59a6c3d9:358f3540
Events : 0.4

Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 9 1 active sync /dev/sda9
da1:~ # mdadm –manage /dev/md0 –remove /dev/sda9
mdadm: hot remove failed for /dev/sda9: Device or resource busy
da1:~ # mdadm –stop /dev/md0
mdadm: stopped /dev/md0
da1:~ # more /proc/partitions
major minor #blocks name

8 0 156290904 sda
8 1 15735636 sda1
8 2 4200997 sda2
8 3 104422 sda3
8 4 1 sda4
8 5 104391 sda5
8 6 104391 sda6
8 7 104391 sda7
8 8 104391 sda8
8 9 104391 sda9
8 10 104391 sda10
8 11 104391 sda11
da1:~ # mdadm –create /dev/md1 –level=5 –raid-devices=3 /d
ev/sda8 /dev/sda9 / dev/sda10 –spare-devices=1 /dev/sda11
mdadm: /dev/sda8 appears to be part of a raid array:
level=raid1 devices=2 ctime=Tue Aug 5 13:57:12 2008
mdadm: /dev/sda9 appears to be part of a raid array:
level=raid1 devices=2 ctime=Tue Aug 5 13:57:12 2008
Continue creating array? y
mdadm: array /dev/md1 started.
da1:~ # mdadm –misc –detail /dev/md1 /dev/md1:
Version : 00.90.03
Creation Time : Tue Aug 5 14:07:37 2008
Raid Level : raid5
Array Size : 208640 (203.78 MiB 213.65 MB)
Used Dev Size : 104320 (101.89 MiB 106.82 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 1
Persistence : Superblock is persistent

Update Time : Tue Aug 5 14:07:44 2008
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1

Layout : left-symmetric
Chunk Size : 64K

UUID : ec1fadec:c6148148:b00cbf42:a733e2d8
Events : 0.2

Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
2 8 10 2 active sync /dev/sda10

3 8 11 – spare /dev/sda11
da1:~ # mdadm –manage /dev/md0 –fail /dev/sda10 mdadm: cannot get array info for /dev/md0
da1:~ # mdadm –manage /dev/md1 –fail /dev/sda10
mdadm: set /dev/sda10 faulty in /dev/md1
da1:~ # mdadm –misc –detail /dev/md1
/dev/md1:
Version : 00.90.03
Creation Time : Tue Aug 5 14:07:37 2008
Raid Level : raid5
Array Size : 208640 (203.78 MiB 213.65 MB)
Used Dev Size : 104320 (101.89 MiB 106.82 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 1
Persistence : Superblock is persistent

Update Time : Tue Aug 5 14:09:00 2008
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 1
Spare Devices : 1

Layout : left-symmetric
Chunk Size : 64K

Rebuild Status : 74% complete

UUID : ec1fadec:c6148148:b00cbf42:a733e2d8
Events : 0.3

Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
4 8 11 2 spare rebuilding /dev/sda11

3 8 10 – faulty spare /dev/sda10
da1:~ # mdadm –manage /dev/md1 –add /dev/sda
sda sda10 sda2 sda4 sda6 sda8
sda1 sda11 sda3 sda5 sda7 sda9
da1:~ # mdadm –manage /dev/md1 –add /dev/sda
mdadm: Cannot open /dev/sda: Device or resource busy
da1:~ # clear

da1:~ # cd /etc/
da1:/etc # ll mdadm.conf
/bin/ls: mdadm.conf: No such file or directory
da1:/etc # echo ‘DEVICE /dev/sda8 /dev/sda9 /dev/sda10’ > mdadm.conf
da1:/etc # more mdadm.conf
DEVICE /dev/sda8 /dev/sda9 /dev/sda10
da1:/etc # mdadm –details –scan >> mdadm.conf
mdadm: unrecognized option `–details’
Usage: mdadm –help
for help
da1:/etc # mdadm –detail –scan >> mdadm.conf
da1:/etc # more mdadm.conf
DEVICE /dev/sda8 /dev/sda9 /dev/sda10
ARRAY /dev/md1 level=raid5 num-devices=3 UUID=ec1fadec:c6148148:b00cbf42:a733e2d
8
da1:/etc #

Share

101 thoughts on “RAID”

Leave a Comment