blockDevices() raid added label, uuid (linux)

This commit is contained in:
Sebastian Hildebrandt 2023-02-27 17:30:19 +01:00
parent 3c58a18f24
commit 0120a93a8e
5 changed files with 17 additions and 3 deletions

View File

@ -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 |

View File

@ -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

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.17.11</th>
<td>2023-02-27</td>
<td><span class="code">blockDevices()</span> raid added label, uuid (linux)</td>
</tr>
<tr>
<th scope="row">5.17.10</th>
<td>2023-02-23</td>

View File

@ -204,7 +204,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">15,377</div>
<div class="numbers">15,385</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
@ -212,7 +212,7 @@
<div class="title">Downloads last month</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">596</div>
<div class="numbers">597</div>
<div class="title">Dependents</div>
</div>
</div>

View File

@ -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) {