细节

细节

我正在努力手动配置磁盘阵列1+RAID10。我正在 OSX 11.10.3 上的 VM (VirtualBox 5.0.14 r105127) 上尝试该过程。

我采取的策略是:

我执行的完整命令集可用这里

  • 首先安装centos在第一个磁盘上/dev/sda
  • 然后将所有文件迁移到raid阵列cp -a mnt/old* mnt/new(甚至包括/boot/efi分区)
  • chroot 进入 RAID 系统
  • /etc/fstab使用正确的映射进行编辑
  • 编辑/etc/default/grub添加rd.auto=1 rd.lvm=[...] rd.md.uuid=[...]正确的值。
  • 重建initramfs dracut --mdadmconfig --fstab --add "mdraid" --add-drivers "raid1 raid10"
  • 重建grub.cfg grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
  • 将新条目添加到 EFI NVRAM 中 for i in b c d; do efibootmgr --create --disk /dev/sd$i --label "CentOS Backup - /dev/sd$i" --load "\\EFI\\centos\\grub.efi"; done
  • 得到启动失败对于所有条目。

我在这里缺少什么?


细节

有关当前状态、/dev/sda系统发出的命令的详细信息

lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE   MOUNTPOINT
sda                 8:0    0    8G  0 disk   
├─sda1              8:1    0  200M  0 part   /boot/efi
├─sda2              8:2    0  500M  0 part   /boot
└─sda3              8:3    0  7,3G  0 part   
  ├─centos-root   253:0    0  6,5G  0 lvm    /
  └─centos-swap   253:1    0  820M  0 lvm    [SWAP]
sdb                 8:16   0    8G  0 disk   
├─sdb1              8:17   0  200M  0 part   
├─sdb2              8:18   0  500M  0 part   
│ └─md125           9:125  0  500M  0 raid1  
├─sdb3              8:19   0  3,2G  0 part   
│ └─md126           9:126  0  3,2G  0 raid1  
│   ├─vgroot-swap 253:3    0    1G  0 lvm    
│   └─vgroot-root 253:4    0  2,2G  0 lvm    /mnt/raidsys
└─sdb4              8:20   0  4,1G  0 part   
  └─md127           9:127  0  8,2G  0 raid10 
    └─vghome-home 253:2    0  8,2G  0 lvm    
sdc                 8:32   0    8G  0 disk   
├─sdc1              8:33   0  200M  0 part   
├─sdc2              8:34   0  500M  0 part   
│ └─md125           9:125  0  500M  0 raid1  
├─sdc3              8:35   0  3,2G  0 part   
│ └─md126           9:126  0  3,2G  0 raid1  
│   ├─vgroot-swap 253:3    0    1G  0 lvm    
│   └─vgroot-root 253:4    0  2,2G  0 lvm    /mnt/raidsys
└─sdc4              8:36   0  4,1G  0 part   
  └─md127           9:127  0  8,2G  0 raid10 
    └─vghome-home 253:2    0  8,2G  0 lvm    
sdd                 8:48   0    8G  0 disk   
├─sdd1              8:49   0  200M  0 part   
├─sdd2              8:50   0  500M  0 part   
│ └─md125           9:125  0  500M  0 raid1  
├─sdd3              8:51   0  3,2G  0 part   
│ └─md126           9:126  0  3,2G  0 raid1  
│   ├─vgroot-swap 253:3    0    1G  0 lvm    
│   └─vgroot-root 253:4    0  2,2G  0 lvm    /mnt/raidsys
└─sdd4              8:52   0  4,1G  0 part   
  └─md127           9:127  0  8,2G  0 raid10 
    └─vghome-home 253:2    0  8,2G  0 lvm    
sr0                11:0    1 56,3M  0 rom   

袭击

mdadm --examine --scan --verbose

ARRAY /dev/md/boot  level=raid1 metadata=1.0 num-devices=4 UUID=1f726cc3:387c49c3:3cee8230:f11a4640 name=localhost:boot
   devices=/dev/sdd2,/dev/sdc2,/dev/sdb2
ARRAY /dev/md/root  level=raid1 metadata=1.2 num-devices=4 UUID=fea6baab:29711848:997387aa:295ec48f name=localhost:root
   devices=/dev/sdd3,/dev/sdc3,/dev/sdb3
ARRAY /dev/md/home  level=raid10 metadata=1.2 num-devices=4 UUID=edf6287a:ba1236a6:2a3471d2:edac85cb name=localhost:home
   devices=/dev/sdd4,/dev/sdc4,/dev/sdb4

