2015-10-20 13:52:19 -06:00
|
|
|
/* Copyright (C) 2015 Mike Fleetwood
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-10-18 16:45:28 -06:00
|
|
|
#include "SWRaid_Info.h"
|
|
|
|
#include "BlockSpecial.h"
|
|
|
|
#include "Utils.h"
|
2015-10-20 13:52:19 -06:00
|
|
|
|
|
|
|
#include <glibmm/ustring.h>
|
2018-12-04 09:46:27 -07:00
|
|
|
#include <glibmm/miscutils.h>
|
2015-10-21 06:54:58 -06:00
|
|
|
#include <fstream>
|
2015-10-20 13:52:19 -06:00
|
|
|
|
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
|
|
|
// Data model:
|
2015-10-23 00:34:13 -06:00
|
|
|
// cache_initialised - Has the cache been loaded?
|
2015-10-20 13:52:19 -06:00
|
|
|
// mdadm_found - Is the "mdadm" command available?
|
2015-10-21 06:54:58 -06:00
|
|
|
// swraid_info_cache - Vector of member information in Linux Software RAID arrays.
|
2015-10-22 05:37:57 -06:00
|
|
|
// Only active arrays have /dev entries.
|
2016-07-04 11:40:38 -06:00
|
|
|
// Notes:
|
|
|
|
// * BS(member) is short hand for constructor BlockSpecial(member).
|
|
|
|
// * Array is only displayed as the mount point to the user and
|
|
|
|
// never compared so not constructing BlockSpecial object for it.
|
2015-10-20 13:52:19 -06:00
|
|
|
// E.g.
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// //member , fstype , array , uuid , label , active
|
|
|
|
// [{BS("/dev/sda1"), FS_LINUX_SWRAID, "/dev/md1" , "15224a42-c25b-bcd9-15db-60004e5fe53a", "chimney:1", true },
|
|
|
|
// {BS("/dev/sdb1"), FS_LINUX_SWRAID, "/dev/md1" , "15224a42-c25b-bcd9-15db-60004e5fe53a", "chimney:1", true },
|
|
|
|
// {BS("/dev/sda2"), FS_LINUX_SWRAID, "" , "8dc7483c-d74e-e0a8-b6a8-dc3ca57e43f8", "" , false},
|
|
|
|
// {BS("/dev/sdb2"), FS_LINUX_SWRAID, "" , "8dc7483c-d74e-e0a8-b6a8-dc3ca57e43f8", "" , false},
|
|
|
|
// {BS("/dev/sdc") , FS_ATARAID , "/dev/md126", "43060c4c-b0c0-c371-60bf-d43082e97d3c", "" , true },
|
|
|
|
// {BS("/dev/sdd") , FS_ATARAID , "/dev/md126", "43060c4c-b0c0-c371-60bf-d43082e97d3c", "" , true }
|
2015-10-21 06:54:58 -06:00
|
|
|
// ]
|
2015-10-20 13:52:19 -06:00
|
|
|
|
|
|
|
// Initialise static data elements
|
2015-10-23 00:34:13 -06:00
|
|
|
bool SWRaid_Info::cache_initialised = false;
|
2015-10-20 13:52:19 -06:00
|
|
|
bool SWRaid_Info::mdadm_found = false;
|
2015-10-21 06:54:58 -06:00
|
|
|
std::vector<SWRaid_Member> SWRaid_Info::swraid_info_cache;
|
2015-10-20 13:52:19 -06:00
|
|
|
|
|
|
|
void SWRaid_Info::load_cache()
|
|
|
|
{
|
|
|
|
set_command_found();
|
|
|
|
load_swraid_info_cache();
|
2015-10-23 00:34:13 -06:00
|
|
|
cache_initialised = true;
|
2015-10-20 13:52:19 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SWRaid_Info::is_member( const Glib::ustring & member_path )
|
|
|
|
{
|
2015-10-23 00:34:13 -06:00
|
|
|
initialise_if_required();
|
2015-10-21 06:54:58 -06:00
|
|
|
const SWRaid_Member & memb = get_cache_entry_by_member( member_path );
|
2016-07-04 11:40:38 -06:00
|
|
|
if ( memb.member.m_name.length() > 0 )
|
2015-10-21 06:54:58 -06:00
|
|
|
return true;
|
2015-10-20 13:52:19 -06:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-07-04 11:40:38 -06:00
|
|
|
// Return member/array active status, or false when there is no such member.
|
2015-10-21 06:54:58 -06:00
|
|
|
bool SWRaid_Info::is_member_active( const Glib::ustring & member_path )
|
|
|
|
{
|
2015-10-23 00:34:13 -06:00
|
|
|
initialise_if_required();
|
2015-10-21 06:54:58 -06:00
|
|
|
const SWRaid_Member & memb = get_cache_entry_by_member( member_path );
|
2016-07-04 11:40:38 -06:00
|
|
|
return memb.active;
|
2015-10-21 06:54:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 09:19:39 -07:00
|
|
|
|
|
|
|
// Return "file system" type of the member, or FS_UNKNOWN if there is no such member.
|
|
|
|
FSType SWRaid_Info::get_fstype(const Glib::ustring& member_path)
|
|
|
|
{
|
|
|
|
initialise_if_required();
|
|
|
|
const SWRaid_Member& memb = get_cache_entry_by_member(member_path);
|
|
|
|
return memb.fstype;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-22 05:37:57 -06:00
|
|
|
// Return array /dev entry (e.g. "/dev/md1") containing the specified member, or "" if the
|
|
|
|
// array is not running or there is no such member.
|
|
|
|
Glib::ustring SWRaid_Info::get_array( const Glib::ustring & member_path )
|
|
|
|
{
|
2015-10-23 00:34:13 -06:00
|
|
|
initialise_if_required();
|
2015-10-22 05:37:57 -06:00
|
|
|
const SWRaid_Member & memb = get_cache_entry_by_member( member_path );
|
|
|
|
return memb.array;
|
|
|
|
}
|
|
|
|
|
2015-10-23 14:23:29 -06:00
|
|
|
// Return array UUID for the specified member, or "" when failed to parse the UUID or
|
|
|
|
// there is no such member.
|
|
|
|
Glib::ustring SWRaid_Info::get_uuid( const Glib::ustring & member_path )
|
|
|
|
{
|
2015-10-23 00:34:13 -06:00
|
|
|
initialise_if_required();
|
2015-10-23 14:23:29 -06:00
|
|
|
const SWRaid_Member & memb = get_cache_entry_by_member( member_path );
|
|
|
|
return memb.uuid;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return array label (array name in mdadm terminology) for the specified member, or ""
|
|
|
|
// when the array has no label or there is no such member.
|
|
|
|
// (Metadata 0.90 arrays don't have names. Metata 1.x arrays are always named, getting a
|
|
|
|
// default of hostname ":" array number when not otherwise specified).
|
|
|
|
Glib::ustring SWRaid_Info::get_label( const Glib::ustring & member_path )
|
|
|
|
{
|
2015-10-23 00:34:13 -06:00
|
|
|
initialise_if_required();
|
2015-10-23 14:23:29 -06:00
|
|
|
const SWRaid_Member & memb = get_cache_entry_by_member( member_path );
|
|
|
|
return memb.label;
|
|
|
|
}
|
|
|
|
|
2015-10-20 13:52:19 -06:00
|
|
|
// Private methods
|
|
|
|
|
2015-10-23 00:34:13 -06:00
|
|
|
void SWRaid_Info::initialise_if_required()
|
|
|
|
{
|
|
|
|
if ( ! cache_initialised )
|
|
|
|
{
|
|
|
|
set_command_found();
|
|
|
|
load_swraid_info_cache();
|
|
|
|
cache_initialised = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 13:52:19 -06:00
|
|
|
void SWRaid_Info::set_command_found()
|
|
|
|
{
|
|
|
|
mdadm_found = ! Glib::find_program_in_path( "mdadm" ).empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SWRaid_Info::load_swraid_info_cache()
|
|
|
|
{
|
|
|
|
Glib::ustring output, error;
|
|
|
|
|
|
|
|
swraid_info_cache.clear();
|
|
|
|
|
2015-10-23 14:23:29 -06:00
|
|
|
// Load SWRaid members into the cache. Load member device, array UUID and array
|
|
|
|
// label (array name in mdadm terminology).
|
2017-09-19 12:51:22 -06:00
|
|
|
if ( mdadm_found &&
|
|
|
|
! Utils::execute_command( "mdadm --examine --scan --verbose", output, error, true ) )
|
2015-10-20 13:52:19 -06:00
|
|
|
{
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// Extract information about all array members. Example output:
|
2015-10-23 14:23:29 -06:00
|
|
|
// ARRAY metadata=imsm UUID=9a5e3477:e1e668ea:12066a1b:d3708608
|
2015-10-20 13:52:19 -06:00
|
|
|
// devices=/dev/sdd,/dev/sdc,/dev/md/imsm0
|
2015-10-23 14:23:29 -06:00
|
|
|
// ARRAY /dev/md/MyRaid container=9a5e3477:e1e668ea:12066a1b:d3708608 member=0 UUID=47518beb:cc6ef9e7:c80cd1c7:5f6ecb28
|
2015-10-20 13:52:19 -06:00
|
|
|
//
|
2015-10-23 14:23:29 -06:00
|
|
|
// ARRAY /dev/md/1 level=raid1 metadata=1.0 num-devices=2 UUID=15224a42:c25bbcd9:15db6000:4e5fe53a name=chimney:1
|
2015-10-20 13:52:19 -06:00
|
|
|
// devices=/dev/sda1,/dev/sdb1
|
2015-10-23 14:23:29 -06:00
|
|
|
// ARRAY /dev/md5 level=raid1 num-devices=2 UUID=8dc7483c:d74ee0a8:b6a8dc3c:a57e43f8
|
2015-10-20 13:52:19 -06:00
|
|
|
// devices=/dev/sda6,/dev/sdb6
|
|
|
|
std::vector<Glib::ustring> lines;
|
|
|
|
Utils::split( output, lines, "\n" );
|
2015-10-24 08:21:46 -06:00
|
|
|
enum MDADM_LINE_TYPE
|
2015-10-20 13:52:19 -06:00
|
|
|
{
|
2015-10-24 08:21:46 -06:00
|
|
|
MDADM_LT_OTHER = 0,
|
|
|
|
MDADM_LT_ARRAY = 1,
|
|
|
|
MDADM_LT_DEVICES = 2
|
2015-10-20 13:52:19 -06:00
|
|
|
};
|
2015-10-24 08:21:46 -06:00
|
|
|
MDADM_LINE_TYPE mdadm_line_type = MDADM_LT_OTHER;
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
FSType fstype = FS_UNKNOWN;
|
2015-10-23 14:23:29 -06:00
|
|
|
Glib::ustring uuid;
|
|
|
|
Glib::ustring label;
|
2015-10-20 13:52:19 -06:00
|
|
|
for ( unsigned int i = 0 ; i < lines.size() ; i ++ )
|
|
|
|
{
|
|
|
|
if ( lines[i].substr( 0, 6 ) == "ARRAY " )
|
|
|
|
{
|
2015-10-24 08:21:46 -06:00
|
|
|
mdadm_line_type = MDADM_LT_ARRAY;
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
|
|
|
|
if (lines[i].find("container=") != Glib::ustring::npos)
|
2015-10-23 14:23:29 -06:00
|
|
|
{
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// Skip mdadm array containers which don't have
|
|
|
|
// any members.
|
|
|
|
mdadm_line_type = MDADM_LT_OTHER;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
fstype = FS_UNKNOWN;
|
|
|
|
Glib::ustring metadata = Utils::regexp_label(lines[i],
|
|
|
|
"metadata=([[:graph:]]+)");
|
|
|
|
|
|
|
|
// Mdadm doesn't print a metadata tag for 0.90 version
|
|
|
|
// arrays, so accept empty.
|
|
|
|
if (metadata == "" || metadata == "1.0" ||
|
|
|
|
metadata == "1.1" || metadata == "1.2" )
|
|
|
|
{
|
|
|
|
fstype = FS_LINUX_SWRAID;
|
|
|
|
}
|
|
|
|
else if (metadata == "imsm" || metadata == "ddf")
|
|
|
|
{
|
|
|
|
fstype = FS_ATARAID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Skip unexpected mdadm array line.
|
2015-10-24 08:21:46 -06:00
|
|
|
mdadm_line_type = MDADM_LT_OTHER;
|
2015-10-23 14:23:29 -06:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
uuid = mdadm_to_canonical_uuid(
|
|
|
|
Utils::regexp_label( lines[i], "UUID=([[:graph:]]+)" ) );
|
|
|
|
label = Utils::regexp_label( lines[i], "name=(.*)$" );
|
2015-10-20 13:52:19 -06:00
|
|
|
}
|
2015-10-24 08:21:46 -06:00
|
|
|
else if ( mdadm_line_type == MDADM_LT_ARRAY &&
|
2015-10-20 13:52:19 -06:00
|
|
|
lines[i].find( "devices=" ) != Glib::ustring::npos )
|
|
|
|
{
|
2015-10-24 08:21:46 -06:00
|
|
|
mdadm_line_type = MDADM_LT_DEVICES;
|
2015-10-20 13:52:19 -06:00
|
|
|
Glib::ustring devices_str = Utils::regexp_label( lines[i],
|
|
|
|
"devices=([[:graph:]]+)" );
|
|
|
|
std::vector<Glib::ustring> devices;
|
|
|
|
Utils::split( devices_str, devices, "," );
|
|
|
|
for ( unsigned int j = 0 ; j < devices.size() ; j ++ )
|
2015-10-21 06:54:58 -06:00
|
|
|
{
|
|
|
|
SWRaid_Member memb;
|
2016-07-04 11:40:38 -06:00
|
|
|
memb.member = BlockSpecial( devices[j] );
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
memb.fstype = fstype;
|
2015-10-22 05:37:57 -06:00
|
|
|
memb.array = "";
|
2015-10-23 14:23:29 -06:00
|
|
|
memb.uuid = uuid;
|
|
|
|
memb.label = label;
|
2015-10-21 06:54:58 -06:00
|
|
|
memb.active = false;
|
|
|
|
swraid_info_cache.push_back( memb );
|
|
|
|
}
|
2015-10-23 14:23:29 -06:00
|
|
|
uuid.clear();
|
|
|
|
label.clear();
|
2015-10-20 13:52:19 -06:00
|
|
|
}
|
|
|
|
else
|
2015-10-23 14:23:29 -06:00
|
|
|
{
|
2015-10-24 08:21:46 -06:00
|
|
|
mdadm_line_type = MDADM_LT_OTHER;
|
2015-10-23 14:23:29 -06:00
|
|
|
}
|
2015-10-20 13:52:19 -06:00
|
|
|
}
|
|
|
|
}
|
2015-10-21 06:54:58 -06:00
|
|
|
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// For active array members, set array and active flag.
|
2015-10-21 06:54:58 -06:00
|
|
|
std::string line;
|
|
|
|
std::ifstream input( "/proc/mdstat" );
|
|
|
|
if ( input )
|
|
|
|
{
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// Read /proc/mdstat extracting information about all active array
|
|
|
|
// members. Example /proc/mdstat:
|
2015-10-24 08:21:46 -06:00
|
|
|
// Personalities : [raid1]
|
|
|
|
// md127 : inactive sdd[1](S) sdc[0](S)
|
|
|
|
// 6306 blocks super external:imsm
|
|
|
|
//
|
|
|
|
// md126 : active raid1 sdc[1] sdd[0]
|
|
|
|
// 8383831 blocks super external:/md127/0 [2/2] [UU]
|
|
|
|
//
|
|
|
|
// md1 : active raid1 sdb1[3] sda1[2]
|
|
|
|
// 524224 blocks super 1.0 [2/2] [UU]
|
|
|
|
//
|
|
|
|
// md5 : active raid1 sda6[0] sdb6[1]
|
|
|
|
// 524224 blocks [2/2] [UU]
|
|
|
|
//
|
|
|
|
// unused devices: <none>
|
|
|
|
enum MDSTAT_LINE_TYPE
|
|
|
|
{
|
|
|
|
MDSTAT_LT_OTHER = 0,
|
|
|
|
MDSTAT_LT_ACTIVE = 1,
|
|
|
|
MDSTAT_LT_BLOCKS = 2
|
|
|
|
};
|
|
|
|
MDSTAT_LINE_TYPE mdstat_line_type = MDSTAT_LT_OTHER;
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
FSType fstype = FS_UNKNOWN;
|
2015-10-24 08:21:46 -06:00
|
|
|
Glib::ustring array;
|
|
|
|
std::vector<Glib::ustring> members;
|
2015-10-21 06:54:58 -06:00
|
|
|
while ( getline( input, line ) )
|
|
|
|
{
|
|
|
|
if ( line.find( " : active " ) != std::string::npos )
|
|
|
|
{
|
2015-10-24 08:21:46 -06:00
|
|
|
mdstat_line_type = MDSTAT_LT_ACTIVE;
|
2015-10-21 06:54:58 -06:00
|
|
|
// Found a line for an active array. Split into space
|
|
|
|
// separated fields.
|
|
|
|
std::vector<Glib::ustring> fields;
|
|
|
|
Utils::tokenize( line, fields, " " );
|
2015-10-24 08:21:46 -06:00
|
|
|
array = "/dev/" + fields[0];
|
|
|
|
members.clear();
|
2015-10-21 06:54:58 -06:00
|
|
|
for ( unsigned int i = 0 ; i < fields.size() ; i ++ )
|
|
|
|
{
|
|
|
|
Glib::ustring::size_type index = fields[i].find( "[" );
|
|
|
|
if ( index != Glib::ustring::npos )
|
|
|
|
{
|
|
|
|
// Field contains an "[" so got a short
|
2015-10-24 08:21:46 -06:00
|
|
|
// kernel device name of a member.
|
|
|
|
members.push_back( "/dev/" + fields[i].substr( 0, index ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( mdstat_line_type == MDSTAT_LT_ACTIVE &&
|
|
|
|
line.find( " blocks " ) != std::string::npos )
|
|
|
|
{
|
|
|
|
mdstat_line_type = MDSTAT_LT_BLOCKS;
|
|
|
|
// Found a blocks line for an array.
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
fstype = FS_UNKNOWN;
|
|
|
|
Glib::ustring super = Utils::regexp_label(line, "super ([[:graph:]]+)");
|
2015-10-24 08:21:46 -06:00
|
|
|
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// Kernel doesn't print the super type for 0.90 version
|
|
|
|
// arrays, so accept empty.
|
|
|
|
if (super == "" || super == "1.0" ||
|
|
|
|
super == "1.1" || super == "1.2" )
|
|
|
|
{
|
|
|
|
fstype = FS_LINUX_SWRAID;
|
|
|
|
}
|
|
|
|
else if (super.compare(0, 9, "external:") == 0)
|
|
|
|
{
|
|
|
|
fstype = FS_ATARAID;
|
|
|
|
}
|
|
|
|
else
|
2015-10-24 08:21:46 -06:00
|
|
|
{
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
// Skip unrecognised super type.
|
2015-10-24 08:21:46 -06:00
|
|
|
mdstat_line_type = MDSTAT_LT_OTHER;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( unsigned int i = 0 ; i < members.size() ; i ++ )
|
|
|
|
{
|
|
|
|
SWRaid_Member & memb = get_cache_entry_by_member( members[i] );
|
2016-07-04 11:40:38 -06:00
|
|
|
if ( memb.member.m_name.length() > 0 )
|
2015-10-24 08:21:46 -06:00
|
|
|
{
|
|
|
|
// Update existing cache entry, setting
|
2015-10-22 05:37:57 -06:00
|
|
|
// array and active flag.
|
2015-10-24 08:21:46 -06:00
|
|
|
memb.array = array;
|
|
|
|
memb.active = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Member not already found in the cache.
|
|
|
|
// (Mdadm command possibly missing).
|
|
|
|
// Insert cache entry.
|
|
|
|
SWRaid_Member new_memb;
|
2016-07-04 11:40:38 -06:00
|
|
|
new_memb.member = BlockSpecial( members[i] );
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
new_memb.fstype = fstype;
|
2015-10-24 08:21:46 -06:00
|
|
|
new_memb.array = array;
|
|
|
|
new_memb.uuid = "";
|
|
|
|
new_memb.label = "";
|
|
|
|
new_memb.active = true;
|
|
|
|
swraid_info_cache.push_back( new_memb );
|
2015-10-21 06:54:58 -06:00
|
|
|
}
|
|
|
|
}
|
2015-10-24 08:21:46 -06:00
|
|
|
array.clear();
|
|
|
|
members.clear();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mdstat_line_type = MDSTAT_LT_OTHER;
|
2015-10-21 06:54:58 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
input.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Perform linear search of the cache to find the matching member.
|
|
|
|
// Returns found cache entry or not found substitute.
|
|
|
|
SWRaid_Member & SWRaid_Info::get_cache_entry_by_member( const Glib::ustring & member_path )
|
|
|
|
{
|
2016-07-04 11:40:38 -06:00
|
|
|
BlockSpecial bs = BlockSpecial( member_path );
|
2015-10-21 06:54:58 -06:00
|
|
|
for ( unsigned int i = 0 ; i < swraid_info_cache.size() ; i ++ )
|
|
|
|
{
|
2016-07-04 11:40:38 -06:00
|
|
|
if ( bs == swraid_info_cache[i].member )
|
2015-10-21 06:54:58 -06:00
|
|
|
return swraid_info_cache[i];
|
|
|
|
}
|
Parse ATARAID members from mdadm output and /proc/mdstat (#75)
Since mdadm release 3.0 (2009-06-02) [1] it has also supported external
metadata formats IMSM (Intel Matrix Storage Manager) and DDF, previously
only managed by dmraid.
A number of distributions have switched to use mdadm and kernel MD
(Multiple Devices) driver for managing these Firmware / BIOS / ATARAID
arrays. These include: Fedora >= 14 [2], RHEL / CentOS >= 6 [3],
SLES >= 12 [4], Ubuntu >= 16.04 LTS.
Therefore additionally parse members in these ATARAID arrays included in
mdadm output, and when activated using the kernel MD driver, in file
/proc/mdstat. Add fstype to the SWRaid_Info cache records to
distinguish members apart. So far the rest of the GParted code
continues to treat all members as FS_LINUX_SWRAID. This will be
resolved in following commits.
Note that this in no way affects how GParted shows and partitions the
array device itself, even those managed by dmraid and use the GParted
DMRaid module. It only affects how GParted shows the member drives
themselves.
[1] mdadm ANNOUNCE-3.0 file
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/ANNOUNCE-3.0?h=mdadm-3.0
[2] Fedora 14, Storage Administration Guide, 12.5. Linux RAID Subsystem
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/raid-subsys.html
"... Fedora 14 uses mdraid with external metadata to access ISW /
IMSM (Intel firmware RAID) sets. mdraid sets are configured and
controlled through the mdadm utility."
[3] RHEL 6, Storage Administration Guide, 17.3. Linux RAID Subsystem
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/raid-subsys
"mdraid also supports other metadata formats, known as external
metadata. Red Hat Enterprise Linux 6 uses mdraid with external
metadata to access ISW / IMSM (Intel firmware RAID) sets. mdraid
sets are configured and controlled through the mdadm utility."
[4] SUSE Linux Enterprise Server 12 Release Notes, 7.2.3 Driver for IMSM
and DDF
https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12/#fate-316007
"For IMSM and DDF RAIDs the mdadm driver is used unconditionally."
Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-11-17 03:39:02 -07:00
|
|
|
static SWRaid_Member memb = {BlockSpecial(), FS_UNKNOWN, "", "", "", false};
|
2015-10-21 06:54:58 -06:00
|
|
|
return memb;
|
2015-10-20 13:52:19 -06:00
|
|
|
}
|
|
|
|
|
2015-10-23 14:23:29 -06:00
|
|
|
// Reformat mdadm printed UUID into canonical format. Returns "" if source not correctly
|
|
|
|
// formatted.
|
|
|
|
// E.g. "15224a42:c25bbcd9:15db6000:4e5fe53a" -> "15224a42-c25b-bcd9-15db-60004e5fe53a"
|
|
|
|
Glib::ustring SWRaid_Info::mdadm_to_canonical_uuid( const Glib::ustring & mdadm_uuid )
|
|
|
|
{
|
|
|
|
Glib::ustring verified_uuid = Utils::regexp_label( mdadm_uuid,
|
|
|
|
"^([[:xdigit:]]{8}:[[:xdigit:]]{8}:[[:xdigit:]]{8}:[[:xdigit:]]{8})$" );
|
|
|
|
if ( verified_uuid.empty() )
|
|
|
|
return verified_uuid;
|
|
|
|
|
|
|
|
Glib::ustring canonical_uuid = verified_uuid.substr( 0, 8) + "-" +
|
|
|
|
verified_uuid.substr( 9, 4) + "-" +
|
|
|
|
verified_uuid.substr(13, 4) + "-" +
|
|
|
|
verified_uuid.substr(18, 4) + "-" +
|
|
|
|
verified_uuid.substr(22, 4) + verified_uuid.substr(27, 8);
|
|
|
|
return canonical_uuid;
|
|
|
|
}
|
|
|
|
|
2015-10-20 13:52:19 -06:00
|
|
|
} //GParted
|