ブートにUUIDは嫌いだー

すごいタイトルだけど!理由はこうだ。
何をしたかと言うと、DRBDを作っているので、一つのサブホストのpacemaker(PCSD)位まで(もちろんclamd, firewall, tripwire, samba etcも設定済み)を作りこれをddでコピーするとほとんどの設定やインストールしているプログラムは引き継げる。ここで問題になるのは、hostnameとip adderssとブートするディスクのUUIDがダブっている事だ。hostnameとip adderssはコピー元のサブホストを停止したまま、コピー先のサブホストを立ち上げ、NMCLIなどで変更は出来るが、UUIDはそうはいかない、root領域なのでumount出来ないので、停止してUUIDを変更すると当たり前だがブートしない。これには随分悩んだ、サブホストなのでrootになる領域は必ず/dev/vda1になるので、これを指定したいがその方法が分からない。google先生に聞いても昔の方法である/dev/sda1等の指定方法は出て来なかった。/etc/grub.dにある10_linuxをいじくれば出きるまでは分かったが、私の拙いスクリプトのレベルでは出来なかった。その後ファイルシステムにラベルを付けそれを指定してroot領域を指定できる事が分かった。早速オフラインでルート領域にラベルを付ける。先ずはvda1を作るために
# losetup /dev/loop0 /dev/Subhost6/samba
# kpartx -a /dev/loop0
# ls -la /dev/mapper
でここにloop0p1(これがブート後のvda1)があるので
# xfs_admin -L smb6-root /dev/mapper/loop0p1
でラベルを付けて、UUIDのままブート、その後grubの編集
# gedit /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=”rhgb quiet selinux=0″
GRUB_DISABLE_RECOVERY=”true”
GRUB_ENABLE_BLSCFG=true
GRUB_DISABLE_UUID=true   これを追記
GRUB_DISABLE_LINUX_UUID=true   これを追記
GRUB_DEVICE=/dev/disk/by-label/smb6-root   これを追記
そんで
# grub2_mkconifg -o /boot/grub2/grub.cfg
でブートするroot領域を指定する。
/boot/grub2/grub.cfgは

前略
### BEGIN /etc/grub.d/10_linux ###
insmod part_msdos
insmod xfs
set root=’hd0,msdos1′
insmod part_msdos
insmod xfs
set boot=’hd0,msdos1′

# This section was generated by a script. Do not modify the generated file – all changes
# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
#
# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
# populates the boot menu. Please refer to the Boot Loader Specification documentation
# for the files format: https://systemd.io/BOOT_LOADER_SPECIFICATION/.

# The kernelopts variable should be defined in the grubenv file. But to ensure that menu
# entries populated from BootLoaderSpec files that use this variable work correctly even
# without a grubenv file, define a fallback kernelopts variable if this has not been set.
#
# The kernelopts variable in the grubenv file can be modified using the grubby tool or by
# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX
# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both
# the kernelopts variable in the grubenv file and the fallback kernelopts variable.
if [ -z “${kernelopts}” ]; then
set kernelopts=”root=/dev/disk/by-label/smb6-root ro rhgb quiet selinux=0 “
fi

insmod blscfg
blscfg
### END /etc/grub.d/10_linux ###
後略
となっており、その後オフラインでxfs_adminでloop0p1(vda1)のUUIDを変更し、再起動したがやっぱりエラーが出てブートしなかった。
未だに、解決してない。方法が解ればここに書き足します。

フジマル について

1947年生れ、東京電機大学二部電気通信工学科卒、最後はスリランカ航空で営業だったのですが2018年に㈱インパック・ジャパンに再就職。趣味:登山、スキー、車いじり、コンピューター
カテゴリー: Linux運用時のメモ パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください