Created
January 14, 2022 20:00
-
-
Save jettero/e83cc128bf310e94bd887261d92f199d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [8]: import re | |
...: import subprocess | |
...: def get_ext_info(dev): | |
...: try: | |
...: output = subprocess.check_output(['sudo', 'dumpe2fs', '-h', dev], stderr=subprocess.DEVNULL).decode() | |
...: except: | |
...: pass | |
...: data = dict() | |
...: for line in output.splitlines(): | |
...: if m := re.match(r'^([^:]+):\s+(.+)$', line): | |
...: data[m.group(1)] = m.group(2) | |
...: return data | |
...: | |
...: get_ext_info("/dev/sda1")["Reserved GDT blocks"] | |
Out[8]: '1010' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment