#### Ajouter un sous-volume sous zfs

```shell
zfs create pool/volume-xxxx
```
Ensuite aller ajouter dans la gui le nouveau sous volume zfs pool/volume-xxx pour l'utiliser

#### Passer en mode community (pas de souscription) :
remplacer le repo off par : deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription

#### Import VM, avec qm :
```shell
qm importovf 100 /mnt/pve/xenon-proxmox-vol/ovf/vcsa.ovf xenon-proxmox-vol
```

#### Utiliser le processeur physique en natif (host) :
```shell
qm set 100  --cpu host
```

#### Supprimer un cluster :
```shell
systemctl stop pve-cluster corosync
pmxcfs -l
rm /etc/corosync/*
rm -r /etc/pve/corosync.conf
killall pmxcfs
systemctl start pve-cluster
```

#### Supprimer un noeud d'un cluster :
Lister les neuds présents dans un cluster
```shell
pvecm nodes
```
Supprimer un host au sein d'un cluster
```shell
pvecm delnode <host> 
```
Ensuite supprimer le répertoire /etc/pve/nodes/host
```shell
rm -r /etc/pve/nodes/<host>
```
#### Changer le poids des host dans un cluster :
> changer ça dans /etc/pve/corosync.conf (avec précaution)

```xml
nodelist {
  node {
    name: lancelot
    nodeid: 1
    quorum_votes: 2
    ring0_addr: 172.16.16.7
  }
  node {
    name: perceval
    nodeid: 2
    quorum_votes: 1
    ring0_addr: 172.16.16.8
  }
}
quorum {
  provider: corosync_votequorum
}

totem {
  cluster_name: Kaamelott
  config_version: 3
  interface {
    linknumber: 0
  }
  ip_version: ipv4-6
  link_mode: passive
  secauth: on
  version: 2
}
```

> verifier après avec un pvecm status

#### Divers :
```shell
qm rescan : rescanner des disk non utilisés sur les LVM
qm importdisk 100 /path/to/your/freebsd/image.raw nvme1-vg
```
#### export TrueNAS :
```shell
dd if=/dev/zvol/naspool1/rousseliere-y38mkr bs=32768 status=progress of=/mnt/naspool0/share/Temp/test.dd.raw
```
#### restore VM :
```shell
zstd -q -d -c /mnt/pve/backups1-panzer/dump/vzdump-qemu-103-2022_12_22-04_28_36.vma.zst | vma extract -v -r /var/tmp/vzdumptmp389993.fifo - /var/tmp/vzdumptmp389993
```
#### Creer une VM cloud-init
Debian : https://cloud.debian.org/images/cloud/
```shell
qm create 1000 --name "debian-11" --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0,tag=200
qm importdisk 1000 isos-images-pegasus/debian-11-generic-amd64-20230124-1270.qcow2 zfs0-lancelot
qm set 1000 --scsihw virtio-scsi-pci --scsi0 zfs0-lancelot:vm-1000-disk-0qm set 1000 --ide2 zfs0-lancelot:cloudinit

qm set 1000 --boot c --bootdisk scsi0
qm set 1000 --serial0 socket --vga serial0
```
> Install de cloud init resize automatiquement le disk0 (suffit d'augmenter la taille du disk)

#### Reset cloud-init :
```shell
cloud-init clean --logs
cloud-init init --localcloud-init modules --mode=config
cloud-init modules --mode=final
```

#### Network/Interfaces :
```shell
# network interface settings; autogenerated
# Please do NOT modify this file directly, unless you know what
# you're doing.
#
# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!

auto lo
iface lo inet loopback

iface enp2s0 inet manual

iface enp0s31f6 inet manual

auto vmbr0
iface vmbr0 inet static
	bridge-ports enp3s0
	bridge-stp off
	bridge-fd 0
	bridge-vlan-aware yes
	bridge-vids 2-4094

auto vmbr0.1
iface vmbr0.1 inet static
	address 172.16.16.7/24
	gateway 172.16.16.230

iface vmbr0.1 inet6 dhcp
```

#### Export image en qcow :
```shell
pvesm path local-lvm:vm-101-disk-0
/dev/pve/vm-101-disk-0
```
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9