Managing RAID on Linux - Derek Vadala [66]
-d device
Selects which block device (member disk) to query. lsraid reads the RAID superblock from the member disk.
-f
When combined with -A, displays only member disks that have failed.
-g
When combined with -A, displays only member disks that are working.
-s
When combined with -A, displays only spare disks in an array.
-l
When combined with -D, displays the superblock from any member disk that may not be consistent with the rest of the array.
-h, --help
Displays configuration flags and exits.
-V, --version
Displays the command version and exits.
Example usage
The following displays information about an md device:
# lsraid -A -a /dev/md0
[dev 9, 0] /dev/md0 \
226805E6.2D643610.E36B8421.BBD29055 online
[dev 8, 17] /dev/sdb1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 8, 33] /dev/sdc1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 8, 49] /dev/sdd1 \
226805E6.2D643610.E36B8421.BBD29055 good
The following lists information about the array of which /dev/sdb1 is a member:
# lsraid -A -d /dev/sdb1
[dev 9, 0] /dev/md0 \
226805E6.2D643610.E36B8421.BBD29055 online
[dev 8, 17] /dev/sdb1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 8, 33] /dev/sdc1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 8, 49] /dev/sdd1 \
226805E6.2D643610.E36B8421.BBD29055 good
The following uses multiple instances of -a or -d to query more than one device at a time:
# lsraid -A -a /dev/md0 -a /dev/md1
[dev 9, 0] /dev/md0 \
226805E6.2D643610.E36B8421.BBD29055 online
[dev 8, 17] /dev/sdb1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 8, 33] /dev/sdc1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 8, 49] /dev/sdd1 \
226805E6.2D643610.E36B8421.BBD29055 good
[dev 9, 1] /dev/md1 \
F12F6203.49568B65.232305F6.08909BDA online
[dev 8, 97] /dev/sdg1 \
F12F6203.49568B65.232305F6.08909BDA good
[dev 8, 113] /dev/sdh1 \
F12F6203.49568B65.232305F6.08909BDA good
lsraid with the -R option is especially useful for generating an /etc/raidtab file that might have been lost because of file corruption or user error:
# lsraid -R -a /dev/md0
# This raidtab was generated by lsraid version 0.3.0.
# It was created from a query on the following devices:
# /dev/md0
# md device [dev 9, 0] /dev/md0 queried online
raiddev /dev/md0
raid-level 0
nr-raid-disks 3
nr-spare-disks 0
persistent-superblock 1
chunk-size 64
device /dev/sdb1
raid-disk 0
device /dev/sdc1
raid-disk 1
device /dev/sdd1
raid-disk 2
The previous example works only with an online array. If the array is offline, you can combine the -R and -d options to generate an /etc/raidtab based on the RAID superblocks found on individual disks. lsraid will attempt to collate member disks so you can use multiple instances of -d to query all potential member disks, letting lsraid sort out the mess for you.
# lsraid -R -d /dev/sdb1 -d /dev/sdc1 -d /dev/sdd1 -d /dev/sde1 -d /dev/sdf1 -d /dev
/sdg1 -d /dev/sdh1
lsraid: Device "/dev/sde1" does not have a valid raid superblock
lsraid: Device "/dev/sdf1" does not have a valid raid superblock
# This raidtab was generated by lsraid version 0.3.0.
# It was created from a query on the following devices:
# /dev/sdb1
# /dev/sdc1
# /dev/sdd1
# /dev/sde1
# /dev/sdf1
# /dev/sdg1
# /dev/sdh1
# md device [dev 9, 0] /dev/md0 queried online
raiddev /dev/md0
raid-level 0
nr-raid-disks 3
nr-spare-disks 0
persistent-superblock 1
chunk-size 64
device /dev/sdb1
raid-disk 0
device /dev/sdc1
raid-disk 1
device /dev/sdd1
raid-disk 2
# md device [dev 9, 1] /dev/md1 queried online
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 64
device /dev/sdg1
raid-disk 0
device /dev/sdh1
raid-disk 1
Redirect the output of lsraid -R to create or append an /etc/raidtab file.
Name
mkraid
Synopsis
mkraid [options] mddevice
mkraid (make raid) creates a RAID device from a set of block devices. All previous data on