0 Replies Latest reply on Dec 22, 2009 3:08 PM by moon300

    Add disk to raid1 array in imsm container with mdadm (without losing data). On 82801ER sata raid (ICH5R).




      imsm = Intel Matrix Storage Manager (called fakeraid by some)
      82801ER = Intel chipset sata raid controller
      Main question:
      I have a imsm container created with mdadm (linux). Inside it is 1 disk (sdb). I also added sdb to a raid1 array with 1 missing disk.
      How do I add a new disk (sdc) to the *same* imsm container?
      I've tried "mdadm --add /dev/md/imsm /dev/sdc", but this just seems to create a *new* imsm container.


      My goal is to recreate imsm raid1 array from 2 new disks after 1 of the original 2 disks failed. The puzzle is to see if this is possible without data loss (so without using the raid bios, because that seems to destroy all data).


      Why not just use linux software raid? I want to be able to use the disks in a dualboot configuration from the 'other' OS as well.
      Much more details below.
      I've searched a lot about this, but could find much information about imsm containers and how to practically use them.
      Hope someone with mdadm knowledge and containers and Intel Matrix Storage Manager is able to help.


      If there is another way to retain the data on sdb and rebuild the raid1 array (adding sdc), e.g. using windows, I am also interested in the solution.




      More details:
      I'm trying to build an raid1 setup with two 1.5TB disks connected to ICH5R without losing data (just to see if it can be done - all data has been backed up).
      Imagine a raid1 on ICH5R where 1 disk has failed, and you want to replace the failed disk. Then the array should rebuild without data loss. How can this be done?


      - 2 x 300GB SATA harddisks (A1 and A2) on Intel ICH5R in raid1 (under windows only)
        1 disk for OS(es) on IDE (osdisk)
      - Disk A2 failed
      - Disabled Raid in BIOS (not the 'RAID' BIOS, but the normal BIOS)
      - Bought 2 x 1.5TB SATA (B and C) harddisks
      - Took failed disk A2 out, Put disk C in
      - Installed Linux on osdisk (and left windows on it as well)
      - Copied everything from disk A1 to C
      - Took disk A1 out
      - Put disk B in, then started the quest described below


      - sdc = original 'with data', 1st partition mounted as /dwin, 2nd as /dlin
        sdb = new = empty
      - Create layout on new disk
          copy the partition information to the new disk.
          sfdisk -d /dev/sdc | sfdisk /dev/sdb
          check with fdisk -l
          (it has 2 partitions)
      - Change partition type on new disk to raid-auto-detect-linux (fd)
        fdisk /dev/sdb
        t 1 fd
        t 2 fd
      - Make sure no raid info left from earlier:
        mdadm --zero-superblock /dev/sdb1
        mdadm --zero-superblock /dev/sdb2
        (if there are no remains already you should see "mdadm: Unrecognised md component device - /dev/sdb1")
      - Create the container
        - mdadm --create /dev/md/imsm --metadata=imsm --raid-disks=2 /dev/sdb1 missing
          missing not allowed
          Whatever I try: I cannot create the container with a missing disk
        - mdadm --create /dev/md/imsm -e imsm --level=container -n 1 --force /dev/sdb
      - mdadm --create /dev/md/myraid --level raid1 -n 2 /dev/sdb missing
        - l /dev/md*
         imsm -> ../md127   = the container
         myraid -> ../md126 = the raid array with 1 missing
        - cat /proc/mdstat
          Personalities : [raid1]
          md126 : active raid1 sdb[0]
          1465136128 blocks super external:/md127/0 [2/1] [U_]
          m1d127 : inactive sdb[0](S)
          209 blocks super external:imsm
        - fdisk /dev/md126
          Device Boot      Start         End      Blocks   Id  System
          /dev/md126p1               1       89238   716800000   fd  Linux raid autodetect
          /dev/md126p2           89238      182401   748336001   fd  Linux raid autodetect
      - Create filesystem on new md126
        - mkfs.ntfs /dev/md126p1 (slow)
        - mkfs.xfs /dev/md126p2
      - Mount both partitions and copy all data from sdc to new md126 (is build from 'sdb' and 'missing')
        - mount /dev/md126p1 /mnt/win/
        - mount /dev/md126p2 /mnt/lin/
        - rsync -ax /dwin /mnt/win/
        - rsync -ax /dlin /mnt/lin
      - Add the sdc disk to the container (first unmount)
        - umount /dwin
        - umount /dlin
        - fdisk /dev/sdc
          t 1 fd
          t 2 fd
        - mdadm --add /dev/md/imsm /dev/sdc
          mdadm: added /dev/sdc
      - Check
        - cat /proc/mdstat
          Personalities : [raid1]
          md126 : active raid1 sdb[0]
                1465136128 blocks super external:/md127/0 [2/1] [U_]
          md127 : inactive sdc[1](S) sdb[0](S)
                2466 blocks super external:imsm
      - Try to add sdc to array
        - mdadm --add /dev/md/myraid /dev/sdc
          mdadm: Cannot add disks to a 'member' array, perform this operation on the parent container
        - mdadm --add /dev/md/myraid /dev/md/imsm
          mdadm: Cannot add disks to a 'member' array, perform this operation on the parent container


      Looking in the raid bios, I see:
      Raid volumes:
      ID name        level        strip    size        status        bootable
      0 myraid    raid1(mirror)    n/a    1397.2GB    Rebuild        yes
      |_samsung HD154UI ...3411    Port0    1397.2GB    Normal


      Other-RAID disks:
      Port Drive Model
         1 samsung HD154UI ...3292        1397.2GB    Unknown        no


      So - as expected: sdc is not in the same container.