본문으로 바로가기

RHEL7 KVM에서 RHEL8 KVM Image 작업방법

category Cloud/KVM 2021. 7. 15. 15:26
반응형

RHEL7에서 RHEL8 KVM Image 작업시 virt-customize 에러가 발생한다.

 

 

1. 에러

[root@rhosp-tb0-kvm iso-images]#virt-customize -a rhel-8.4-root.qcow2 --root-password password:root
[   0.0] Examining the guest ...
virt-customize: warning: mount: mount exited with status 32: mount: wrong
fs type, bad option, bad superblock on /dev/sda3,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so. (ignored)
virt-customize: warning: mount: mount: /boot/efi: mount point is not a
directory (ignored)
virt-customize: error: libguestfs error: is_dir: is_dir_stub: you must call
'mount' first to mount the root filesystem

If reporting bugs, run virt-customize with debugging enabled and include
the complete output:

  virt-customize -v -x [...]

 

 

2. 원인

이 문제는 RHEL7과 RHEL8 간의 xfs 파일 시스템의 호환성으로 인해 발생한다.

RHEL8의 xfs 파일 시스템은 reflink 및 sparse 파일을 사용하지만 RHEL7 커널은 이를 이해하지 못하고 마운트를 거부한다고한다.

본래 가이드 방법은 RHEL8 KVM에서 RHEL8 KVM Image작업을 권고한다. 아래 방법은 공식적으로 지원하지 않는 workaround 방법이다. 

 

 

3. 해결방법 (workaround)

# appliance 파일 다운로드
[root@rhosp-tb0-kvm ~]#wget http://download.libguestfs.org/binaries/appliance/appliance-1.38.0.tar.xz

--2021-07-15 15:17:37--  http://download.libguestfs.org/binaries/appliance/appliance-1.38.0.tar.xz
Resolving download.libguestfs.org (download.libguestfs.org)... 46.43.9.215, 2001:41c9:1:422::215
Connecting to download.libguestfs.org (download.libguestfs.org)|46.43.9.215|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.libguestfs.org/binaries/appliance/appliance-1.38.0.tar.xz [following]
--2021-07-15 15:17:38--  https://download.libguestfs.org/binaries/appliance/appliance-1.38.0.tar.xz
Connecting to download.libguestfs.org (download.libguestfs.org)|46.43.9.215|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 96537604 (92M) [application/x-xz]
Saving to: ‘appliance-1.38.0.tar.xz’

100%[==================================================================================================>] 96,537,604  2.96MB/s   in 57s

2021-07-15 15:18:37 (1.60 MB/s) - ‘appliance-1.38.0.tar.xz’ saved [96537604/96537604]


# 압축해제
[root@rhosp-tb0-kvm ~]#tar -Jxf appliance-1.38.0.tar.xz


# 환경변수 설정
[root@rhosp-tb0-kvm ~]#export LIBGUESTFS_PATH=/root/appliance


# RHEL8 KVM Image root 패스워드 설정
[root@rhosp-tb0-kvm iso-images]#virt-customize -a rhel-8.4-root.qcow2 --root-password password:root
[   0.0] Examining the guest ...
[   4.5] Setting a random seed
[   4.5] Setting the machine ID in /etc/machine-id
[   4.6] Setting passwords
[   5.9] Finishing off


# RHEL8 KVM Image cloud-init 삭제
[root@rhosp-tb0-kvm iso-images]#virt-customize -a rhel-8.4-root.qcow2 --uninstall cloud-init
[   0.0] Examining the guest ...
[   4.6] Setting a random seed
[   4.6] Uninstalling packages: cloud-init
[   8.3] Finishing off
728x90