Check the Raid installed
Type the following command under Debian / Ubuntu Linux:
See fdisk(8) man page to setup partition type. Do not format partition. Just create the same. Now, create RAID-1 as follows.
/dev/md0 /raid1 ext3 noatime,rw 0 0Save and close the file.
OR
ARRAY /dev/md0 devices=/dev/sdc1,/dev/sdd1 level=1 num-devices=2 auto=yesThis config file lists which devices may be scanned to see if they contain MD super block, and gives identifying information (e.g. UUID) about known MD arrays. Please note that Linux kernel v2.6.xx above can use both /dev/mdX or /dev/md/XX names. You can also create partitions for /dev/md/XX as /dev/md/d1/p2.
This will find out if a given device is a raid array, or is part of one, and will provide brief information about the device.
The following configuration is assumed:
In this event, the command
Please use the support request section in Robot to make contact with the technicians.
(Optional): If the partitions are not detected by the system then the partition table has to be reread from the kernel:
Adaptec hardware RAID controller
The program developed by Adaptec for the administration of the RAID controller can be found in our download area under:
The Adaptec Storage Manager is called asm and is a graphical tool.
The actual status of the RAID may be obtained by using the following command:
An example on how to set Device 0;0 on Controller 1 from "hot spare" to "ready":
The number of the RAID controller can be obtained by tw_cli show. Replace c0 with the appropriate number in the examples below.
The status of the RAID may be obtained by using the following command:
Example for RAID 1:
lspci | grep RAID
Software Raid
==============
Linux Support For Software RAID
Currently, Linux supports the following RAID levels (quoting from the man page):- LINEAR
- RAID0 (striping)
- RAID1 (mirroring)
- RAID4
- RAID5
- RAID6
- RAID10
- MULTIPATH, and FAULTY.
Install mdadm
Type the following command under RHEL / CentOS / Fedora Linux:# yum install mdadm
Type the following command under Debian / Ubuntu Linux:
# apt-get update && apt-get install mdadm
How Do I Create RAID1 Using mdadm?
Type the following command to create RAID1 using /dev/sdc1 and /dev/sdd1 (20GB size each). First run fdisk on /dev/sdc and /dev/sdd with "Software Raid" type i.e. type 0xfd:# fdisk /dev/sdc
# fdisk /dev/sdd
See fdisk(8) man page to setup partition type. Do not format partition. Just create the same. Now, create RAID-1 as follows.
If the device contains a valid md superblock, the block is overwritten with zeros:
# mdadm --zero-superblock /dev/sdc /dev/sdd
Create RAID1 using /dev/sdc1 and /dev/sdd1
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1
Format /dev/md0 as ext3:
# mkfs.ext3 /dev/md0
Mount /dev/md0
# mkdir /raid1
# mount /dev/md0 /raid1
# df -H
Edit /etc/fstab
Make sure RAID1 get mounted automatically. Edit /etc/fstab and append the following line:/dev/md0 /raid1 ext3 noatime,rw 0 0Save and close the file.
How Do I See RAID Array Building Progress and Current Status?
Type the following command:# watch -n 2 cat /proc/mdstat
OR
# tail -f /proc/mdstat
Update /etc/mdadm.conf File
Update or edit /etc/mdadm/mdadm.conf or /etc/mdadm.conf (distro specific location) file as follows:ARRAY /dev/md0 devices=/dev/sdc1,/dev/sdd1 level=1 num-devices=2 auto=yesThis config file lists which devices may be scanned to see if they contain MD super block, and gives identifying information (e.g. UUID) about known MD arrays. Please note that Linux kernel v2.6.xx above can use both /dev/mdX or /dev/md/XX names. You can also create partitions for /dev/md/XX as /dev/md/d1/p2.
How Do I Get Information On Existing Array?
Type the following command# mdadm --query /dev/md0
This will find out if a given device is a raid array, or is part of one, and will provide brief information about the device.
The following configuration is assumed:
# cat /proc/mdstat Personalities : [raid1] md3 : active raid1 sda4[0] sdb4[1] 1822442815 blocks super 1.2 [2/2] [UU] md2 : active raid1 sda3[0] sdb3[1] 1073740664 blocks super 1.2 [2/2] [UU] md1 : active raid1 sda2[0] sdb2[1] 524276 blocks super 1.2 [2/2] [UU] md0 : active raid1 sda1[0] sdb1[1] 33553336 blocks super 1.2 [2/2] [UU] unused devices:There are four partitions in total:
- /dev/md0 as swap
- /dev/md1 as /boot
- /dev/md2 as /
- /dev/md3 as /home
# cat /proc/mdstat Personalities : [raid1] md3 : active raid1 sda4[0] sdb4[1](F) 1822442815 blocks super 1.2 [2/1] [U_] md2 : active raid1 sda3[0] sdb3[1](F) 1073740664 blocks super 1.2 [2/1] [U_] md1 : active raid1 sda2[0] sdb2[1](F) 524276 blocks super 1.2 [2/1] [U_] md0 : active raid1 sda1[0] sdb1[1](F) 33553336 blocks super 1.2 [2/1] [U_] unused devices:The changes to the Software RAID can be performed while the system is running. If proc/mdstat shows that the drive is failing, like the example here, then an appointment can be made with the support technicians to replace the drive.
# cat /proc/mdstat Personalities : [raid1] md3 : active raid1 sda4[0] 1822442815 blocks super 1.2 [2/1] [U_] md2 : active raid1 sda3[0] 1073740664 blocks super 1.2 [2/1] [U_] md1 : active raid1 sda2[0] 524276 blocks super 1.2 [2/1] [U_] md0 : active raid1 sda1[0] 33553336 blocks super 1.2 [2/1] [U_] unused devices:
Removal of the defective drive
Before a new drive can be added the old defective drive needs to be removed from the RAID array. This needs to be done for each individual partition.# mdadm /dev/md0 -r /dev/sdb1 # mdadm /dev/md1 -r /dev/sdb2 # mdadm /dev/md2 -r /dev/sdb3 # mdadm /dev/md3 -r /dev/sdb4The following command shows the drives that are part of an array:
# mdadm --detail /dev/md0In some cases a drive may only be partly defective, so for example only /dev/md0 is in the [U_] state, whereas all other devices are in the [UU] state. In this case the command
# mdadm /dev/md1 -r /dev/sdb2fails, as the /dev/md1 array is ok.
In this event, the command
# mdadm --manage /dev/md1 --fail /dev/sdb2needs to be executed first, to move the RAID into [U_] status.
Arranging an appointment with support to exchange the defective drive
In order to be able to exchange the defective drive, it is necessary to arrange an appointment with support in advance. The server will need to be taken off-line for a short time.Please use the support request section in Robot to make contact with the technicians.
Preparing the new drive
Both drives in the array need to have the exact same partitioning. Depending on the partition table type used (MBR or GPT), appropriate utilities have to be used to copy the partition table. The GPT partition table is usually used in larger then 2TiB drives (e.g. 3TB HDDs in EX4 and EX6)Backing up the MBR/GPT
Before copying the MBR/GPT to a new drive it needs to be backed up. That way, if something goes wrong during the copying, the original can still be restored.Drives with GPT
There are several reduntant copies of the GUID partition table (GPT) stored on the drive, so tools that support GPT, for example parted or GPT fdisk, need to be used to edit the table. The sgdisk tool from GPT fdisk (pre-installed when using the Rescue System) can be used to easily copy the partition table to a new drive. Here's an example of copying the partition table from sda to sdb:sgdisk -R /dev/sdb /dev/sdaThe drive then needs to be assigned a new random UUID:
sgdisk -G /dev/sdbAfter this the drive can be added to the array. As a final step the bootloader needs to be installed.
Drives with MBR
The partition table can be simply copied to a new drive using sfdisk:# sfdisk -d /dev/sda | sfdisk /dev/sdbwhere /dev/sda is the source drive and /dev/sdb is the target drive.
(Optional): If the partitions are not detected by the system then the partition table has to be reread from the kernel:
# sfdisk -R /dev/sdbNaturally, the partitions may also be created manually using fdisk, cfdisk or other tools. The partitions should be Linux raid autodetect (ID fd) types.
Integration of the new drive
Once the defective drive has been removed and the new one installed, it needs to be intagrated into the RAID array. This needs to be done for each partition.# mdadm /dev/md0 -a /dev/sdb1 # mdadm /dev/md1 -a /dev/sdb2 # mdadm /dev/md2 -a /dev/sdb3 # mdadm /dev/md3 -a /dev/sdb4The new drive is now part of the array and will be synchronized. Depending on the size of the partitions this procedure can take some time. The status of the synchronization can be observed using cat /proc/mdstat.
# cat /proc/mdstat Personalities : [raid1] md3 : active raid1 sdb4[1] sda4[0] 1028096 blocks [2/2] [UU] [==========>..........] resync = 50.0% (514048/1028096) finish=97.3min speed=65787K/sec md2 : active raid1 sdb3[1] sda3[0] 208768 blocks [2/2] [UU] md1 : active raid1 sdb2[1] sda2[0] 2104448 blocks [2/2] [UU] md0 : active raid1 sdb1[1] sda1[0] 208768 blocks [2/2] [UU] unused devices:
Bootloader installation
If you are doing this repair in a booted system, then for GRUB2 running grub-install on the new drive is enough. For example:grub-install /dev/sdbIn GRUB1 (legacy GRUB), depending on which drive was defective, more steps might be required.
- Start the GRUB console: grub
- Specify the partition where /boot is located: root (hd0,1) (/dev/sda2 = (hd0,1))
- Install the bootloader in MBR: setup (hd0)
- For also installing the bootloader on the second drive:
- Map the second drive as hd0: device (hd0) /dev/sdb
- Repeat steps 2 and 3 exactly (don't change the commands)
- Exit the GRUB console: quit
Probing devices to guess BIOS drives. This may take a long time. GNU GRUB version 0.97 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename.] grub> device (hd0) /dev/sdb device (hd0) /dev/sdb grub> root (hd0,1) root (hd0,1) Filesystem type is ext2fs, partition type 0xfd grub> setup (hd0) setup (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 26 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+26 p (hd0,1)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded Done. grub> quit #
Rescue http://wiki.hetzner.de/index.php/Hetzner_Rescue-System/en#How_do_I_get_to_the_data_on_my_server.3F
========================================================================================
ADAPTEC
Hetzner - DokuWiki
http://download.hetzner.de/tools/Adaptec/
- The access data for this area can be found in the order completion email for your dedicated server.
- When downloading the program, please make sure you select the architecture suitable for your operating system.
The Adaptec Storage Manager is called asm and is a graphical tool.
How to read the status of the hardware-based RAID
To read the status of the Adaptec RAID Controller, the Adaptec command-line tool arcconf must be installed. This is already pre-installed in the Rescue System.The actual status of the RAID may be obtained by using the following command:
arcconf GETCONFIG 1 LDExample RAID 1:
Controllers found: 1 ---------------------------------------------------------------------- Logical device information ---------------------------------------------------------------------- Logical device number 0 Logical device name : RAID level : 1 Status of logical device : Optimal Size : 714742 MB Read-cache mode : Enabled MaxIQ preferred cache setting : Enabled MaxIQ cache setting : Disabled Write-cache mode : Enabled (write-back) Write-cache setting : Enabled (write-back) Partitioned : Yes Protected by Hot-Spare : No Bootable : Yes Failed stripes : No Power settings : Disabled -------------------------------------------------------- Logical device segment information -------------------------------------------------------- Segment 0 : Present (0,0) S13UJ1DPB05048 Segment 1 : Present (0,1) S13UJ1DQ201027The status of the drives may be obtained by using the following command:
arcconf GETCONFIG 1 PDAs this command also generates a quantity of useless information, it is advisable to filter the output, eg. using:
arcconf getconfig 1 pd|egrep "Device #|State\>|Reported Location|Reported Channel|S.M.A.R.T. warnings"
How to set up a hardware-based RAID
Regardless of whether changes to the mode of an existing RAID are required or if a new RAID (after installing a controller) is to be set up, the first thing to do is to delete the drives from their logical drives:arcconf DELETEeg:LOGICALDRIVE
arcconf DELETE 1 LOGICALDRIVE 0or all:
arcconf DELETE 1 LOGICALDRIVE ALLNow a new RAID can be set up:
arcconf CREATERAID 0 setup (maximum size, drives on Channel 0, Port 0 and 1, no confirmation):LOGICALDRIVE [Options] [Channel# ID#]
arcconf CREATE 1 LOGICALDRIVE MAX 0 0 0 0 1 nopromptRAID 1 setup (maximum size, drives on Channel 0, Port 0 and 1, no confirmation):
arcconf CREATE 1 LOGICALDRIVE MAX 1 0 0 0 1 nopromptRAID 5 setup (maximum size, drives on Channel 0, Port 0, 1 and 2, no confirmation):
arcconf CREATE 1 LOGICALDRIVE MAX 5 0 0 0 1 0 2 nopromptRAID-10 setup (maximum size, drives on Channel 0, Port 0, 1, 2 and 3, no confirmation):
arcconf CREATE 1 LOGICALDRIVE MAX 10 0 0 0 1 0 2 0 3 nopromptJBOD (single drive on Channel 0, Port 2):
arcconf CREATE 1 JBOD 0 2 noprompt
How to start a REBUILD using arcconf with a DEGRADED RAID
First, check to see if all drives are recognized:arcconf GETCONFIG 1 PDIf they are not, a manual rescan can be launched:
arcconf RESCAN 1The status of the RAID should then be shown as being degraded:
root@rescue ~ # arcconf getconfig 1 ld Controllers found: 1 ---------------------------------------------------------------------- Logical device information ---------------------------------------------------------------------- Logical device number 0 Logical device name : Device 0 RAID level : 1 Status of logical device : Degraded Size : 1428470 MB Read-cache mode : Enabled Write-cache mode : Enabled (write-back) Write-cache setting : Enabled (write-back) Partitioned : No Protected by Hot-Spare : No Bootable : Yes Failed stripes : No Power settings : Disabled -------------------------------------------------------- Logical device segment information -------------------------------------------------------- Segment 0 : Inconsistent (0,0) 9VS38R1D Segment 1 : Present (0,1) 9VS38RKENow it may be necessary to delete the metadata:
arcconf TASK START 1 DEVICE 0 0 CLEARSince "automatic failover" mode is enabled, the rebuild should have already started. If it has not, the drive is manually added to the RAID as a hot spare. The rebuild starts automatically:
arcconf SETSTATE 1 DEVICE 0 0 HSP LOGICALDRIVE 0After a RAID rebuild on a hot spare drive, the drive remains as a hot spare. After replacing the defective drive, data automatically migrates back. It is also possible to remove a hot spare designation via arcconf and to mark the new replacement drive as a new hot spare. More information on this can be found on the Adaptec website at Adaptec KB5117.
An example on how to set Device 0;0 on Controller 1 from "hot spare" to "ready":
arcconf setstate 1 device 0 0 rdy
How to read the SMART values of the drive in RAID
The sg module helps to access the physical drives behind the controller, eg. for the first drive:smartctl -d sat -a /dev/sg1Depending on the operating system, an upgrade of the smartmontools or the kernel may be necessary.
================================================
3ware hardware RAID controller
The program developed by 3ware for the administration of the RAID Controller can be found in our download area under:http://download.hetzner.de/tools/3ware/
- The access data for this area can be found in the order completion email for your dedicated server.
- When downloading the program, please make sure you select the architecture suitable for your operating system.
- For a 32-bit Linux operating system please download the following archive:
tw_cli-linux-x86-9.5.0.tgz
- For a 64-bit Linux operating system please select archive:
tw_cli-linux-x86_64-9.5.0.tgz
- After downloading, extract the archive into a directory of your choice.
http://download.hetzner.de/tools/3ware/tools/CLI/tw_cli.8.html
How to read the status of the hardware-based RAID
To read the status of the LSI RAID Controller, the 3ware tw_cli command-line tool needs to be installed. This is already pre-installed in the Rescue System.The number of the RAID controller can be obtained by tw_cli show. Replace c0 with the appropriate number in the examples below.
The status of the RAID may be obtained by using the following command:
tw_cli /c0 showExample RAID 1:
Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 OK - - - 698.637 ON - Port Status Unit Size Blocks Serial --------------------------------------------------------------- p0 OK u0 698.63 GB 1465149168 S13UJ1CQ704597 p1 OK u0 698.63 GB 1465149168 S13UJ1BQ708871
How to set up a hardware-based RAID
Regardless of whether changes to the mode of an existing RAID are required or if a new RAID (after installing a controller) is to be set up, the first thing to do is to delete the drives from their "units":tw_cli maint deleteunit c0 u0
tw_cli maint deleteunit c0 u1Setup RAID 0:
tw_cli maint createunit c0 rraid0 p0:1Setup RAID 1 (the recommended configuration with two drives):
tw_cli maint createunit c0 rraid1 p0:1Setup RAID 5 (with three drives):
tw_cli maint createunit c0 rraid5 p0:1:2Setup RAID 5 (with four drives and a starting size of 200GB):
root@rescue ~ # tw_cli
//rescue> /c0 add type=raid5 disk=0:1:2:3 v0=200
How to use the drives as JBOD
The 3ware 9650SE controller can configure the drives as JBOD. However, LSI/3ware recommends that the drives instead be configured as single drives.tw_cli /c0 show exportjbod /c0 JBOD Export Policy = off
tw_cli /c0 set exportjbod=on Enabling JBOD Export Policy on /c0... Done.
How to start a REBUILD using tw_cli with a DEGRADED RAID
First, check the status of the RAID controller (see above).Example for RAID 1:
Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 DEGRADED - - - 698.637 ON - Port Status Unit Size Blocks Serial --------------------------------------------------------------- p0 DEGRADED u0 698.63 GB 1465149168 S13UJ1KS210609 p1 OK u0 698.63 GB 1465149168 S13UJ1NQ600102The DEGRADED drives need to be deleted from the array and the controller needs to be rescanned:
tw_cli maint remove c0 p0
tw_cli maint rescan c0Now the rebuild of the array can be started:
tw_cli maint rebuild c0 u0 p0As soon as this is done the rebuild will start and the status can be queried:
tw_cli /c0 show rebuildOutput when the rebuild has been started:
Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 REBUILDING 5 - - 698.637 ON - Port Status Unit Size Blocks Serial --------------------------------------------------------------- p0 DEGRADED u0 698.63 GB 1465149168 S13UJ1KS210609 p1 OK u0 698.63 GB 1465149168 S13UJ1NQ600102If the rebuild is interrupted due to ECC errors, you can force a rebuild. This is not recommended:
tw_cli /c0/u0 start rebuild ignoreECC
Determine if a disk is SSD or HDD
cat /sys/block/sda/queue/rotational
For mega raid
storcli show
storcli /c0 show Controller = 0 Status = Success Description = None Product Name = LSI MegaRAID SAS 9260-4i Serial Number = SV20924408 SAS Address = 500605b004829a60 Mfg. Date = 03/03/12 System Time = 6/12/2015 01:16:14 Controller Time = 6/12/2015 08:15:37 FW Package Build = 12.12.0-0097 FW Version = 2.130.273-1544 BIOS Version = 3.24.00_4.12.05.00_0x05150000 Driver Name = megaraid_sas Driver Version = 06.506.00.00-rc1 Controller Bus Type = N/A PCI Slot = N/A PCI Bus Number = 18656 PCI Device Number = 0 PCI Function Number = 240 Drive Groups = 2 TOPOLOGY : ======== ------------------------------------------------------------------------ DG Arr Row EID:Slot DID Type State BT Size PDC PI SED DS3 FSpace ------------------------------------------------------------------------ 0 - - - - RAID1 Optl N 931.0 GB dflt N N none N 0 0 - - - RAID1 Optl N 931.0 GB dflt N N none N 0 0 0 252:0 5 DRIVE Onln N 931.0 GB dflt N N none - 0 0 1 252:1 6 DRIVE Onln N 931.0 GB dflt N N none - 1 - - - - RAID0 Optl N 931.0 GB dflt N N none N 1 0 - - - RAID0 Optl N 931.0 GB dflt N N none N 1 0 0 252:2 4 DRIVE Onln N 931.0 GB dflt N N none - ------------------------------------------------------------------------ UID=Unique Identification Number | DG=Disk Group Index Arr=Array Index|Row=Row Index|EID=Enclosure Device ID DID=Device ID|Type=Drive Type|BT=Background Task Active|PDC=PD Cache PI=Protection Info|SED=Self Encrypting Drive|DS3=Dimmer Switch 3 FSpace=Free Space Present|dflt=Default|Msng=Missing|Frgn=Foreign Virtual Drives = 2 VD LIST : ======= --------------------------------------------------------- DG/VD TYPE State Access Consist Cache sCC Size Name --------------------------------------------------------- 0/0 RAID1 Optl RW Yes RWTD - 931.0 GB 1/1 RAID0 Optl RW Yes RWTD - 931.0 GB --------------------------------------------------------- Cac=CacheCade|Rec=Recovery|OfLn=OffLine|Pdgd=Partially Degraded|Dgrd=Degraded Optl=Optimal|RO=Read Only|RW=Read Write|B=Blocked|Consist=Consistent| R=Read Ahead Always|NR=No Read Ahead|WB=WriteBack|AWB=Always WriteBack| WT=WriteThrough|C=Cached IO|D=Direct IO|sCC=Scheduled Check Consistency Physical Drives = 3 PD LIST : ======= --------------------------------------------------------------------------- EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp --------------------------------------------------------------------------- 252:0 5 Onln 0 931.0 GB SATA HDD N N 512B ST1000DM003-9YN162 U 252:1 6 Onln 0 931.0 GB SATA HDD N N 512B ST1000DM003-9YN162 U 252:2 4 Onln 1 931.0 GB SATA HDD N N 512B WDC WD10EZRX-00A8LB0 U --------------------------------------------------------------------------- EID-Enclosure Device ID|Slt-Slot No.|DID-Device ID|DG-Drive Group| Intf-Interface|Med-Media Type|SED-Self Encryptive Drive|PI-Protection Info| SeSz-Sector Size|Sp-Spun|U-Up|D-Down|T-Transition|UGood-Unconfigured Good|UBad-Unconfigured Bad|Offln-Offline|Onln-Online|Rbld-Rebuild|Cpybck-Copyback|GHS-Global Hot Spare|DHS-Dedicated Hot Spare
Comments
Post a Comment