From 0120a93a8e833e181df74554b10ec228735c304f Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 27 Feb 2023 17:30:19 +0100 Subject: [PATCH] blockDevices() raid added label, uuid (linux) --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/filesystem.js | 8 ++++++++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 418fb24..459f52f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.17.11 | 2023-02-27 | `blockDevices()` raid added label, uuid (linux) | | 5.17.10 | 2023-02-23 | `blockDevices()` fixed parsing raids (linux) | | 5.17.9 | 2023-02-11 | `system()` fixed model Apple Silicon | | 5.17.8 | 2023-01-30 | `system()` improved virtual host detection for Parallels | diff --git a/README.md b/README.md index 5044dcf..bb634d3 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ [![MIT license][license-img]][license-url] ## The Systeminformation Project -This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 6 mio downloads per month, > 130 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project! +This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 6 mio downloads per month, > 140 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project! ## New Version 5.0 diff --git a/docs/history.html b/docs/history.html index e3dcc20..b21100e 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.17.11 + 2023-02-27 + blockDevices() raid added label, uuid (linux) + 5.17.10 2023-02-23 diff --git a/docs/index.html b/docs/index.html index f44779f..cf6ad69 100644 --- a/docs/index.html +++ b/docs/index.html @@ -204,7 +204,7 @@
-
15,377
+
15,385
Lines of code
@@ -212,7 +212,7 @@
Downloads last month
-
596
+
597
Dependents
diff --git a/lib/filesystem.js b/lib/filesystem.js index c8f81ba..3c395f4 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -382,6 +382,8 @@ function parseBlk(lines) { function decodeMdabmData(lines) { const raid = util.getValue(lines, 'md_level', '='); + const label = util.getValue(lines, 'md_name', '='); // <- get label info + const uuid = util.getValue(lines, 'md_uuid', '='); // <- get uuid info const members = []; lines.forEach(line => { if (line.toLowerCase().startsWith('md_device_dev') && line.toLowerCase().indexOf('/dev/') > 0) { @@ -390,6 +392,8 @@ function decodeMdabmData(lines) { }); return { raid, + label, + uuid, members }; } @@ -402,6 +406,10 @@ function raidMatchLinux(data) { if (element.type.startsWith('raid')) { const lines = execSync(`mdadm --export --detail /dev/${element.name}`).toString().split('\n'); const mdData = decodeMdabmData(lines); + + element.label = mdData.label; // <- assign label info + element.uuid = mdData.uuid; // <- assign uuid info + if (mdData.members && mdData.members.length && mdData.raid === element.type) { result = result.map(blockdevice => { if (blockdevice.fsType === 'linux_raid_member' && mdData.members.indexOf(blockdevice.name) >= 0) {