@server-state/linux-raid-module

A module to view the current active raids based on /proc/mdstat generated by the linux-raid kernel module

Usage no npm install needed!

<script type="module">
  import serverStateLinuxRaidModule from 'https://cdn.skypack.dev/@server-state/linux-raid-module';
</script>

README

Linux raid module

Build Status GitHub npm version Coverage Status module type: official

This module parses the file /proc/mdstat generated from the Linux raid kernel module and extracts useful information, for example, raid name, current devices with their status, activities.

The /proc/mdstat file might look like this:

Personalities : [raid1] [raid0] 
md126 : active raid1 sdb20[2](R) sdb2[1] sdb1[0]
      20954112 blocks super 1.2 [2/2] [UU]
      [==============>......]  recovery = 74.4% (15600512/20954112) finish=3.2min speed=27496K/sec
      
unused devices: <none>

For it, the parsed JSON output would look like this:

{
   "personalities": [
      "raid1",
      "raid0"
   ],
   "raids": [
      {
         "name": "md126",
         "state": "active",
         "access": "rw",
         "type": "raid1",
         "unique": "myRaid",
         "devices": [
            {
               "name": "sdb20",
               "index": 2,
               "status": "rescue"
            },
            {
               "name": "sdb2",
               "index": 1,
               "status": "active"
            },
            {
               "name": "sdb1",
               "index": 0,
               "status": "active"
            }
         ],
         "blocks": 20954112,
         "parameters": "super 1.2",
         "ideal": 2,
         "current": 2,
         "options": [
            {
               "type": "activity",
               "activityType": "recovery",
               "progress": 74.4,
               "processed": 15600512,
               "total": 20954112,
               "finish": 3.2,
               "speed": 27496
            }
         ]
      }
   ]
}

This output generates a straight base to provide other applications useful information like server-state example client-base.

This official module belongs to the organization server-state.