From b5febddb8a62eb096d9b43007557c30877909853 Mon Sep 17 00:00:00 2001 From: CallMeR <9463297+callmer@user.noreply.gitee.com> Date: Mon, 26 Jun 2023 19:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20PVE=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03.PVE系统调整.md | 81 ++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/03.PVE系统调整.md b/03.PVE系统调整.md index dcf1db3..c6c5dfc 100644 --- a/03.PVE系统调整.md +++ b/03.PVE系统调整.md @@ -28,8 +28,6 @@ update-pciids 如果在安装 PVE 系统时选错了时区,导致系统时间和北京时间不一致,可以使用以下命令修正。 -输出结果如果和北京时间一致,则代表修改正确。 - ```bash ## 修改系统时区 timedatectl set-timezone Asia/Shanghai @@ -38,9 +36,9 @@ timedatectl set-timezone Asia/Shanghai date -R ``` -参考输出 +输出结果如果和北京时间一致,则代表修改正确。 -``` +```shell Sun, 25 Jun 2023 12:12:12 +0800 ``` @@ -81,7 +79,7 @@ chronyc sources -V 如果输出以下类似内容,则表示系统 NTP 服务器设置正确。 -``` +```shell MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^+ 106.55.184.199 2 6 17 11 +752us[ +273us] +/- 40ms @@ -96,11 +94,9 @@ MS Name/IP address Stratum Poll Reach LastRx Last sample ## 检查 CPU 当前调度器 cpufreq-info ``` -**设备 CPU - J4125 参考输出** - -```bash -## J4125 参考输出 +设备 CPU - J4125 参考输出。 +```shell cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: @@ -114,14 +110,11 @@ analyzing CPU 0: The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 1.84 GHz. - ``` -**设备 CPU - N6005 参考输出** - -```bash -## N6005 参考输出 +设备 CPU - N6005 参考输出。 +```shell cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: @@ -135,7 +128,6 @@ analyzing CPU 0: The governor "performance" may decide which speed to use within this range. current CPU frequency is 2.00 GHz. - ``` 这里面主要关注两个点: @@ -149,17 +141,18 @@ analyzing CPU 0: ```bash ## 检查 CPU 当前调度器 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor +``` +设备 CPU - J4125 参考输出。 -## J4125 参考输出 - +```shell ondemand +``` +设备 CPU - N6005 参考输出。 -## N6005 参考输出 - +```shell performance - ``` CPU 驱动一般不建议手动调整,而 `governor` 后面的参数表示 CPU 当前调度器设置。 @@ -169,17 +162,18 @@ CPU 驱动一般不建议手动调整,而 `governor` 后面的参数表示 CPU ```bash ## 检查 CPU 调度器支持情况 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors +``` +设备 CPU - J4125 参考输出。 -## J4125 参考输出 - +```shell conservative ondemand userspace powersave performance schedutil +``` +设备 CPU - N6005 参考输出。 -## N6005 参考输出 - +```shell performance powersave - ``` 根据 CPU 所使用的驱动不同,可选调度器也不同,至于每种调度器有什么优劣,欢迎大家深度挖掘。 @@ -235,9 +229,12 @@ crontab -l ## 编辑系统定时任务,编辑器选择 nano crontab -e +``` +在配置文件末尾,增加以下配置项。 -## 在配置文件末尾增加以下配置项 +```bash +## 定时任务配置项 0 5 1,16 * * /usr/sbin/reboot @@ -254,10 +251,11 @@ crontab -e ```bash ## 检查系统定时器 systemctl status apt-daily-upgrade.timer +``` +系统定时器参考输出。 -## 示例输出 - +```shell ● apt-daily-upgrade.timer - Daily apt upgrade and clean activities Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled) Active: active (waiting) since Fri 2023-06-23 18:55:58 CST; 1 day 18h ago @@ -266,7 +264,6 @@ systemctl status apt-daily-upgrade.timer Triggers: ● apt-daily-upgrade.service Jun 23 18:55:58 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. - ``` ### 4.2.配置更新策略 @@ -281,11 +278,12 @@ dpkg-reconfigure -plow unattended-upgrades ## 选择 “是” (“YES”) +``` -## 示例输出 +系统自动更新参考输出。 +```shell Creating config file /etc/apt/apt.conf.d/20auto-upgrades with new version - ``` 进一步调整 apt 的 `20auto-upgrades` 配置文件。 @@ -346,17 +344,14 @@ nano /etc/apt/apt.conf.d/50unattended-upgrades "origin=Debian,codename=${distro_codename}-updates"; - ## 添加 PVE 系统更新项目 "origin=Proxmox,codename=${distro_codename},label=Proxmox Debian Repository"; - ## 按需添加 PVE Ceph 更新项目 "origin=Proxmox,codename=${distro_codename},label=Proxmox Ceph Debian Repository"; - ## 在配置文件末尾增加以下配置项,代表启用,并调整参数 Unattended-Upgrade::AutoFixInterruptedDpkg "true"; @@ -404,10 +399,11 @@ systemctl restart apt-daily-upgrade.timer ## 再次检查触发器状态 systemctl status apt-daily-upgrade.timer +``` +系统自动更新触发器参考输出。 -## 参考输出 - +```shell ● apt-daily-upgrade.timer - Daily apt upgrade and clean activities Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled) Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d @@ -420,7 +416,6 @@ systemctl status apt-daily-upgrade.timer Jun 25 14:35:06 node01 systemd[1]: Stopped apt-daily-upgrade.timer - Daily apt upgrade and clean activities. Jun 25 14:35:06 node01 systemd[1]: Stopping apt-daily-upgrade.timer - Daily apt upgrade and clean activities... Jun 25 14:35:06 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. - ``` ## 5.硬件直通 @@ -497,10 +492,11 @@ PVE 服务器重启完成后,再次使用 SSH 工具登录,并使用以下 ```bash ## 检查系统硬件直通状态 dmesg | grep -e DMAR -e IOMMU -e AMD-Vi +``` +设备 CPU - N6005 参考输出。 -## N6005 示例输出 - +```shell [ 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 @@ -530,7 +526,6 @@ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi [ 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 - ``` 检查系统 `IOMMU` 分组,使用以下命令。 @@ -538,10 +533,11 @@ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi ```bash ## 检查 IOMMU group find /sys/kernel/iommu_groups/ -type l +``` +设备 CPU - N6005 参考输出。 -## N6005 示例输出 - +```shell /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 @@ -565,7 +561,6 @@ find /sys/kernel/iommu_groups/ -type l /sys/kernel/iommu_groups/10/devices/0000:00:1c.7 /sys/kernel/iommu_groups/0/devices/0000:00:02.0 /sys/kernel/iommu_groups/9/devices/0000:00:1c.6 - ``` ## 6.系统清理