PVE 工具1

尚书李部發表於2024-04-09

PVE 工具1(PVE_Source)
pve_source是pve指令碼可以更方便的初始化PVE,開啟Shell貼上如下命令

wget -q -O /root/pve_source.tar.gz 'https://bbs.x86pi.cn/file/topic/2023-11-28/file/01ac88d7d2b840cb88c15cb5e19d4305b2.gz' && tar zxvf /root/pve_source.tar.gz && /root/./pve_source
rticle/details/133036227

PVE 工具2,安裝Pve Tools
在shell裡
安裝Pve Tools
export LC_ALL=en_US.UTF-8 apt update && apt -y install git && git clone https://github.com/ivanhao/pvetools.git
啟動工具
cd pvetools

./pvetools.sh

nano /etc/sudoers

sudo apt-get install chromium chromium-driver

qm set 100 -sata1 /dev/disk/by-id/ata-ST2000DL003-9VT166_5YD5BZPV

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream"
GRUB_CMDLINE_LINUX_DEFAULT=”quiet intel_iommu=on iommu=pt”

qm importdisk 101 /var/lib/vz/template/iso/openwrt-04.06.2024-x86-64-generic-squashfs-combined.img local-lvm

備份官方軟體源
cp /etc/apt/sources.list /etc/apt/sources.list.backup
pve_source是pve指令碼(首發於X86派論壇),可以更方便的初始化PVE,開啟Shell貼上如下命令。

wget -q -O /root/pve_source.tar.gz 'https://bbs.x86pi.cn/file/topic/2023-11-28/file/01ac88d7d2b840cb88c15cb5e19d4305b2.gz' && tar zxvf /root/pve_source.tar.gz && /root/./pve_source
PVE 工具2,安裝Pve Tools
在shell裡

安裝Pve Tools

export LC_ALL=en_US.UTF-8 apt update && apt -y install git && git clone https://github.com/ivanhao/pvetools.git

啟動工具

cd pvetools

./pvetools.sh
————————————————
echo "nameserver 8.8.8.8" >> /etc/resolv.conf && rm -rf pvetools && rm -rf /etc/apt/sources.list.d/pve-enterprise.list && export LC_ALL=en_US.UTF-8 && apt update && apt -y install git && git clone https://github.com/ivanhao/pvetools.git && echo "cd /root/pvetools && ./pvetools.sh" > pvetools/pvetools && chmod +x pvetools/pvetools* && ln -s /root/pvetools/pvetools /usr/local/bin/pvetools && pvetools

ctrl + X ---->y----->

更新軟體源
apt update && apt upgrade

驗證新軟體源
apt-get check
更新系統

一鍵替換國內源

wget https://www.geekxw.top/jiaoben/yuan.sh -O yuan.sh && chmod +x yuan.sh && ./yuan.sh

apt update

apt dist-upgrade

y-----

更新軟體源
apt update && apt upgrade

驗證新軟體源
apt-get check

sudo apt update

sudo apt upgrade

安裝KDE桌面環境

sudo apt install kde-plasma-desktop

安裝常用應用程式

sudo apt install firefox libreoffice gimp vlc

這將安裝Firefox瀏覽器、LibreOffice辦公套件、GIMP影像編輯器和VLC媒體播放器

PVE 直通 硬碟
檢視磁碟ID

1、備份虛擬機器
2、刪除虛擬機器
3、刪除local-lvm
命令:
lvremove pve/data
4、把local-lvm空間分配給Local

命令:
lvextend -l +100%FREE -r pve/root

resize2fs /dev/mapper/pve-root
5、刪除local-lvm

網頁登陸,資料中心-儲存-刪除local-lvm
6、編輯local,內容裡新增 磁碟映像和容器,儲存
7、恢復虛擬機器

安裝Pve Tools

export LC_ALL=en_US.UTF-8 apt update && apt -y install git && git clone https://github.com/ivanhao/pvetools.git

PVE 工具1(PVE_Source)

wget -q -O /root/pve_source.tar.gz 'https://bbs.x86pi.cn/file/topic/2023-11-28/file/01ac88d7d2b840cb88c15cb5e19d4305b2.gz' && tar zxvf /root/pve_source.tar.gz && /root/./pve_source

直接檢視磁碟
ls -al /dev/sd* //此命令會檢視sd開頭的磁碟
選擇磁碟,進入磁碟工具
fdisk /dev/sdb
安裝大磁碟
apt-get install parted

格式化大分割槽

  1. parted /dev/sdc
    parted /dev/sdb mklabel gpt
    mkpart primary 0% 100%
    print

  2. mkfs.xfs /dev/sdc 1
    3.掛載磁碟

    新建目錄
    mkdir /isso
    掛載磁碟
    mount /dev/sdc1 /isso

