The “mptctl” kernel module is required to check the RAID status on a Linux server using “mpt-status” tool. You may receive “/dev/mptctl: No such device” message OR “Make sure mptctl is loaded into the kernel” while checking the RAID status which indicates that the module is not loaded in the kernel OR the device “/dev/mptctl” is not created.
[root@server ~]# mpt-status
open /dev/mptctl: No such device
Are you sure your controller is supported by mptlinux?
Make sure mptctl is loaded into the kernel
To create the mptctl device, execute:
# mknod /dev/mptctl c 10 22
and verify it by
# ls -la /dev/mptctl
crw——- 1 root root 10, 220 Apr 12 08:05 /dev/mptctl
Once the device is created, load the module in the kernel using modprobe
# modprobe mptctl
and verify it using lsmod which should list the following modules along with it’s details
# lsmod |grep mptctl
mptctl
mptbase
scsi_mod
Add the module in /etc/rc.modules file to load the module in kernel on every reboot.
modprobe mptctl
Save the file. This will make sure the module is loaded in the kernel on every server reboot.
Once done, you will be able to check the RAID status by executing the ‘mpt-status’ command and it should show something like the following:
[root@server ~]# mpt-status
ioc0 vol_id 0 type IM, 2 phy, 465 GB, state OPTIMAL, flags ENABLED
ioc0 phy 1 scsi_id 1 ATA ST3500418AS CC38, 465 GB, state ONLINE, flags NONE
ioc0 phy 0 scsi_id 4 ATA ST3500418AS CC38, 465 GB, state ONLINE, flags NONE
The following article explains what is Raid, what are important levels and how to install and configure a raid device in a linux system using the software mdadm. This is tested in Redhat rhel5 and also works with other distributions as fedora, centos etc.
What is RAID?
RAID is redundant array of independent or inexpensive disks. It is mainly used for data protection. It protects our data storage from failures and data loss. All storage units now use raid technology.
It has following uses.
1. Data protection
2. Increasing performance
Types of RAIDs:
There are alot of levels of RAIDs. But the main levels are
1. Level 0 or Striping
2. Level 1 or Mirroring
3. Level 5 or Striping + Parity
Level 0:
It is also known as striping. You know hard disk is a block device. Datas are read and written from/to it by blocks.
Suppose we have data block as below
1 0 1 1
Suppose each bit takes one cpu clock cycles for writing into a disk. Total, it will take 4 cpu clock cycles.
With stripping:
In striping we use "N" number of hard disks. RAID devides the data block by "N" and writes each part to each disk in parallel.
If we have 4 hard disks, It'll take only one cpu clock cycle if we use Level 0 RAID.
Raid 0 is best for where more writing take place than reading. But is insecure as there is no recovery mechanisms.
Level 1:
Also known as Mirroring. One is the exact replica of other. Whatever writing to master disk will be written in to mirror disk also. Reading can be performed fro each disk simultaneously, thus increasing the read performance.
But can be utilize only 50% of the total size.
Level 5:
It is a combination of striping and parity. Need at least three hard disks. Both parity and data are distributed in all. If one hard disk fails, data on that can be regenerated by the data and parity information in the other two hard disks.
###RAID###
Raid 5 :need 3 disks
Raid 0 :need 2 disks
Raid 1 :need 2 disks
first partition disks
***RAID 5***
Here we'll show how to create a Level 5 raid device. Here we use three partitions /dev/sda5 /dev/sda6 /dev/sda7. Keep in mind that, in real industry it'll be three different hard disks.
This following command will create a raid device /dev/md0 with level 5
#mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda{5,6,7}
Formatting the raid device
#mke2fs -j /dev/md0
Creating mount point
#mkdir /raid5
Mounting the raid device to the created mount point
#mount /dev/md0 /raid5
Making the mount permanent by adding it in fstab
#vi /etc/fstab
/dev/md0 /raid5 ext3 defaults 0 0
:wq
#mount -a
Test read and write permissions. And if you want you can check whether the raid is working by failing or deleting any partition it consists of.
touch something in /raid5 and delete one of partitions of sda5,sda6,sda7
This is how we can create a Raid device with level 1
***RAID 1***
#mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda{5,6}
This is how we can create a Raid device with level 0
***RAID 0***
#mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda{5,6}
Stopping mdadm
*Unmount the md0 before stopping mdadm
#mdadm --stop /dev/md0
If you want to create additional devices[ie there exists a /dev/md0] you may need to add an "-a yes" option to the mdadm command.
For example,
#mdadm --create /dev/md1 -a yes --level=0 --raid-devices=2 /dev/sda{5,6}