左心室容量

vgs
  VG     #PV #LV #SN Attr   VSize VFree 
  centos   1   2   0 wz--n- 7,31g 40,00m
  vghome   1   1   0 wz--n- 8,18g     0 
  vgroot   1   2   0 wz--n- 3,22g     0 
lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao----   6,47g                                                    
  swap centos -wi-ao---- 820,00m                                                    
  home vghome -wi-a-----   8,18g                                                    
  root vgroot -wi-a-----   2,22g                                                    
  swap vgroot -wi-a-----   1,00g 

blkid

/dev/block/8:1: SEC_TYPE="msdos" UUID="1E4D-DBA3" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="b5c88e63-06fa-4f20-8cb9-9bad8b5c79fc" 
/dev/block/253:1: UUID="b9c3c080-76d4-44e2-a0b6-3260193d6345" TYPE="swap" 
/dev/sr0: UUID="2016-01-19-16-46-09-00" LABEL="VBOXADDITIONS_5.0.14_105127" TYPE="iso9660" 
/dev/sdb1: SEC_TYPE="msdos" UUID="CEE8-7E69" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="2a458d61-6959-4ec3-a283-1c4d1f76f69d" 
/dev/sdb2: UUID="1f726cc3-387c-49c3-3cee-8230f11a4640" UUID_SUB="349956d0-e1e9-dcb4-1054-ab700cc64004" LABEL="localhost:boot" TYPE="linux_raid_member" PARTUUID="5cca664e-0cad-44c6-8165-d7a77745f45a" 
/dev/sdb3: UUID="fea6baab-2971-1848-9973-87aa295ec48f" UUID_SUB="07be5c6b-3d27-daad-85ea-a6c6e78fd22a" LABEL="localhost:root" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="ae26fa90-9493-4984-a44e-2892ef11604a" 
/dev/sdb4: UUID="edf6287a-ba12-36a6-2a34-71d2edac85cb" UUID_SUB="d04ed8bb-c427-ad9e-3b0f-3186cf38c17e" LABEL="localhost:home" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="a4ddae48-2c8e-427d-80ec-3c856e80c752" 
/dev/sdc1: SEC_TYPE="msdos" UUID="EE8B-2290" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="bd520660-8448-4bda-9a10-0f03d90468eb" 
/dev/sdc2: UUID="1f726cc3-387c-49c3-3cee-8230f11a4640" UUID_SUB="4ea6709b-1c30-8476-063a-147c8230fa5c" LABEL="localhost:boot" TYPE="linux_raid_member" PARTUUID="1c5f95bb-e4a3-4438-a538-824b6a85176f" 
/dev/sdc3: UUID="fea6baab-2971-1848-9973-87aa295ec48f" UUID_SUB="18d60a38-6306-6f0b-2aad-f5b2fe3dfba1" LABEL="localhost:root" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="1d775697-113c-4bf4-bfec-6f5768b6a0fb" 
/dev/sdc4: UUID="edf6287a-ba12-36a6-2a34-71d2edac85cb" UUID_SUB="7454fefb-3217-16ad-9334-f36db6ab2038" LABEL="localhost:home" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="5f0f489b-60ff-4958-a24c-ad05e9c8e840" 
/dev/sdd1: SEC_TYPE="msdos" UUID="EFF5-FDC4" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="a0670bb3-8dc4-4af9-b5d2-51609caf999a" 
/dev/sdd2: UUID="1f726cc3-387c-49c3-3cee-8230f11a4640" UUID_SUB="9508d1ed-237a-d782-ddaa-87099b90a08d" LABEL="localhost:boot" TYPE="linux_raid_member" PARTUUID="9a4abae3-0ccc-460d-9bd9-814ca391cf69" 
/dev/sdd3: UUID="fea6baab-2971-1848-9973-87aa295ec48f" UUID_SUB="dca1324c-f034-939d-923a-b3255d535781" LABEL="localhost:root" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="21a4d5f4-cbd3-4397-9fab-cf0e1c3e77e4" 
/dev/sdd4: UUID="edf6287a-ba12-36a6-2a34-71d2edac85cb" UUID_SUB="4296c7d1-620e-cfb1-1c37-220022a7f01f" LABEL="localhost:home" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="fbd7b585-bf9e-43fa-8d54-4fcb6749dfc2" 
/dev/md127: UUID="KV9voE-ps3q-BAD5-rKYS-ZZRX-0Edq-WMkR5G" TYPE="LVM2_member" 
/dev/md126: UUID="viiJV2-Uah7-DX82-oiGJ-jBDz-wCOl-TLvDK2" TYPE="LVM2_member" 
/dev/mapper/vghome-home: LABEL="Home" UUID="9e7437a7-1f40-48fd-a544-a70f4be0e52c" TYPE="xfs" 
/dev/mapper/vgroot-swap: LABEL="Swap" UUID="37cc3754-411e-4f4c-9044-e3c76d965968" TYPE="swap" 
/dev/mapper/vgroot-root: LABEL="Root" UUID="82ff7a16-6e1d-4c29-930d-055db267aaa8" TYPE="xfs" 
/dev/md125: LABEL="Boot" UUID="25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1" TYPE="xfs" 

