====== 安裝 PVE 7 與移轉 PVE 6 VM/CT 執行紀錄 ======
因為 PVE 7 已經採用 cgroup-v2 , 原本 PVE6 內 CT 的 OS 也必須配合升級至支援 cgroup-v2 的版本 Exp. CentOS 7 → CentOS 8 , 但 CentOS 之後已不再是企業使用的穩定版本, 所以應該是要花時間將原本的 CentOS 7 服務移轉至其他穩定版的 Linux 才合理, 也因此採用 PVE 7 與 PVE 6 兩個 Cluster 並存的方式進行處理, 可以有較充裕的時間, 讓服務一一由原本的 PVE 6 移轉至 PVE 7 內
===== 移轉方式 =====
* VM 與 CT(cgroup-v2) 採用備份還原的方式進行服務移轉
* PVE 6 與 PVE 7 設定共同使用的 Backup Storage Exp. backup-pbs252 \\ {{:tech:pve6-7-01.png|}} \\ {{:tech:pve6-7-02.png|}}
* 在 PVE 6 內針對要移轉的 VM 與 CT(cgroup-v2) 進行備份至 backup-pbs252 Exp. 120 (ct-wiki)
* 在 PVE 7 內選擇備份檔進行還原, CT or VM ID 要和原本相同, 這樣之後的備份檔才可以和之前一致 \\ {{:tech:pve6-7-03.png|}}
* 針對不是 cgroup-v2 的 CT , 就要找方案來處理, 目前預計將 CentOS 7 改用 Ubuntu 20.04 LTS 來取代
* 針對有同時支援 CentOS 與 Ubuntu 安裝的服務進行處理 Exp. LibreNMS
* 直接在 PVE 7 內建立新的 Ubuntu 20.04 CT
* 透過改用 Ubuntu 20 的方式進行服務的重新安裝與設定
===== 讓 PVE 6 內的 CentOS7 的 CT 移轉至 PVE 7 的妥協做法 =====
* 參考網址
* https://pve.proxmox.com/pve-docs/chapter-pct.html#pct_cgroup_compat
* https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#sysboot_edit_kernel_cmdline
* 儘管這狀況可能在 PVE 8 就無法運作, 但目前還是最快的作法讓 PVE 6 的主機可以改裝成 PVE 7
* 在 PVE 7 的主機 kernel option 加上 systemd.unified_cgroup_hierarchy=0 來改變使用之前 CGroup 版本
* 使用 **Systemd-boot 開機方案** 進入 PVE 主機修改
- /etc/kernel/cmdline
vi /etc/kernel/cmdline
root=ZFS=rpool/ROOT/pve-1 boot=zfs systemd.unified_cgroup_hierarchy=0
- 執行 proxmox-boot-tool refresh 工具來更新修改內容
root@h470:~# proxmox-boot-tool refresh
Running hook script 'proxmox-auto-removal'..
Running hook script 'zz-proxmox-boot'..
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
Copying and configuring kernels on /dev/disk/by-uuid/2B3A-11C2
Copying kernel and creating boot-entry for 5.13.19-2-pve
Copying kernel and creating boot-entry for 5.13.19-3-pve
* 使用 **Grub 開機方案** 進入 PVE 主機修改
- /etc/default/grub
vi /etc/default/grub
:
GRUB_CMDLINE_LINUX="root=ZFS=rpool/ROOT/pve-1 boot=zfs systemd.unified_cgroup_hierarchy=0"
:
- 執行 update-grub 工具來更新修改內容
root@TP-PVE-249:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.35-1-pve
Found initrd image: /boot/initrd.img-5.15.35-1-pve
Found linux image: /boot/vmlinuz-5.4.189-1-pve
Found initrd image: /boot/initrd.img-5.4.189-1-pve
Found linux image: /boot/vmlinuz-5.4.178-1-pve
Found initrd image: /boot/initrd.img-5.4.178-1-pve
Found linux image: /boot/vmlinuz-4.15.18-30-pve
Found initrd image: /boot/initrd.img-4.15.18-30-pve
Found linux image: /boot/vmlinuz-4.15.17-1-pve
Found initrd image: /boot/initrd.img-4.15.17-1-pve
Found memtest86+ image: /ROOT/pve-1@/boot/memtest86+.bin
Found memtest86+ multiboot image: /ROOT/pve-1@/boot/memtest86+_multiboot.bin
done
* 重新開機
* 接下來就可以透過 PBS 將 PVE 6 備份的 CT 一一的還原啟用在 PVE 7 主機上
===== 原本 PVE 6 主機的升級程序 =====
* Exp. 針對 aac 主機進行升級 (PVE 6 Cluster 還有其他主機 xpc)
- 先將 aac 主機內的 VM/CT 移走( Migrate 到 PVE 6 Cluster 的其他主機 Exp. xpc , 或 Backup/Restore 到 PVE 7 Cluster 新主機)
- 在 xpc 內將 aac 由原有 PVE 6 Cluster 移除 [[https://www.ichiayi.com/tech/pvetips#%E7%A7%BB%E9%99%A4_cluster_%E5%85%A7%E7%9A%84%E4%B8%80%E5%80%8B_node|參考作法]]
- 將 aac 主機重新開機, 進入 aac 主機內
- 進行移除整個 Cluster [[https://www.ichiayi.com/tech/pvetips#%E7%A7%BB%E9%99%A4_cluster_%E7%9A%84%E6%96%B9%E5%BC%8F|參考作法]]
- 刪除原本 PVE 6 Cluster 內其他主機目錄 Exp. xpc
cd /etc/pve/nodes
rm -rf xpc
- 進行 PVE 6 升級 PVE 7 程序 [[https://www.ichiayi.com/tech/pve6to7|參考作法]]
- 加入 PVE 7 新的 Cluster
- 設定可以支援舊版 cgroup [[https://www.ichiayi.com/tech/pve6_and_pve7#%E8%AE%93_pve_6_%E5%85%A7%E7%9A%84_centos7_%E7%9A%84_ct_%E7%A7%BB%E8%BD%89%E8%87%B3_pve_7_%E7%9A%84%E5%A6%A5%E5%8D%94%E5%81%9A%E6%B3%95|參考作法]]
{{tag>pve backup restore}}