|Set partition type
[root]# fdisk /dev/sdb
Partition ID (L to list options): fd
Note: repeat above for /dev/sdb11 and /dev/sdb12
fd = raid autodetect
|create partition table of new disk
sfdisk -d /dev/sda | sfdisk /dev/sdb
Note: this is like the prtvtoc ... | fmthard ... command in Solaris
1. Update the configuration file /etc/raidtab with these lines of code
2. Now make the RAID device md0 and create a filesystem on it
3. Now add entry to /etc/fstab and mount it:
Add line to fstab:
Create the mount point:
Mount the mirror:
mdadm -C /dev/md0 -l1 -n2 /dev/sdb10 /dev/sdb11 -x1 /dev/sdb12
|detail, examine and assemble
|detail = applies to the whole array which is currently active
examine = applies to the devices which are a component of the array
assemble = assemble the array using all devices (will use config file first then scan devices)
|Saving the configuration
echo "DEVICE partitions" > /etc/mdadm.conf
Note: by default the system will look in /etc/mdadm.conf then /etc/mdadm/mdadm.conf
|Lost the configuration file
|echo "DEVICE partitions" > /etc/mdadm.conf
mdadm --examine --scan >> /etc/mdadm.conf
mdadm --assemble --scan
|lsraid –a /dev/md0
|mdadm --detail /dev/md0
mdadm -D /dev/md0
|Display device configuration
|mdadm --misc -D /dev/md0
mdadm --misc -E /dev/sdb11
To test the raid integrity you might want to simulate a disk failure again there are a number of ways to do this.
|raidsetfaulty /dev/md0 /dev/sdb11
|mdadm -–manage /dev/md0 –f /dev/sdb11
Use the above “check the array” options to see that the disk has been faulted.
To remove a disk from the raid array use the following commands, the disk has to be faulty not faulted (see above) to allow this option to work, at this point the disk can be physically removed.
|raidhotremove /dev/md0 /dev/sdb11
|mdadm --manage /dev/md0 –r /dev/sdb11
Use the above “check the array” options to see that the disk has been removed.
Adding a disk to the array could result in two outcomes, if the array is already degraded the new will be used to fix the fault (if a hot spare has not already been used), if not then the disk will be used as a hot spare.
|raidhotadd /dev/md0 /dev/sdb11
|mdadm --manage /dev/md0 –a /dev/sdb11
Use the above “check the array” options to see that the disk has been added.
|## First you need to change the configuration
mdadm --grow /dev/md0 -n3
## Then you can add the disks
mdadm --manage /dev/md0 -a /dev/sdb12
## Now you can resize the filesystem
## MAKE SURE EVERYTHING IS BACKED UP
It is possible to change the type of the array from a raid 1 to a raid 5
|change from raid 1 to raid 5
## First you need to unmount any filesystem from the array
## Once the array has started then mount it again and check everything
mdadm -S /dev/md0
|Remove the array
mdadm --stop /dev/md0
## Once you run the below command there is no going back
|Restore the array
## standard header for mdadm.conf file
## get the information from the disks and append that information to mdadm.conf file
## use the mdadm.conf file to start the array
When an array is initialised with the persistent-superblock option in the /etc/raidtab file, a special superblock is written in the beginning of all disks participating in the array. This allows the kernel to read the configuration of RAID devices directly from the disks involved, instead of reading from some configuration file that may not be available at all times.
Autodetection allows the RAID devices to be automatically recognized by the kernel at boot-time, right after the ordinary partition detection is done.
To discuss how Oninit ® can assist please call on +1-913-674-0360 or alternatively just send an email specifying your requirements.