Do you have a server with software raid and are looking to check its status? If so this article is for you, we will look at how to check the raid array status as well as how to check specific disks in the context of the RAID array.
What Is RAID?
The term RAID stands for redundant array of inexpensive disks, it is a technology that allows you to combine multiple disks into one or more logical units. With RAID arrays you can increase redundancy, performance, or both.
Introduction To Software Raid
Before software RAID arrays, raid was typically done with a hardware device that would be between the disks and the rest of the system.
Since software RAID was added the need for a separate hardware device has been greatly reduced if not eliminated. On Linux, software raid is provided by the utility mdadm.
Using /proc/mdstat
If you are looking for quick stats on your RAID array this is the command you want.
user@example:~$ cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb[1] sdc[0]
10476544 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Understanding The Results
md0 : active raid1 sdb[1] sdc[0]
- md0 is the name of the array
- active means the array is active
- List the raid level which in this case is raid1
- sdb and sdc are members of the array
10476544 blocks super 1.2 [2/2] [UU]
- 10476544 blocks is the size of the array
- super 1.2 indicated the version of superblock used
- [2/2] means the array is composed of 2 devices both of which are active
- [UU] is the status of the drives in the array
Using Mdadm To Check Raid Status
Both the -D and –details flags for mdadm will display even more detailed information about the array and an example is shown below.
user@example:~$ sudo mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Jun 19 11:54:22 2024
Raid Level : raid1
Array Size : 10476544 (9.99 GiB 10.73 GB)
Used Dev Size : 10476544 (9.99 GiB 10.73 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Wed Jun 19 11:57:41 2024
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Consistency Policy : resync
Name : example:0 (local to host example)
UUID : 359234d1:da054d1a:a883c4b3:aebf5906
Events : 22
Number Major Minor RaidDevice State
0 8 32 0 active sync /dev/sdc
1 8 16 1 active sync /dev/sdb
Understanding The Results
Let’s dive into the results to understand what everything means:
Version : 1.2
1.2 indicated the version of the superblock used
Creation Time : Wed Jun 19 11:54:22 2024
When the RAID array was created
Raid Level : raid1
The RAID level of the array, in this case, that is RAID 1 (mirroring)
Array Size : 10476544 (9.99 GiB 10.73 GB)
This is the usable size of the array
Used Dev Size : 10476544 (9.99 GiB 10.73 GB)
This is the space used on each device
Raid Devices : 2
The number of devices in the current array
Total Devices : 2
All related devices included spares and failed devices
Persistence : Superblock is persistent
Indicates the metadata about the array is stored on the disks
Update Time : Wed Jun 19 11:57:41 2024
When the status of the array was last updated
State : clean
The state of the RAID array, where clean means everything is good
Active Devices : 2
The number of devices active in the array
Working Devices : 2
The number of working devices in the array
Failed Devices : 0
The number of failed devices in the array
Spare Devices : 0
The number of spare devices in the array
Consistency Policy : resync
Indicated the policy used to maintain data consistency
Name : example:0 (local to host example)
The hostname and array number
UUID : 359234d1:da054d1a:a883c4b3:aebf5906
The UUID of the array
Events : 22
The number of recorded events for the array
Number Major Minor RaidDevice State 0 8 32 0 active sync /dev/sdc 1 8 16 1 active sync /dev/sdb
Shows both disks are active and in sync now but if a disk has failed you will find it here.
Using Mdadm To Check A Disk
This section uses mdadm to pull information on a single disk.
user@example:~$ sudo mdadm -E /dev/sdc
/dev/sdc:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 359234d1:da054d1a:a883c4b3:aebf5906
Name : example:0 (local to host example)
Creation Time : Wed Jun 19 11:54:22 2024
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 20953088 sectors (9.99 GiB 10.73 GB)
Array Size : 10476544 KiB (9.99 GiB 10.73 GB)
Data Offset : 18432 sectors
Super Offset : 8 sectors
Unused Space : before=18280 sectors, after=0 sectors
State : clean
Device UUID : 3e5fb78b:c0444da6:c61f5cc9:557b629b
Update Time : Wed Jun 19 11:57:03 2024
Bad Block Log : 512 entries available at offset 136 sectors
Checksum : 5cc406ac - correct
Events : 22
Device Role : Active device 0
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
Understanding The Results
Magic : a92b4efc
An identifier indicating RAID metadata
Version : 1.2
1.2 indicated the version of superblock used
Feature Map : 0x0
Bitmask indicates features
Array UUID : 359234d1:da054d1a:a883c4b3:aebf5906
The UUID of the array
Name : example:0 (local to host example
The hostname and array number
Creation Time : Wed Jun 19 11:54:22 2024
When the RAID array was created
Raid Level : raid1
The RAID level of the array, in this case, that is RAID 1 (mirroring)
Raid Devices : 2
The number of devices in the raid array
Avail Dev Size : 20953088 sectors (9.99 GiB 10.73 GB)
The available size of the device in sectors, GiB, and GB.
Array Size : 10476544 KiB (9.99 GiB 10.73 GB)
The total size of the raid array
Data Offset : 18432 sectors
The offset where the data starts on the device
Super Offset : 8 sectors
The offset where RAID metadata starts on the device
Unused Space : before=18280 sectors, after=0 sectors
The amount of unused space before and after the RAID data
State : clean
The state of the RAID array, where clean means everything is good
Device UUID : 3e5fb78b:c0444da6:c61f5cc9:557b629b
The UUID of this specific disk
Update Time : Wed Jun 19 11:57:03 2024
When the status of the array was last updated
Bad Block Log : 512 entries available at offset 136 sectors
Information on how many entries are in the bad block log and where it is located on the disk
Checksum : 5cc406ac – correct
The checksum of the RAID metadata shows it is correct
Events : 22
The number of recorded events for the array
Device Role : Active device 0
The device number from the array starting at 0
Array State : AA (‘A’ active, ‘.’ missing, ‘R’ == replacing)
The state of the array showing both disks active
Logs
Logs for software raid will log to the location that kernel messages will be saved to. The most common locations for kernel messages are listed below:
- /var/log/kern.log
- /var/log/messages
- /var/log/syslog
- The dmesg command
- Systemd Journal using journalctl
Conclusion
With Software RAID you no longer need to rely on hardware raid cards. In this blog post, we discuss how to check the status of your software raid on your Linux server. We also go through what everything means so you will be sure to understand.
Additional Links
Done reading and looking for additional information, why not check these out/
Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.
Leave a Reply