ls -l /dev/disk/by-id/
qm set 100 -scsi1 /dev/disk/by-id/ata-ST500LT012-1DG142_S3PXZZCR

硬碟直通

apt-get update

然後安裝lshw:

apt-get install lshw

然後檢視已插入硬碟的資訊

ls -l /dev/disk/by-id/
lrwxrwxrwx 1 root root 10 Apr 9 12:02 dm-name-pve-root -> ../../dm-1
lrwxrwxrwx 1 root root 10 Apr 9 12:02 dm-name-pve-swap -> ../../dm-0
lrwxrwxrwx 1 root root 10 Apr 9 12:02 dm-uuid-LVM-LGUHkDWqQpXHLhBSTcn1rVNjcocva3qx7PTK3l9TzGffkmBOW7s2f0YYsdNpSfYD -> ../../dm-1
lrwxrwxrwx 1 root root 10 Apr 9 12:02 dm-uuid-LVM-LGUHkDWqQpXHLhBSTcn1rVNjcocva3qxFNn26GageAoIrreetS4ef2ea15ax5sgF -> ../../dm-0
lrwxrwxrwx 1 root root 10 Apr 9 12:02 lvm-pv-uuid-GfQEcl-XsOl-HKYw-1mfi-IXam-avVX-V7uhMB -> ../../sda3
lrwxrwxrwx 1 root root 9 Apr 9 12:02 scsi-36b083fe0c24108002da7657d08da9106 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 9 12:02 scsi-36b083fe0c24108002da7657d08da9106-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 9 12:02 scsi-36b083fe0c24108002da7657d08da9106-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Apr 9 12:02 scsi-36b083fe0c24108002da7657d08da9106-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 Apr 9 12:02 scsi-36b083fe0c24108002da765950a4d2699 -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 9 12:02 scsi-36b083fe0c24108002da765950a4d2699-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 9 Apr 9 12:02 scsi-36b083fe0c24108002da76704202cd902 -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 9 12:02 scsi-36b083fe0c24108002da76704202cd902-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 9 Apr 9 12:02 scsi-36b083fe0c24108002da7671020ddfeeb -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 9 12:02 scsi-36b083fe0c24108002da7671020ddfeeb-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 9 Apr 9 12:02 wwn-0x6b083fe0c24108002da7657d08da9106 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 9 12:02 wwn-0x6b083fe0c24108002da7657d08da9106-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 9 12:02 wwn-0x6b083fe0c24108002da7657d08da9106-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Apr 9 12:02 wwn-0x6b083fe0c24108002da7657d08da9106-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 Apr 9 12:02 wwn-0x6b083fe0c24108002da765950a4d2699 -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 9 12:02 wwn-0x6b083fe0c24108002da765950a4d2699-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 9 Apr 9 12:02 wwn-0x6b083fe0c24108002da76704202cd902 -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 9 12:02 wwn-0x6b083fe0c24108002da76704202cd902-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 9 Apr 9 12:02 wwn-0x6b083fe0c24108002da7671020ddfeeb -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 9 12:02 wwn-0x6b083fe0c24108002da7671020ddfeeb-part1 -> ../../sdd1

root@fdnas:~# fdisk -l
Disk /dev/sda: 3.64 TiB, 3999688294400 bytes, 7811891200 sectors
Disk model: PERC H710
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 972A48CB-7B20-4FA3-A689-D936D368EEBB

Device Start End Sectors Size Type
/dev/sda1 34 2047 2014 1007K BIOS boot
/dev/sda2 2048 2099199 2097152 1G EFI System
/dev/sda3 2099200 7811891166 7809791967 3.6T Linux LVM

Disk /dev/sdb: 3.64 TiB, 3999688294400 bytes, 7811891200 sectors

/dev/sdb1 2048 7811889151 7811887104 3.6T Linux filesystem

Disk /dev/sdd: 1.82 TiB, 1999844147200 bytes, 3905945600 sectors

Device Boot Start End Sectors Size Id Type
/dev/sdd1 * 2048 3905945599 3905943552 1.8T 83 Linux

/dev/sdc1 2048 19529725951 19529723904 9.1T Linux filesystem

Disk /dev/mapper/pve-swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/pve-root: 3.63 TiB, 3990020423680 bytes, 7793008640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@fdnas:~#

新增硬碟做儲存

建立 /mnt/​sdb1 目錄:

mkdir -p /mnt/sdb1
將 /dev/​sdb1 分割槽掛載在 /mnt/​sdb1 上:

mount -t ext4 /dev/sdb1 /mnt/sdb1
將 /mnt/​sde1 掛載寫入到系統啟動項:

echo /dev/sdb1 /mnt/sdb1 ext4 defaults 1 2 >> /etc/fstab

重啟PVE
reboot

相關文章