wiki:TipAndDoc/storage/RAID/rescue/RAID1

Version 3 (modified by mitty, 13 years ago) (diff)

--

RAID1

sample RAID1 device

  • mitty@ubuntu-haa:~$ sudo mdadm -D /dev/md0
    /dev/md0:
            Version : 00.90
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
        Persistence : Superblock is persistent
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
    
               UUID : 32578407:6f33f50b:893cf340:745f5dce (local to host ubuntu-haa)
             Events : 0.34
    
        Number   Major   Minor   RaidDevice State
           0       8       17        0      active sync   /dev/sdb1
           1       8       33        1      active sync   /dev/sdc1
    
  • mitty@ubuntu-haa:~$ sudo mdadm --stop /dev/md0
    mdadm: stopped /dev/md0
    
  • mitty@ubuntu-haa:~$ sudo mdadm -E /dev/sd[bc]1
    /dev/sdb1:
              Magic : a92b4efc
            Version : 00.90.00
               UUID : 32578407:6f33f50b:893cf340:745f5dce (local to host ubuntu-haa)
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
           Checksum : e3889399 - correct
             Events : 34
    
    
          Number   Major   Minor   RaidDevice State
    this     0       8       17        0      active sync   /dev/sdb1
    
       0     0       8       17        0      active sync   /dev/sdb1
       1     1       8       33        1      active sync   /dev/sdc1
    /dev/sdc1:
              Magic : a92b4efc
            Version : 00.90.00
               UUID : 32578407:6f33f50b:893cf340:745f5dce (local to host ubuntu-haa)
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
           Checksum : e38893ab - correct
             Events : 34
    
    
          Number   Major   Minor   RaidDevice State
    this     1       8       33        1      active sync   /dev/sdc1
    
       0     0       8       17        0      active sync   /dev/sdb1
       1     1       8       33        1      active sync   /dev/sdc1
    

rescue with Knoppix

  • root@Knoppix:~# cat /etc/knoppix-version
    5.3.1 2008-03-26
    
  • root@Knoppix:~# uname -a
    Linux Knoppix 2.6.24.4 #2 SMP PREEMPT Tue Mar 25 21:35:28 CET 2008 i686 GNU/Linux
    

devices

  • root@Knoppix:~# ls -l /dev/sd?
    brw-rw---- 1 root disk 8,   0 Mar 25  2011 /dev/sda
    brw-rw---- 1 root disk 8,  16 Mar 25  2011 /dev/sdb
    

modprobe

  • root@Knoppix:~# cat /proc/mdstat
    cat: /proc/mdstat: No such file or directory
    
  • root@Knoppix:~# modprobe md_mod
  • root@Knoppix:~# cat /proc/mdstat
    Personalities :
    unused devices: <none>
    

scan devices

  • root@Knoppix:~# mdadm -E /dev/sd* 2>/dev/null
    /dev/sda1:
              Magic : a92b4efc
            Version : 00.90.00
               UUID : 32578407:6f33f50b:893cf340:745f5dce
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
           Checksum : e3889399 - correct
             Events : 0.34
    
    
          Number   Major   Minor   RaidDevice State
    this     0       8       17        0      active sync   /dev/sdb1
    
       0     0       8       17        0      active sync   /dev/sdb1
       1     1       8       33        1      active sync   /dev/sdc1
    /dev/sdb1:
              Magic : a92b4efc
            Version : 00.90.00
               UUID : 32578407:6f33f50b:893cf340:745f5dce
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
           Checksum : e38893ab - correct
             Events : 0.34
    
    
          Number   Major   Minor   RaidDevice State
    this     1       8       33        1      active sync   /dev/sdc1
    
       0     0       8       17        0      active sync   /dev/sdb1
       1     1       8       33        1      active sync   /dev/sdc1
    
  • root@Knoppix:~# mdadm -Es
    ARRAY /dev/md0 level=raid1 num-devices=2 UUID=32578407:6f33f50b:893cf340:745f5dce
    

method 1

  • root@Knoppix:~# mdadm -A /dev/md0 -u 32578407:6f33f50b:893cf340:745f5dce
    mdadm: /dev/md0 has been started with 2 drives.
    
    • 以下のようなエラーが出た場合は、modprobe md_modし忘れている場合がある
      mdadm: error opening /dev/md0: No such device or address
      

