BIOS | IA サーバの遠いご先祖に当たる IBM-PC の組み込み Firmware。電源投入で最初に動いてハードウェアを初期化し、HDD の先頭に格納されている DOS を起動する。当初は、せいぜい 数十MB の HDD から DOS を起動するためのものだったが、だましだまし拡張して 2TB のディスクまで扱えるようになった |
UEFI | BIOS を置き換えるファームウェア。当初 intel の製品 EFI。標準化されて UEFI |
以下、検証経緯
/Documents/Virtual Machines.localized/CentOS (64 ビット).vmwarevm/CentOS (64 ビット).vmx の末尾に
firmware = "efi"を追記すると、仮想マシンのファームウェアが EFI になる
$ ls -al /sys/firmware/efi
total 0
drwxr-xr-x. 5 root root 0 Jan 19 11:51 .
drwxr-xr-x. 6 root root 0 Jan 19 11:51 ..
-r--r--r--. 1 root root 4096 Jan 19 11:54 config_table
drwxr-xr-x. 2 root root 0 Jan 19 11:51 efivars
-r--r--r--. 1 root root 4096 Jan 19 11:54 fw_vendor
-r--r--r--. 1 root root 4096 Jan 19 11:54 runtime
drwxr-xr-x. 5 root root 0 Jan 19 11:54 runtime-map
-r--------. 1 root root 4096 Jan 19 11:51 systab
drwxr-xr-x. 24 root root 0 Jan 19 11:54 vars
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 18.8G 0 part
├─cl-root 253:0 0 16.8G 0 lvm /
└─cl-swap 253:1 0 2G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
$ sudo parted -l
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 211MB 210MB fat16 EFI System Partition boot
2 211MB 1285MB 1074MB xfs
3 1285MB 21.5GB 20.2GB lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/cl-swap: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 2147MB 2147MB linux-swap(v1)
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/cl-root: 18.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 18.0GB 18.0GB xfs
$ sudo parted /dev/sda unit b print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 21474836480B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1048576B 210763775B 209715200B fat16 EFI System Partition boot
2 210763776B 1284505599B 1073741824B xfs
3 1284505600B 21473787903B 20189282304B lvm
GUI インストーラーは RAID 向けにうまくパーティションを設定できないので、少なくとも /boot /boot/efi は コマンドラインで作る
# sgdisk -Z /dev/sda
# sgdisk -o /dev/sda
# sgdisk -L
ef00 | EFI System |
fd00 | Linux RAID |
8200 | Linux swap |
8e00 | Linux LVM |
+-----------+-----------+-----------+-----------+ /dev/sda |/boot/efi |/boot |swap1 |/ | | 256MB |1024MB |1024MB |18GB | +-----------+ +-----------+ | /dev/sdb |/boot/efi2 | |swap2 | | | 256MB | |1024MB | | +-----------+-----------+-----------+-----------+swap領域は、メモリ容量と同じになるようにする。合計でメモリ容量の 2 倍になる
# sgdisk -n 1::+256M -c 1:"EFI" -t 1:ef00 /dev/sda # sgdisk -n 2::+1024M -c 2:"BOOTFS" -t 2:fd00 /dev/sda # sgdisk -n 3::+1024M -c 3:"SWAP" -t 3:8200 /dev/sda # sgdisk -p /dev/sda
# sgdisk -R /dev/sdb /dev/sda # sgdisk -G /dev/sdb
$ sudo sgdisk -p /dev/sda Disk /dev/sda: 41943040 sectors, 20.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): 71F73A8F-4BF8-48E9-A317-A557F6A8C4B9 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 41943006 Partitions will be aligned on 2048-sector boundaries Total free space is 4029 sectors (2.0 MiB) Number Start (sector) End (sector) Size Code Name 1 2048 526335 256.0 MiB EF00 EFI System Partition 2 526336 2623487 1024.0 MiB FD00 BOOTFS 3 2623488 4720639 1024.0 MiB 8200 SWAP
$ sudo sgdisk -p /dev/sdb Disk /dev/sdb: 41943040 sectors, 20.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): 1646BF39-D3C2-4716-8411-8CAE32701446 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 41943006 Partitions will be aligned on 2048-sector boundaries Total free space is 4029 sectors (2.0 MiB) Number Start (sector) End (sector) Size Code Name 1 2048 526335 256.0 MiB EF00 EFI 2 526336 2623487 1024.0 MiB FD00 BOOTFS 3 2623488 4720639 1024.0 MiB 8200 SWAP
# reboot
現時点のディスク構成は、
1 2 3 4 +-----------+-----------+-----------+-----------+ /dev/sda |/boot/efi |/boot |swap1 |/ | | 256MB |1024MB |1024MB |18GB | +-----------+-----------+-----------+ | /dev/sdb |/boot/efi2 |/boot2 |swap2 | | | 256MB |1024MB |1024MB | | +-----------+-----------+-----------+-----------+ /dev/md/root
これを次のようにする
1 2 3 4 +-----------+-----------+-----------+-----------+ /dev/sda |/boot/efi |/boot |swap1 |/ | | 256MB |1024MB |1024MB |18GB | +-----------+ +-----------+ | /dev/sdb |/boot/efi2 | |swap2 | | | 256MB | |1024MB | | +-----------+-----------+-----------+-----------+ /dev/md/boot /dev/md/root
# umount /dev/sdb2 # rm -rf /boot2 # mdadm --create /dev/md/boot --level=1 --raid-devices=2 missing /dev/sdb2
# mkfs.xfs -f /dev/md/boot
# mdadm --examine --scan | grep "/dev/md/boot" >> /etc/mdadm.conf # cat /etc/mdadm.conf MAILADDR root AUTO +imsm +1.x -all ARRAY /dev/md/root level=raid1 num-devices=2 UUID=38a426a2:28d7f0c4:1a7a8885:9046ce52 ARRAY /dev/md/boot metadata=1.2 UUID=010cc6d9:d9013ef7:f129727f:5c13d628 name=localhost.localdomain:boot
# mount /dev/md/boot /mnt # cd /boot # cp -av ./ /mnt
# umount /boot/efi # umount /boot/efi2 # umount /boot # mdadm /dev/md/boot --add /dev/sda2 mdadm: added /dev/sda2 # mdadm --detail /dev/md/boot
# blkid /dev/md/root /dev/md/root: UUID="a98e4af5-4bdd-41d6-8b5e-2ae3e7b2c126" TYPE="xfs" # blkid /dev/md/boot /dev/md/boot: UUID="3ae4266f-2a5d-4dc6-a592-7e40574f8908" TYPE="xfs"
UUID=a98e4af5-4bdd-41d6-8b5e-2ae3e7b2c126 / xfs defaults 0 0
UUID=966d9a45-09bc-4d67-be43-bcb0dd39cfd4 /boot xfs defaults 0 0
UUID=6C13-A4A6 /boot/efi vfat umask=0077,shortname=winnt 0 0
UUID=6C15-E205 /boot/efi2 vfat umask=0077,shortname=winnt 0 0
UUID=bd2d4a6f-2ced-46ce-a4b5-f10f4242ee74 /boot2 xfs defaults 0 0
UUID=855779cc-fdf1-4870-aaa1-8a247f7d5ebb swap swap defaults 0 0
UUID=5f577996-e4ec-4bab-a4b6-d38f5b8a9926 swap swap defaults
UUID=a98e4af5-4bdd-41d6-8b5e-2ae3e7b2c126 / xfs defaults 0 0
UUID=3ae4266f-2a5d-4dc6-a592-7e40574f8908 /boot xfs defaults 0 0
UUID=6C13-A4A6 /boot/efi vfat umask=0077,shortname=winnt 0 0
UUID=6C15-E205 /boot/efi2 vfat umask=0077,shortname=winnt 0 0
UUID=855779cc-fdf1-4870-aaa1-8a247f7d5ebb swap swap defaults 0 0
UUID=5f577996-e4ec-4bab-a4b6-d38f5b8a9926 swap swap defaults
# cd / # umount /mnt # mount /boot # mount /boot/efi
# cd /boot # mv initramfs-3.10.0-514.el7.x86_64.img initramfs-3.10.0-514.el7.x86_64.img.bak # dracut
# mdadm --detail /dev/md/root | grep UUID UUID : 38a426a2:28d7f0c4:1a7a8885:9046ce52 # mdadm --detail /dev/md/boot | grep UUID UUID : 010cc6d9:d9013ef7:f129727f:5c13d628
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.md.uuid=38a426a2:28d7f0c4:1a7a8885:9046ce52 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
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.md.uuid=010cc6d9:d9013ef7:f129727f:5c13d628 rd.md.uuid=38a426a2:28d7f0c4:1a7a8885:9046ce52 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
# cp -a /boot/efi/EFI/centos/grub.cfg /boot/efi/EFI/centos/grub.cfg.orig # grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
# shutdown -r now
# dd if=/dev/sda1 of=/dev/sdb1 524288+0 records in 524288+0 records out 268435456 bytes (268 MB) copied, 1.60794 s, 167 MB/s※ cp でもよい
# cp -a /dev/sda1 /dev/sdb1 cp: overwrite ‘/dev/sdb1’? yes
# blkid /dev/sd[ab]1 /dev/sda1: SEC_TYPE="msdos" UUID="6C13-A4A6" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0624d820-b195-4622-8ade-5e5eff3ee6ae" /dev/sdb1: SEC_TYPE="msdos" UUID="6C13-A4A6" TYPE="vfat" PARTLABEL="EFI" PARTUUID="c91b63dc-1195-4447-bc52-e04a331ddbd8"
UUID=a98e4af5-4bdd-41d6-8b5e-2ae3e7b2c126 / xfs defaults 0 0
UUID=3ae4266f-2a5d-4dc6-a592-7e40574f8908 /boot xfs defaults 0 0
PARTUUID="0624d820-b195-4622-8ade-5e5eff3ee6ae" /boot/efi vfat umask=0077,shortname=winnt 0 0
PARTUUID="c91b63dc-1195-4447-bc52-e04a331ddbd8" /boot/efi2 vfat umask=0077,shortname=winnt 0 0
UUID=855779cc-fdf1-4870-aaa1-8a247f7d5ebb swap swap defaults 0 0
UUID=5f577996-e4ec-4bab-a4b6-d38f5b8a9926 swap swap defaults
# mount -a # diff -r /boot/efi /boot/efi2
# efibootmgr -v BootCurrent: 0005 BootOrder: 0005,0000,0001,0002,0003,0004 Boot0000* EFI VMware Virtual SCSI Hard Drive (0.0) ACPI(a0341d0,0)PCI(10,0)SCSI(0,0) Boot0001* EFI VMware Virtual SCSI Hard Drive (1.0) ACPI(a0341d0,0)PCI(10,0)SCSI(1,0) Boot0002* EFI VMware Virtual IDE CDROM Drive (IDE 1:0) ACPI(a0341d0,0)PCI(7,1)ATAPI(1,0,0) Boot0003* EFI Network ACPI(a0341d0,0)PCI(11,0)PCI(1,0)MAC(MAC(000c29f5aebe,0) Boot0004* EFI Internal Shell (Unsupported option) MM(b,e1a3000,e42ffff)FvFile(c57ad6b7-0515-40a8-9d21-551652854e37) Boot0005* CentOS Linux HD(1,800,80000,0624d820-b195-4622-8ade-5e5eff3ee6ae)File(\EFI\centos\shim.efi)
# efibootmgr -c -d /dev/sdb -p 1 -L "CentOS-AltDrv" -l '\EFI\centos\shim.efi' BootCurrent: 0005 BootOrder: 0006,0005,0000,0001,0002,0003,0004 Boot0000* EFI VMware Virtual SCSI Hard Drive (0.0) Boot0001* EFI VMware Virtual SCSI Hard Drive (1.0) Boot0002* EFI VMware Virtual IDE CDROM Drive (IDE 1:0) Boot0003* EFI Network Boot0004* EFI Internal Shell (Unsupported option) Boot0005* CentOS Linux Boot0006* CentOS-AltDrv
# efibootmgr --inactive --bootnum 0006 # efibootmgr --delete-bootnum --bootnum 0006
# efibootmgr --bootorder 0005,0006,0000,0001,0002,0003,0004 BootCurrent: 0005 BootOrder: 0005,0006,0000,0001,0002,0003,0004 Boot0000* EFI VMware Virtual SCSI Hard Drive (0.0) Boot0001* EFI VMware Virtual SCSI Hard Drive (1.0) Boot0002* EFI VMware Virtual IDE CDROM Drive (IDE 1:0) Boot0003* EFI Network Boot0004* EFI Internal Shell (Unsupported option) Boot0005* CentOS Linux Boot0006* CentOS-AltDrv
# shutdown -r now
# dd if=/dev/zero of=/dev/sdb
CentOS のインストール DVD からレスキューモードで復旧する必要あり
ちょっと現実的でない。やっぱり Software RAID は無理かな
特に boot 領域の冗長化はハードでやらないといけなそう
/dev/sdb の復旧も出来ないから /dev/sdb なんて無理
コマンド | UUID(ファイルシステムID) | UUID_SUB(RAID構成枝番) | PARTUUID(ディスクパーティションID) | マウント先 |
blkid /dev/sda1 | 6C13-A4A6 | 0624d820-b195-4622-8ade-5e5eff3ee6ae | /boot/efi | |
blkid /dev/sdb1 | 6C13-A4A6 (ddコマンドで/dev/sda1をコピー) | c91b63dc-1195-4447-bc52-e04a331ddbd8 | /boot/efi2 | |
blkid /dev/sda2 | 010cc6d9-d901-3ef7-f129-727f5c13d628 | e0d4391e-f9ce-e92d-ca8f-4aeae390b020 | 90bba3fa-d8ff-4303-95a4-b77cc4968b47 | RAID1(/dev/md/boot) |
blkid /dev/sdb2 | 010cc6d9-d901-3ef7-f129-727f5c13d628 | bad07b79-af39-8ad7-72cd-be420ef34cb1 | f794f6f6-04f4-4208-8234-305f48226c97 | RAID1(/dev/md/boot) |
blkid /dev/md/boot | 3ae4266f-2a5d-4dc6-a592-7e40574f8908 | /etc/fstab ファイルシステムのマウント定義にはこっちを指定 | /boot | |
mdadm --detail /dev/md/boot | 010cc6d9:d9013ef7:f129727f:5c13d628 | /etc/mdadm.conf RAID構成定義ファイルにはこっちを指定 | /boot | |
blkid /dev/sda3 | 855779cc-fdf1-4870-aaa1-8a247f7d5ebb | ddd84c28-4b74-462e-8d9e-452c91b2dd9f | swap | |
blkid /dev/sdb3 | 5f577996-e4ec-4bab-a4b6-d38f5b8a9926 | 15eb37e2-70e5-4b20-a8df-0158de0f410f | swap | |
blkid /dev/sda4 | 38a426a2-28d7-f0c4-1a7a-88859046ce52 | 2853e753-af8c-ced7-f513-031a7da50eda | 8cb47b7a-aa86-46e6-a5a7-3217f4ab1a3b | RAID1(/dev/md/root) |
blkid /dev/sdb4 | 38a426a2-28d7-f0c4-1a7a-88859046ce52 | 9cf3eded-2449-ca70-052e-7bc2c01be0fe | 573e751f-d860-431b-b2ea-7ae18001dcc5 | RAID1(/dev/md/root) |
blkid /dev/md/root | a98e4af5-4bdd-41d6-8b5e-2ae3e7b2c126 | /etc/fstab ファイルシステムのマウント定義にはこっちを指定 | /boot | |
mdadm --detail /dev/md/root | 38a426a2:28d7f0c4:1a7a8885:9046ce52 | /etc/mdadm.conf RAID構成定義ファイルにはこっちを指定 | /boot |