Microsoft Azure RHEL 9.4 镜像记

2026-02-04 14:52:00
丁国栋
原创 18
摘要:本文记录一下在Microsoft Azure使用 RedHat RHEL 9.4 Gen2 镜像的一些特性、发现。

由于业务需要,在Microsoft Azure上创建了一个 Red Hat Enterprise Linux 8.4的Linux虚拟机,用于测试、演示。

操作系统细节是:

Publisher: RedHat
Offer: RHEL
SKU: 94_gen2

Version: latest

# cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="9.4 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.4 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://issues.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.4
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"

系统磁盘分配64GB,默认分区如下:

# df -h
Filesystem                 Size  Used Avail Use% Mounted on
devtmpfs                   4.0M     0  4.0M   0% /dev
tmpfs                      3.8G     0  3.8G   0% /dev/shm
tmpfs                      1.5G   17M  1.5G   2% /run
/dev/mapper/rootvg-rootlv  2.0G   71M  1.9G   4% /
/dev/mapper/rootvg-usrlv    10G  1.7G  8.4G  17% /usr
/dev/sdb2                  436M  130M  307M  30% /boot
/dev/mapper/rootvg-homelv  960M   40M  921M   5% /home
/dev/mapper/rootvg-varlv   8.0G  457M  7.5G   6% /var
/dev/mapper/rootvg-tmplv   2.0G   47M  1.9G   3% /tmp
/dev/sdb1                  200M  7.1M  193M   4% /boot/efi
tmpfs                      764M     0  764M   0% /run/user/1000
有此可见,它把原来放在一起的几个目录拆分到了不同的卷中,并且硬盘空间并没有完全分配给vg。
# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sdb4
  VG Name               rootvg
  PV Size               63.31 GiB / not usable 0   
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              16208
  Free PE               10320
  Allocated PE          5888
  PV UUID               ufi0Sj-c5iY-H0Cd-xRRA-wRJs-800x-7EFnTP
   
# vgdisplay 
  --- Volume group ---
  VG Name               rootvg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                5
  Open LV               5
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               63.31 GiB
  PE Size               4.00 MiB
  Total PE              16208
  Alloc PE / Size       5888 / 23.00 GiB
  Free  PE / Size       10320 / 40.31 GiB
  VG UUID               ySGIPD-GCnt-Lwde-6oGU-bVNA-jyLo-bWfpqM
   
# fdisk -l
Disk /dev/sda: 128 GiB, 137438953472 bytes, 268435456 sectors
Disk model: Virtual Disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sdb: 64 GiB, 68719476736 bytes, 134217728 sectors
Disk model: Virtual Disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D8DA8289-67B2-4826-98B9-8411BA472FCC
Device       Start       End   Sectors  Size Type
/dev/sdb1     2048    411647    409600  200M EFI System
/dev/sdb2   411648   1435647   1024000  500M Linux filesystem
/dev/sdb3  1435648   1437695      2048    1M BIOS boot
/dev/sdb4  1437696 134215679 132777984 63.3G Linux LVM
Disk /dev/mapper/rootvg-tmplv: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/rootvg-usrlv: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/rootvg-homelv: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/rootvg-varlv: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/rootvg-rootlv: 22 GiB, 23622320128 bytes, 46137344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

这样的话,需要手动分配一些vg空间给相应的lv。


关于更新和RHEL9的订阅

Azure 的RHEL9 镜像默认带了 RHUI (RHUI(Red Hat Update Infrastructure,红帽更新基础设施) 是红帽为企业级客户提供的一套本地化更新解决方案,主要用于云环境和离线环境)配置,可以直接通过dnf、yum等工具(dnf-3)安装软件包。

# subscription-manager list
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64
Product ID:     479
Version:        9.4
Arch:           x86_64
Status:         Unknown
Status Details: 
Starts:         
Ends:           
Product Name:   Red Hat Enterprise Linux for x86_64 - Extended Update Support
Product ID:     70
Version:        9.4
Arch:           x86_64
Status:         Unknown
Status Details: 
Starts:         
Ends:           
# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Unknown
System Purpose Status: Unknown
# yum info mysql
Last metadata expiration check: 0:00:21 ago on Wed 04 Feb 2026 07:14:57 AM UTC.
Available Packages
Name         : mysql
Version      : 8.0.40
Release      : 1.el9_4
Architecture : x86_64
Size         : 2.8 M
Source       : mysql-8.0.40-1.el9_4.src.rpm
Repository   : rhel-9-for-x86_64-appstream-eus-rhui-rpms
Summary      : MySQL client programs and shared libraries
URL          : http://www.mysql.com
License      : GPLv2 with exceptions and LGPLv2 and BSD
Description  : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
             : client/server implementation consisting of a server daemon (mysqld)
             : and many different client programs and libraries. The base package
             : contains the standard MySQL client programs and generic MySQL files.
# yum install mysql
Last metadata expiration check: 0:01:33 ago on Wed 04 Feb 2026 07:14:57 AM UTC.
Dependencies resolved.
===========================================================================================================================================
 Package                              Architecture     Version                   Repository                                           Size
===========================================================================================================================================
Installing:
 mysql                                x86_64           8.0.40-1.el9_4            rhel-9-for-x86_64-appstream-eus-rhui-rpms           2.8 M
Installing dependencies:
 mariadb-connector-c-config           noarch           3.2.6-1.el9_0             rhel-9-for-x86_64-appstream-eus-rhui-rpms            11 k
 mysql-common                         x86_64           8.0.40-1.el9_4            rhel-9-for-x86_64-appstream-eus-rhui-rpms            77 k
Transaction Summary
===========================================================================================================================================
Install  3 Packages
Total download size: 2.9 M
Installed size: 60 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): mariadb-connector-c-config-3.2.6-1.el9_0.noarch.rpm                                                  66 kB/s |  11 kB     00:00    
(2/3): mysql-common-8.0.40-1.el9_4.x86_64.rpm                                                              309 kB/s |  77 kB     00:00    
(3/3): mysql-8.0.40-1.el9_4.x86_64.rpm                                                                     7.1 MB/s | 2.8 MB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                      7.2 MB/s | 2.9 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                   1/1 
  Installing       : mariadb-connector-c-config-3.2.6-1.el9_0.noarch                                                                   1/3 
  Installing       : mysql-common-8.0.40-1.el9_4.x86_64                                                                                2/3 
  Installing       : mysql-8.0.40-1.el9_4.x86_64                                                                                       3/3 
  Running scriptlet: mysql-8.0.40-1.el9_4.x86_64                                                                                       3/3 
  Verifying        : mariadb-connector-c-config-3.2.6-1.el9_0.noarch                                                                   1/3 
  Verifying        : mysql-8.0.40-1.el9_4.x86_64                                                                                       2/3 
  Verifying        : mysql-common-8.0.40-1.el9_4.x86_64                                                                                3/3 
Installed products updated.
Installed:
  mariadb-connector-c-config-3.2.6-1.el9_0.noarch          mysql-8.0.40-1.el9_4.x86_64          mysql-common-8.0.40-1.el9_4.x86_64         
Complete!

--

发表评论
博客分类