method 2

  • root@Knoppix:~# mdadm -A /dev/md0 /dev/sd[ab]1
    mdadm: /dev/md0 has been started with 2 drives.
    

result

  • root@Knoppix:~# cat /proc/mdstat
    Personalities : [raid1]
    md0 : active raid1 sda1[0] sdb1[1]
          2047936 blocks [2/2] [UU]
    
    unused devices: <none>
    
  • root@Knoppix:~# mdadm -Ds
    ARRAY /dev/md0 level=raid1 num-devices=2 UUID=32578407:6f33f50b:893cf340:745f5dce
    
  • root@Knoppix:~# mdadm -D /dev/md0
    /dev/md0:
            Version : 00.90.03
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
        Persistence : Superblock is persistent
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
    
               UUID : 32578407:6f33f50b:893cf340:745f5dce
             Events : 0.34
    
        Number   Major   Minor   RaidDevice State
           0       8        1        0      active sync   /dev/sda1
           1       8       17        1      active sync   /dev/sdb1
    
  • root@Knoppix:~# pvdisplay -C
      PV         VG    Fmt  Attr PSize PFree
      /dev/md0   vgnfs lvm2 a-   1.94G 1.94G
    
  • root@Knoppix:~# vgdisplay -C
      VG    #PV #LV #SN Attr   VSize VFree
      vgnfs   1   0   0 wz--n- 1.94G 1.94G
    

degraded RAID1

devices

  • root@Knoppix:~# ls -l /dev/sd?
    brw-rw---- 1 root disk 8,   0 Mar 25  2011 /dev/sda
    

modprobe

  • root@Knoppix:~# cat /proc/mdstat
    cat: /proc/mdstat: No such file or directory
    
  • root@Knoppix:~# modprobe md_mod
  • root@Knoppix:~# cat /proc/mdstat
    Personalities :
    unused devices: <none>
    
  • root@Knoppix:~# mdadm -E /dev/sda1
    /dev/sda1:
              Magic : a92b4efc
            Version : 00.90.00
               UUID : 32578407:6f33f50b:893cf340:745f5dce
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean
     Active Devices : 2
    Working Devices : 2
     Failed Devices : 0
      Spare Devices : 0
           Checksum : e3889399 - correct
             Events : 0.34
    
    
          Number   Major   Minor   RaidDevice State
    this     0       8       17        0      active sync   /dev/sdb1
    
       0     0       8       17        0      active sync   /dev/sdb1
       1     1       8       33        1      active sync   /dev/sdc1
    
  • root@Knoppix:~# mdadm -Es
    ARRAY /dev/md0 level=raid1 num-devices=2 UUID=32578407:6f33f50b:893cf340:745f5dce
    

method 1

  • root@Knoppix:~# mdadm -A /dev/md0 -u 32578407:6f33f50b:893cf340:745f5dce
    mdadm: /dev/md0 has been started with 1 drive (out of 2).
    

method 2

  • root@Knoppix:~# mdadm -A /dev/md0 /dev/sda1
    mdadm: /dev/md0 has been started with 1 drive (out of 2).
    

result

  • root@Knoppix:~# cat /proc/mdstat
    Personalities : [raid1]
    md0 : active raid1 sda1[0]
          2047936 blocks [2/1] [U_]
    
    unused devices: <none>
    
  • root@Knoppix:~# mdadm -Ds
    ARRAY /dev/md0 level=raid1 num-devices=2 UUID=32578407:6f33f50b:893cf340:745f5dce
    
  • root@Knoppix:~# mdadm -D /dev/md0
    /dev/md0:
            Version : 00.90.03
      Creation Time : Thu Mar 24 17:31:36 2011
         Raid Level : raid1
         Array Size : 2047936 (2000.27 MiB 2097.09 MB)
      Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB)
       Raid Devices : 2
      Total Devices : 1
    Preferred Minor : 0
        Persistence : Superblock is persistent
    
        Update Time : Thu Mar 24 21:25:32 2011
              State : clean, degraded
     Active Devices : 1
    Working Devices : 1
     Failed Devices : 0
      Spare Devices : 0
    
               UUID : 32578407:6f33f50b:893cf340:745f5dce
             Events : 0.34
    
        Number   Major   Minor   RaidDevice State
           0       8        1        0      active sync   /dev/sda1
           1       0        0        1      removed