将 Raid 1 升级到 Raid 0+1 和引导加载程序问题

将 Raid 1 升级到 Raid 0+1 和引导加载程序问题

我正在尝试将当前的 RAID 1 转换为 RAID0+1,但在安装引导加载程序时遇到问题 - 请看一下我在做什么。

我当前的配置是RAID1(2*10GB):

[root@localhost ~]# mdadm --detail /dev/md0

/dev/md0:

    Version : 1.0
 Creation Time : Thu May  8 20:13:26 2014
 Raid Level : raid1
 Array Size : 10279808 (9.80 GiB 10.53 GB)
Used Dev Size : 10279808 (9.80 GiB 10.53 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Wed May 14 21:49:34 2014
      State : active
  Active Devices : 2
 Working Devices : 2
  Failed Devices : 0
 Spare Devices : 0

       Name : livecd.centos:0
       UUID : 877ab4b2:7d4a61f7:a732e1c0:115c9ee5
     Events : 72

Number   Major   Minor   RaidDevice State
   0       8        2        0      active sync   /dev/sda2
   1       8       18        1      active sync   /dev/sdb2

现在我在我的虚拟机中添加了 2 * 2GB 驱动器 - 在我降级我的 RAID1 之后;使用故障驱动器和新驱动器我创建了 raid0:

[root@localhost ~]# mdadm /dev/md0 -f /dev/sdb2 -r /dev/sdb2

     mdadm: set /dev/sdb2 faulty in /dev/md0
     mdadm: hot removed /dev/sdb2 from /dev/md0

[root@localhost ~]# fdisk /dev/sdc

     WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
     switch off the mode (command 'c') and change display units to
     sectors (command 'u').

   Command (m for help): n
   Command action
   e   extended
   p   primary partition (1-4)
   p
   Partition number (1-4): 2
   First cylinder (1-261, default 1):
   Using default value 1
   Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):
   Using default value 261

   Command (m for help): t
   Selected partition 2
   Hex code (type L to list codes): fd
   Changed system type of partition 2 to fd (Linux raid autodetect)

   Command (m for help): wq
   The partition table has been altered!

   Calling ioctl() to re-read partition table.
   Syncing disks.

[root@localhost ~]# mkfs.ext4 /dev/sdc2

   mke2fs 1.41.12 (17-May-2010)
   Filesystem label=
   OS type: Linux
   Block size=4096 (log=2)
   Fragment size=4096 (log=2)
   Stride=0 blocks, Stripe width=0 blocks
   131072 inodes, 524112 blocks
   26205 blocks (5.00%) reserved for the super user
   First data block=0
   Maximum filesystem blocks=536870912
   16 block groups
   32768 blocks per group, 32768 fragments per group
   8192 inodes per group
   Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912

   Writing inode tables: done
   Creating journal (8192 blocks): done
   Writing superblocks and filesystem accounting information: done

   This filesystem will be automatically checked every 38 mounts or
   180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@localhost ~]# mdadm --zero-superblock /dev/sdb2

构建 RAID0,以便我可以成为 RAID1 的一部分

[root@localhost ~]# mdadm --create /dev/md5 --name=5 --homehost=livecd.centos -l 0 -n 2 /dev/sdb2 /dev/sdc2

   mdadm: /dev/sdb2 appears to contain an ext2fs file system
       size=10279808K  mtime=Wed May 14 21:28:53 2014
   mdadm: /dev/sdc2 appears to contain an ext2fs file system
       size=2096448K  mtime=Thu Jan  1 04:00:00 1970
   Continue creating array? y
   mdadm: Defaulting to version 1.2 metadata
   mdadm: array /dev/md5 started.

[root@localhost ~]# cat /proc/mdstat

  Personalities : [raid0] [raid1]
  md5 : active raid0 sdc2[1] sdb2[0]
        12375552 blocks super 1.2 512k chunks

  md0 : active raid1 sda2[0]
        10279808 blocks super 1.0 [2/1] [U_]
        bitmap: 1/1 pages [4KB], 65536KB chunk

  md1 : active raid0 sdb1[1] sda1[0]
        408576 blocks super 1.1 512k chunks

  unused devices: <none>

将 RAID0 添加到降级的 RAID1

[root@localhost ~]# mdadm --add /dev/md0 /dev/md5

mdadm:添加了/dev/md5

[root@localhost ~]# cat /proc/mdstat

  Personalities : [raid0] [raid1]
  md5 : active raid0 sdc2[1] sdb2[0]
        12375552 blocks super 1.2 512k chunks

  md0 : active raid1 md5[2] sda2[0]
        10279808 blocks super 1.0 [2/2] [UU]
        bitmap: 0/1 pages [0KB], 65536KB chunk

  md1 : active raid0 sdb1[1] sda1[0]
        408576 blocks super 1.1 512k chunks

  unused devices: <none>

[root@localhost ~]# mdadm --detail /dev/md0

  /dev/md0:
          Version : 1.0
    Creation Time : Thu May  8 20:13:26 2014
       Raid Level : raid1
       Array Size : 10279808 (9.80 GiB 10.53 GB)
    Used Dev Size : 10279808 (9.80 GiB 10.53 GB)
     Raid Devices : 2
    Total Devices : 2
      Persistence : Superblock is persistent

    Intent Bitmap : Internal

      Update Time : Wed May 14 22:13:20 2014
            State : active
   Active Devices : 2
  Working Devices : 2
   Failed Devices : 0
    Spare Devices : 0

            Name : livecd.centos:0
            UUID : 877ab4b2:7d4a61f7:a732e1c0:115c9ee5
           Events : 191

    Number   Major   Minor   RaidDevice State
      0       8        2        0      active sync   /dev/sda2
      2       9        5        1      active sync   /dev/md5

现在是时候安装引导程序了 - 这是我失败的步骤,需要您的帮助。

[root@localhost ~]# grub

   Probing devices to guess BIOS drives. This may take a long time.
   Unknown partition table signature


      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> find /boot/grub/grub.conf
   find /boot/grub/grub.conf
  (hd0,1)
  grub> device (hd1) /dev/sdb
  device (hd1) /dev/sdb
  grub> root (hd1,1)
  root (hd1,1)
  Filesystem type is ext2fs, partition type 0xfd
  grub> setup (hd1)
  setup (hd1)
  Checking if "/boot/grub/stage1" exists... no
  Checking if "/grub/stage1" exists... no

  Error 2t: Bad file or directory type
 grub>

就我而言,我应该在哪里安装引导加载程序?

md5 有 /dev/sdb2 和 /dev/sdc2,引导加载程序应该安装在哪里?

在 grub 下没有出现这些 /dev/sdb2 或 /dev/sdc2。

一旦为 raid0 安装了引导程序,我将对 /dev/sda2 重复相同的过程。

相关内容