Skip to main content
https://scrutinizer-ci.com/g/nicolargo/pymdstat/badges/build.png?b=master https://scrutinizer-ci.com/g/nicolargo/pymdstat/badges/quality-score.png?b=master Latest Version

A pythonic library to parse Linux /proc/mdstat file.

>>> from pymdstat import MdStat

>>> mds = MdStat() # Read the /proc/mdstat file

>>> mds
Personalities : [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[1] sda2[0]
      136448 blocks [2/2] [UU]

md2 : active raid1 sdb3[1] sda3[0]
      129596288 blocks [2/2] [UU]

md3 : active raid5 sdl1[9] sdk1[8] sdj1[7] sdi1[6] sdh1[5] sdg1[4] sdf1[3] sde1[2] sdd1[1] sdc1[0]
      1318680576 blocks level 5, 1024k chunk, algorithm 2 [10/10] [UUUUUUUUUU]

md0 : active raid1 sdb1[1] sda1[0]
      16787776 blocks [2/2] [UU]

unused devices: <none>

>>> mds.get_stats()
{'arrays': {'md0': {'available': '2',
   'components': {'sda1': '0', 'sdb1': '1'},
   'config': 'UU',
   'status': 'active',
   'type': 'raid1',
   'used': '2'},
  'md1': {'available': '2',
   'components': {'sda2': '0', 'sdb2': '1'},
   'config': 'UU',
   'status': 'active',
   'type': 'raid1',
   'used': '2'},
  'md2': {'available': '2',
   'components': {'sda3': '0', 'sdb3': '1'},
   'config': 'UU',
   'status': 'active',
   'type': 'raid1',
   'used': '2'},
  'md3': {'available': '10',
   'components': {'sdc1': '0',
    'sdd1': '1',
    'sde1': '2',
    'sdf1': '3',
    'sdg1': '4',
    'sdh1': '5',
    'sdi1': '6',
    'sdj1': '7',
    'sdk1': '8',
    'sdl1': '9'},
   'config': 'UUUUUUUUUU',
   'status': 'active',
   'type': 'raid5',
   'used': '10'}},
 'personalities': ['raid1', 'raid6', 'raid5', 'raid4']}

>>> mds.personalities()
['raid1', 'raid6', 'raid5', 'raid4']

>>> mds.arrays()
['md2', 'md3', 'md0', 'md1']

>>> mds.type('md3')
'raid6'

>>> mds.status('md3')
'active'

>>> mds.components('md3')
['sdk1', 'sdj1', 'sde1', 'sdl1', 'sdg1', 'sdf1', 'sdh1', 'sdc1', 'sdd1', 'sdi1']

>>> mds.available('md3')
10

>>> mds.used('md3')
10

>>> mds.config('md3')
'UUUUUUUUUU'

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymdstat-0.5.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymdstat-0.5.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pymdstat-0.5.1.tar.gz.

File metadata

  • Download URL: pymdstat-0.5.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymdstat-0.5.1.tar.gz
Algorithm Hash digest
SHA256 61565b436e79bc6d1338f31280ad5d39e2c11c608aa938e9faa3f5a3dde077fb
MD5 23c90afbc2831f31aa74f5b873785915
BLAKE2b-256 ef4634b801321e0d373c9f73efabebc95ff7af223cf3b1b033286935d8639052

See more details on using hashes here.

File details

Details for the file pymdstat-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pymdstat-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymdstat-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8eb76b10aa2d1db45c72382e889fe874490611d199126790dc6c71ff0deb4e45
MD5 24ade24d307c34eaf449fb9cab8dfed8
BLAKE2b-256 7ca3bf990e2619bf36f4e20920f9ea17f34622a6555ad5b3ab2d119170eb183c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 files

0.5.0

2 files

0.4.3

2 files

0.4.2

1 file

0.4.1

1 file

0.3

1 file

0.2

1 file

0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page