/etc/fstab

mount /dev/vgroot/root /mnt/raidsys
cat /mnt/raidsys/etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Feb 27 23:23:36 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
#/dev/mapper/centos-root /                       xfs     defaults        0 0
#UUID=1c8085bb-a226-4435-8e6f-0953025f6f1a /boot                   xfs     defaults        0 0
#UUID=1E4D-DBA3          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
#/dev/mapper/centos-swap swap                    swap    defaults        0 0
########################
/dev/mapper/vgroot-root /         xfs   defaults   0 0
UUID=25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1 /boot         xfs   0 0
UUID=CEE8-7E69      /boot/efi      vfat   umask=0077,shortname=winnt 0 0
/dev/mapper/vgroot-swap swap         swap   defaults   0 0

/etc/默认/grub

cat /mnt/raidsys/etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.auto=1 rd.lvm.lv=vgroot/root rd.md.uuid=fea6baab:29711848:997387aa:295ec48f rd.md.uuid=1f726cc3:387c49c3:3cee8230:f11a4640 rd.lvm.lv=vgroot/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Initramfs检查

mount /dev/md125 /mnt/raidboot
lsinitrd /mnt/raidboot/initramfs-3.10.0-327.el7.x86_64.img | grep raid* | xclip -selection clipboard
Image: /mnt/raidboot/initramfs-3.10.0-327.el7.x86_64.img: 19M
mdraid
-r-xr-xr-x   1 root     root        11264 Feb 28 01:00 usr/lib64/device-mapper/libdevmapper-event-lvm2raid.so
lrwxrwxrwx   1 root     root           44 Feb 28 01:00 usr/lib64/libdevmapper-event-lvm2raid.so -> device-mapper/libdevmapper-event-lvm2raid.so
-rwxr-xr-x   1 root     root          265 Sep 12  2013 usr/lib/dracut/hooks/cleanup/99-mdraid-needshutdown.sh
-rwxr-xr-x   1 root     root          910 Sep 12  2013 usr/lib/dracut/hooks/pre-mount/10-mdraid-waitclean.sh
-rw-r--r--   1 root     root        15037 Nov 19 23:51 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/crypto/async_tx/async_raid6_recov.ko
-rw-r--r--   1 root     root        26061 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid0.ko
-rw-r--r--   1 root     root        79765 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid10.ko
-rw-r--r--   1 root     root        62645 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid1.ko
-rw-r--r--   1 root     root       168581 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid456.ko
drwxr-xr-x   2 root     root            0 Feb 28 01:00 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/lib/raid6
-rw-r--r--   1 root     root       101965 Nov 19 23:53 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/lib/raid6/raid6_pq.ko
-rw-r--r--   1 root     root         2138 Nov 20 21:14 usr/lib/udev/rules.d/63-md-raid-arrays.rules
-rwxr-xr-x   1 root     root          708 Sep 12  2013 usr/sbin/mdraid-cleanup
-rwxr-xr-x   1 root     root         1074 Sep 12  2013 usr/sbin/mdraid_start

grub配置文件

mount /dev/sdb1 /mnt/raidboot/efi
ls -al /mnt/raidboot/efi/EFI/centos
totale 5792
drwxr-xr-x. 3 root root    4096 28 feb 01.00 .
drwxr-xr-x. 4 root root    4096 27 feb 23.28 ..
-rwxr-xr-x. 1 root root     128  7 dic 14.19 BOOT.CSV
drwxr-xr-x. 2 root root    4096 28 feb 00.54 fonts
-rwxr-xr-x. 1 root root 1009536 24 nov 16.49 gcdx64.efi
-rwxr-xr-x. 1 root root    7038 28 feb 01.00 grub.cfg
-rwxr-xr-x. 1 root root    1024 27 feb 23.34 grubenv
-rwxr-xr-x. 1 root root 1009536 24 nov 16.49 grubx64.efi
-rwxr-xr-x. 1 root root 1283952  7 dic 14.19 MokManager.efi
-rwxr-xr-x. 1 root root 1291512  7 dic 14.19 shim-centos.efi
-rwxr-xr-x. 1 root root 1296176  7 dic 14.19 shim.efi

