From 31be875c67261127581c70ee02ca9597e3febc5e Mon Sep 17 00:00:00 2001 From: CallMeR <9463297+callmer@user.noreply.gitee.com> Date: Wed, 27 Aug 2025 15:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=A4=BA=E4=BE=8B=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03.PVE系统调整.md | 124 +++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 67 deletions(-) diff --git a/03.PVE系统调整.md b/03.PVE系统调整.md index 64de2cf..94a72d0 100644 --- a/03.PVE系统调整.md +++ b/03.PVE系统调整.md @@ -4,7 +4,7 @@ 在 PVE 系统调整之前,请确认必要的软件包已经安装完成,本文后续命令均在 SSH 终端下执行。 -Debian 系统默认编辑器为 `nano` ,推荐将默认编辑器更换为 `neovim` ,关于 [Neovim](https://neovim.io/) 的基础使用方法,请参阅:[Neovim 基础教程](https://cn.bing.com/search?q=Neovim+%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B) 。 +Debian 系统默认编辑器为 `nano` ,推荐将其更换为 `neovim` ,关于 [Neovim](https://neovim.io/) 的基础使用方法,请参阅:[Neovim 基础教程](https://cn.bing.com/search?q=Neovim+%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B) 。 ```bash ## 修改系统默认编辑器(选择 nvim 所在条目,即可将 neovim 设为默认编辑器) @@ -38,7 +38,7 @@ $ timedatectl set-timezone Asia/Shanghai $ date -R #### 系统时间示例输出 -Mon, 20 Jan 2025 18:24:41 +0800 +Wed, 27 Aug 2025 15:12:21 +0800 ``` Debian 系统常用 `systemd-timesyncd.service` 来同步时间,而 PVE 系统使用 `chrony.service` 来同步时间。 @@ -280,12 +280,12 @@ $ systemctl status apt-daily-upgrade.timer #### 系统定时器示例输出 ● apt-daily-upgrade.timer - Daily apt upgrade and clean activities Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled) - Active: active (waiting) since Tue 2025-08-12 17:26:06 CST; 25min ago - Invocation: d8a6290ca81f4357bfd893fe6c8e8d92 - Trigger: Tue 2025-08-12 18:02:54 CST; 36min left + Active: active (waiting) since Wed 2025-08-27 13:41:10 CST; 1h 37min ago + Invocation: 26ebb62a4f6545998522fff8c4104b3e + Trigger: Thu 2025-08-28 06:14:37 CST; 14h left Triggers: ● apt-daily-upgrade.service -Aug 12 17:26:06 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. +Aug 27 13:41:10 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. ``` ### 4.2.配置更新策略 @@ -421,14 +421,13 @@ $ systemctl status apt-daily-upgrade.timer Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled) Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d └─override.conf - Active: active (waiting) since Tue 2025-08-12 17:30:54 CST; 7s ago - Invocation: 6a51d18d6a97491bbd26570cea818a97 - Trigger: Wed 2025-08-13 01:30:00 CST; 7h left + Active: active (waiting) since Wed 2025-08-27 15:23:29 CST; 8s ago + Invocation: e38354f06d284894b084a52e1f19af73 + Trigger: Thu 2025-08-28 01:30:00 CST; 10h left Triggers: ● apt-daily-upgrade.service -Aug 12 17:30:54 node01 systemd[1]: Stopped apt-daily-upgrade.timer - Daily apt upgrade and clean activities. -Aug 12 17:30:54 node01 systemd[1]: Stopping apt-daily-upgrade.timer - Daily apt upgrade and clean activities... -Aug 12 17:30:54 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. +Aug 27 15:23:29 node01 systemd[1]: Stopping apt-daily-upgrade.timer - Daily apt upgrade and clean activities... +Aug 27 15:23:29 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. ``` ## 5.硬件直通 @@ -471,17 +470,18 @@ $ update-grub ### 5.2.添加内核模块 -修改系统 `/etc/modules` 配置文件,增加必要的系统模块。 +编辑 **内核模块** 配置文件,增加必要的系统模块,执行以下命令。 ```bash ## 编辑系统配置文件 -$ editor /etc/modules +$ editor /etc/modules-load.d/10-server-modules.conf ``` 在配置文件中添加以下配置项,并保存。 ```bash -## 硬件直通配置项 +# This configuration file is customized by fox, +# Optimize vfio related modules at system boot. vfio vfio_iommu_type1 @@ -506,36 +506,26 @@ PVE 服务器重启完成后,再次使用终端工具登录,并执行以下 ## 检查系统硬件直通状态 $ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi -#### 设备 CPU - N100 示例输出 -[ 0.017937] ACPI: DMAR 0x00000000746C2000 000088 (v02 INTEL EDK2 00000002 01000013) -[ 0.017965] ACPI: Reserving DMAR table memory at [mem 0x746c2000-0x746c2087] -[ 0.047812] DMAR: IOMMU enabled -[ 0.116031] DMAR: Host address width 39 -[ 0.116032] DMAR: DRHD base: 0x000000fed90000 flags: 0x0 -[ 0.116038] DMAR: dmar0: reg_base_addr fed90000 ver 4:0 cap 1c0000c40660462 ecap 49e2ff0505e -[ 0.116041] DMAR: DRHD base: 0x000000fed91000 flags: 0x1 -[ 0.116046] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da -[ 0.116048] DMAR: RMRR base: 0x0000007b800000 end: 0x0000007fbfffff -[ 0.116051] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1 -[ 0.116052] DMAR-IR: HPET id 0 under DRHD base 0xfed91000 -[ 0.116053] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping. -[ 0.117774] DMAR-IR: Enabled IRQ remapping in x2apic mode -[ 1.746431] pci 0000:00:02.0: DMAR: Skip IOMMU disabling for graphics -[ 2.290116] DMAR: No ATSR found -[ 2.290117] DMAR: No SATC found -[ 2.290118] DMAR: IOMMU feature fl1gp_support inconsistent -[ 2.290119] DMAR: IOMMU feature pgsel_inv inconsistent -[ 2.290120] DMAR: IOMMU feature nwfs inconsistent -[ 2.290121] DMAR: IOMMU feature pds inconsistent -[ 2.290122] DMAR: IOMMU feature eafs inconsistent -[ 2.290123] DMAR: IOMMU feature prs inconsistent -[ 2.290123] DMAR: IOMMU feature nest inconsistent -[ 2.290124] DMAR: IOMMU feature mts inconsistent -[ 2.290124] DMAR: IOMMU feature sc_support inconsistent -[ 2.290125] DMAR: IOMMU feature dev_iotlb_support inconsistent -[ 2.290126] DMAR: dmar0: Using Queued invalidation -[ 2.290129] DMAR: dmar1: Using Queued invalidation -[ 2.290568] DMAR: Intel(R) Virtualization Technology for Directed I/O +#### 设备 CPU - J4125 示例输出 +[ 0.008356] ACPI: DMAR 0x000000007953E000 0000A8 (v01 INTEL GLK-SOC 00000003 BRXT 0100000D) +[ 0.008406] ACPI: Reserving DMAR table memory at [mem 0x7953e000-0x7953e0a7] +[ 0.055618] AMD-Vi: Unknown option - 'on' +[ 0.220916] DMAR: Host address width 39 +[ 0.220919] DMAR: DRHD base: 0x000000fed64000 flags: 0x0 +[ 0.220939] DMAR: dmar0: reg_base_addr fed64000 ver 1:0 cap 1c0000c40660462 ecap 9e2ff0505e +[ 0.220944] DMAR: DRHD base: 0x000000fed65000 flags: 0x1 +[ 0.220954] DMAR: dmar1: reg_base_addr fed65000 ver 1:0 cap d2008c40660462 ecap f050da +[ 0.220960] DMAR: RMRR base: 0x000000794a9000 end: 0x000000794c8fff +[ 0.220963] DMAR: RMRR base: 0x0000007b800000 end: 0x0000007fffffff +[ 0.220967] DMAR-IR: IOAPIC id 1 under DRHD base 0xfed65000 IOMMU 1 +[ 0.220970] DMAR-IR: HPET id 0 under DRHD base 0xfed65000 +[ 0.220973] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping. +[ 0.223069] DMAR-IR: Enabled IRQ remapping in x2apic mode +[ 0.493005] DMAR: No ATSR found +[ 0.493008] DMAR: No SATC found +[ 0.493010] DMAR: dmar0: Using Queued invalidation +[ 0.493018] DMAR: dmar1: Using Queued invalidation +[ 0.494092] DMAR: Intel(R) Virtualization Technology for Directed I/O ``` 检查系统 `IOMMU` 分组,执行以下命令。 @@ -544,30 +534,30 @@ $ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi ## 检查 IOMMU group $ find /sys/kernel/iommu_groups/ -type l -#### 设备 CPU - N100 示例输出 -/sys/kernel/iommu_groups/7/devices/0000:00:1c.4 -/sys/kernel/iommu_groups/15/devices/0000:04:00.0 -/sys/kernel/iommu_groups/5/devices/0000:00:17.0 -/sys/kernel/iommu_groups/13/devices/0000:02:00.0 -/sys/kernel/iommu_groups/3/devices/0000:00:15.2 -/sys/kernel/iommu_groups/3/devices/0000:00:15.0 -/sys/kernel/iommu_groups/11/devices/0000:00:1f.0 -/sys/kernel/iommu_groups/11/devices/0000:00:1f.5 -/sys/kernel/iommu_groups/11/devices/0000:00:1f.3 -/sys/kernel/iommu_groups/11/devices/0000:00:1f.4 +#### 设备 CPU - J4125 示例输出 +/sys/kernel/iommu_groups/17/devices/0000:04:00.0 +/sys/kernel/iommu_groups/7/devices/0000:00:13.3 +/sys/kernel/iommu_groups/15/devices/0000:02:00.0 +/sys/kernel/iommu_groups/5/devices/0000:00:13.0 +/sys/kernel/iommu_groups/13/devices/0000:00:1f.0 +/sys/kernel/iommu_groups/13/devices/0000:00:1f.1 +/sys/kernel/iommu_groups/3/devices/0000:00:0f.0 +/sys/kernel/iommu_groups/11/devices/0000:00:17.0 +/sys/kernel/iommu_groups/11/devices/0000:00:17.3 +/sys/kernel/iommu_groups/11/devices/0000:00:17.1 +/sys/kernel/iommu_groups/11/devices/0000:00:17.2 /sys/kernel/iommu_groups/1/devices/0000:00:00.0 -/sys/kernel/iommu_groups/8/devices/0000:00:1c.5 -/sys/kernel/iommu_groups/16/devices/0000:05:00.0 -/sys/kernel/iommu_groups/6/devices/0000:00:1c.0 -/sys/kernel/iommu_groups/14/devices/0000:03:00.0 -/sys/kernel/iommu_groups/4/devices/0000:00:16.0 -/sys/kernel/iommu_groups/12/devices/0000:01:00.0 -/sys/kernel/iommu_groups/2/devices/0000:00:14.5 -/sys/kernel/iommu_groups/2/devices/0000:00:14.2 -/sys/kernel/iommu_groups/2/devices/0000:00:14.0 -/sys/kernel/iommu_groups/10/devices/0000:00:1c.7 +/sys/kernel/iommu_groups/18/devices/0000:05:00.0 +/sys/kernel/iommu_groups/8/devices/0000:00:14.0 +/sys/kernel/iommu_groups/16/devices/0000:03:00.0 +/sys/kernel/iommu_groups/6/devices/0000:00:13.2 +/sys/kernel/iommu_groups/14/devices/0000:01:00.0 +/sys/kernel/iommu_groups/4/devices/0000:00:12.0 +/sys/kernel/iommu_groups/12/devices/0000:00:1c.0 +/sys/kernel/iommu_groups/2/devices/0000:00:0e.0 +/sys/kernel/iommu_groups/10/devices/0000:00:15.0 /sys/kernel/iommu_groups/0/devices/0000:00:02.0 -/sys/kernel/iommu_groups/9/devices/0000:00:1c.6 +/sys/kernel/iommu_groups/9/devices/0000:00:14.1 ``` ## 6. BTRFS 调整