Softwarovy RAID 1 a rozbita synchronizace

Antonin Kral A.Kral na sh.cvut.cz
Pátek Prosinec 3 11:17:10 CET 1999


Stepan Marek wrote:
> 
> zdarvim vsechny.
> mam nekolik problemu se zdrcadlenymi disky. jedna se o dva scsi disky
> (sda a sdb), na kterych je nekolik zazrdcadlenych oddilu.
> 
> 1) po vypadku disku sda (zrejme spatny kontakt na kabelu) se rozpadla
> synchronizace vsech zrdcadlenych oddilu... a bohuzel uz znova nenabehla,
> a to ani po rebootu. v /proc/mdstat se pise, ze v jednotlivych raidech
> bezi pouze sdb a skutecne, data se zapisuji jen na sdb.
> 
> 2) kdyz disk sda uplne odpojim (protoze ted je stejne funkcni jenom
> sdb), po nabootovani se puvodni /dev/sdb priradi na /dev/sda a to
> zpusobi, ze system vubec nenabootuje. kernel moduly raidu hlasi neco o
> zmatenych superblocich na jednotlicych raidech, zrejme jim vadi zmena
> sdb na sda.
> 
> system je redhat 6.0 s jadrem 2.2.12. moduly pro scsi a raid jsou
> zavedeny pri bootu z initrd.
> 
> Q: jak sesynchronizovat disky? jak zabranit zmene sdb na sda?

Vicemene mate dve moznosti: bud syncnout disky pomoci utilit z
RAID-tools (k tomu slouzi ckraid) nebo raid vypnout, poresit problem
jakoby na dvou fs a zase raid pustit. 

Prikladam vytah z how-to, kde je to myslim docela podrobne popsano.

Tonda Kral

------

Q: I have a RAID-1 (mirroring) setup, and lost power while there was
disk activity. Now what do I do? 

 A: The redundancy of RAID levels is designed to protect against a disk
failure, not against a power failure. There are several ways to recover
from this situation.         
Method (1): Use the raid tools. These can be used to sync the raid
arrays. They do not fix file-system damage; after the raid arrays are
sync'ed, then the file-system still has to be fixed with fsck. Raid
arrays can be checked with ckraid /etc/raid1.conf (for RAID-1, else,
/etc/raid5.conf, etc.) Calling ckraid /etc/raid1.conf --fix will pick
one of the disks in the array (usually the first), and use that as the
master copy, and copy its blocks to the others in the mirror. To
designate which of the disks should be used as the master, you can use
the --force-source flag: for example, ckraid    /etc/raid1.conf --fix
--force-source /dev/hdc3 The ckraid command can be safely run without
the --fix option to verify the inactive RAID array without making any
changes. When you are comfortable with the proposed changes, supply the
--fix option. 
            
Method (2): Paranoid, time-consuming, not much better than the first
way. Lets assume a two-disk RAID-1 array, consisting of partitions
/dev/hda3 and /dev/hdc3. You can try the following: 1.fsck /dev/hda3 
           2.fsck /dev/hdc3 
           3.decide which of the two partitions had fewer errors, or
were more easily recovered, or recovered the data that you wanted. Pick
one, either one, to be your new ``master'' copy. Say you picked
/dev/hdc3. 
           4.dd if=/dev/hdc3 of=/dev/hda3 
           5.mkraid raid1.conf -f --only-superblock 
            Instead of the last two steps, you can instead run ckraid
/etc/raid1.conf --fix --force-source /dev/hdc3 which should be a bit
faster. 
            

Method (3): Lazy man's version of above. If you don't want to wait for
long fsck's to complete, it is perfectly fine to skip the first three
steps above, and move directly to the last two steps. Just be sure to
run fsck /dev/md0 after you are done. Method (3) is actually just method
(1) in disguise. In any case, the above steps will only sync up the raid
arrays. The file system probably needs fixing as well: for this, fsck
needs to be run on the active, unmounted md device. 

        With a three-disk RAID-1 array, there are more possibilities,
such as using two disks to ''vote'' a majority answer. Tools to automate
this do not currently (September 97) exist.


Další informace o konferenci Linux