cat /mnt/raidboot/efi/EFI/centos/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/00_tuned ###
set tuned_params=""
### END /etc/grub.d/00_tuned ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n ${GRUB2_PASSWORD} ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-82ff7a16-6e1d-4c29-930d-055db267aaa8' {
   load_video
   set gfxpayload=keep
   insmod gzio
   insmod part_gpt
   insmod part_gpt
   insmod part_gpt
   insmod diskfilter
   insmod mdraid1x
   insmod xfs
   set root='mduuid/1f726cc3387c49c33cee8230f11a4640'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint='mduuid/1f726cc3387c49c33cee8230f11a4640'  25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   else
     search --no-floppy --fs-uuid --set=root 25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   fi
   linuxefi /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/vgroot-root ro crashkernel=auto rd.auto=1 rd.lvm.lv=vgroot/root rd.md.uuid=fea6baab:29711848:997387aa:295ec48f rd.md.uuid=1f726cc3:387c49c3:3cee8230:f11a4640 rd.lvm.lv=vgroot/swap rhgb quiet 
   initrdefi /initramfs-3.10.0-327.el7.x86_64.img
}
menuentry 'CentOS Linux (0-rescue-26d51bbb9d054b0a8566525e1d8f3937) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-26d51bbb9d054b0a8566525e1d8f3937-advanced-82ff7a16-6e1d-4c29-930d-055db267aaa8' {
   load_video
   insmod gzio
   insmod part_gpt
   insmod part_gpt
   insmod part_gpt
   insmod diskfilter
   insmod mdraid1x
   insmod xfs
   set root='mduuid/1f726cc3387c49c33cee8230f11a4640'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint='mduuid/1f726cc3387c49c33cee8230f11a4640'  25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   else
     search --no-floppy --fs-uuid --set=root 25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   fi
   linuxefi /vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937 root=/dev/mapper/vgroot-root ro crashkernel=auto rd.auto=1 rd.lvm.lv=vgroot/root rd.md.uuid=fea6baab:29711848:997387aa:295ec48f rd.md.uuid=1f726cc3:387c49c3:3cee8230:f11a4640 rd.lvm.lv=vgroot/swap rhgb quiet 
   initrdefi /initramfs-0-rescue-26d51bbb9d054b0a8566525e1d8f3937.img
}
if [ "x$default" = 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' ]; then default='Advanced options for CentOS Linux>CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)'; fi;
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
   insmod part_gpt
   insmod xfs
   set root='hd0,gpt2'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1c8085bb-a226-4435-8e6f-0953025f6f1a
   else
     search --no-floppy --fs-uuid --set=root 1c8085bb-a226-4435-8e6f-0953025f6f1a
   fi
   linux /vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937 root=/dev/dm-5
   initrd /initramfs-0-rescue-26d51bbb9d054b0a8566525e1d8f3937.img
}
submenu 'Advanced options for CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' $menuentry_id_option 'osprober-gnulinux-advanced-3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
   menuentry 'CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937--3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
      insmod part_gpt
      insmod xfs
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1c8085bb-a226-4435-8e6f-0953025f6f1a
      else
        search --no-floppy --fs-uuid --set=root 1c8085bb-a226-4435-8e6f-0953025f6f1a
      fi
      linux /vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937 root=/dev/dm-5
      initrd /initramfs-0-rescue-26d51bbb9d054b0a8566525e1d8f3937.img
   }
   menuentry 'CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.10.0-327.el7.x86_64--3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
      insmod part_gpt
      insmod xfs
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1c8085bb-a226-4435-8e6f-0953025f6f1a
      else
        search --no-floppy --fs-uuid --set=root 1c8085bb-a226-4435-8e6f-0953025f6f1a
      fi
      linux /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/dm-5
      initrd /initramfs-3.10.0-327.el7.x86_64.img
   }
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

EFI启动列表

efibootmgr -v
BootCurrent: 0001
BootOrder: 0004,0003,0000,0001,0002
Boot0000* EFI DVD/CDROM   ACPI(a0341d0,0)PCI(d,0)SATA(0,0,0)
Boot0001* EFI Hard Drive   ACPI(a0341d0,0)PCI(d,0)SATA(1,0,0)
Boot0002* EFI Internal Shell   MM(b,3fc4f000,3ffbefff)FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
Boot0003* CentOS Linux   HD(1,800,64000,b5c88e63-06fa-4f20-8cb9-9bad8b5c79fc)File(\EFI\centos\shim.efi)
Boot0004* CentOS Raid   HD(1,800,64000,2a458d61-6959-4ec3-a283-1c4d1f76f69d)File(\EFI\centos\shim.efi)

答案1

如果我给你我的 {Centos,alma,Rock,Oracle}linux8 实时软件突袭安装的收据会有帮助吗

步骤1)从ISO安装Almalinux

安装在磁盘 /dev/sda 上

步骤2)升级到最新的软件包

dnf upgrade
dnf install vim 

(以避免 vi 出现问题)

步骤 3) 安装 Raid 软件包

dnf install mdadm

步骤 4)现在我们需要将分区表从 sda 复制到 sdb

sgdisk -R /dev/sdb /dev/sda
sgdisk -G /dev/sdb

步骤 5) 将 /dev/sdb 上的分区转换为 RAID 磁盘

sgdisk -t 1:fd00 -t 2:fd00 -t 3:fd00 /dev/sdb

步骤 6) 初始化 RAID

mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1 --metadata=0.90
mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb2 --metadata=0.90
mdadm --create /dev/md2 --level=1 --raid-disks=2 missing /dev/sdb3

步骤 7) 将 /boot 复制到 /dev/md0

mkfs.vfat /dev/md0
mkfs.xfs /dev/md1

mkdir /mnt/md1

mount /dev/md1 /mnt/md1
mkdir /mnt/md1/efi

mount /dev/md0 /mnt/md1/efi

rsync -av /boot/. /mnt/md1

现在我们需要编辑 /etc/fstab 文件。在包含 UUID 的行中

前任。 UUID=c8ac59b8-ce54-4fca-8107-1b04aaa0194d /boot ext3 defaults 0 1 我们用 /dev/md1 替换 UUID 部分或设置正确的 UUID (使用 blkid)

/dev/md1 /boot      xfs   defaults 0 1
/dev/md0 /boot/efi  vfat  umask=0077,shortname=winnt 0 2

echo raid1 >> /etc/modules-load.d/raid.conf 

cat /etc/modules-load.d/raid.conf 
raid1

dnf reinstal kernel-<current>
dracut -f 

步骤8)重新启动系统

shutdown -r now

重启后我们可以查看命令的结果:

mount | grep boot

它必须显示类似于此的一行:

/dev/md0 on /boot type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)

现在我们可以告诉 GRUB 我们需要 /dev/md0 的 root 权限

echo 'GRUB_PRELOAD_MODULES="raid dmraid"' >> /etc/default/grub

现在编辑/etc/default/grub在 GRUB_CMDLINE_LINUX 中添加 rd.md.uuid= 并从“mdadm --detail /dev/md2”获取 /dev/md2 的 UUID

GRUB_CMDLINE_LINUX="resume=/dev/mapper/almalinux-swap rd.lvm.lv=almalinux/root rd.md.uuid=58fd9cb6:0904f51a:1d561e2a:47682614 rd.lvm.lv=almalinux/swap"

cd /etc;grub2-mkconfig -o $(readlink /etc/grub2-efi.cfg)

dnf reinstal kernel-<current>
dracut -f 

步骤 9) 将 /dev/sdaX 添加到 raid /dev/mdY

sgdisk -t 2:fd00 /dev/sda 

mdadm --add /dev/md0 /dev/sda1
mdadm --add /dev/md1 /dev/sda2

步骤 10) 将 LVM 移至 /dev/md3

安装在 /dev/sda3 上创建了一个 LVM,因此我们需要将其移动到 /dev/md2 上,然后将其从 /dev/sda3 中删除

pvcreate /dev/md2
vgextend almalinux /dev/md2

swapoff -a
lvremove /dev/almalinux/swap

pvmove /dev/sda3 /dev/md2

pvmove 步骤将需要一些时间,具体取决于 CPU 和磁盘大小,我花了几个小时

vgreduce almalinux /dev/sda3

pvremove /dev/sda3

lvcreate -l +100%VG -n swap almalinux
mkswap /dev/almalinux/swap

步骤 11) 将 /dev/sda2 添加到 raid

sgdisk -t 3:fd00 /dev/sda

mdadm --add /dev/md2 /dev/sda3

现在,执行命令

cat /proc/mdstat

我们可以看到 RAID 正在执行磁盘同步。

完成后重新启动。

相关内容