Skip to content

Instantly share code, notes, and snippets.

@dixiedream
Last active January 20, 2024 01:31
Show Gist options
  • Save dixiedream/fd9f9a85f7a35220aa241846a8b265f2 to your computer and use it in GitHub Desktop.
Save dixiedream/fd9f9a85f7a35220aa241846a8b265f2 to your computer and use it in GitHub Desktop.
Proxmox Wiki

Proxmox Wiki

Zfs

Get status

zfs list

Create mount point

zfs create ${POOL_NAME}/${MOUNT_POINT}

Pool

Get status

zpool status

List disks by id

ls -lsah /dev/disk/by-id/

Replace faulty drive

zpool replace ${POOL_NAME} ${OLD_DISK_ID} ${NEW_DISK_ID}

Add more drive to the pool

Existing single drive pool

zpool attach ${POOL_NAME} ${EXISTING_DISK_ID} ${NEW_DISK_ID}

Existing raid 1

zpool add ${POOL_NAME} [${NEW_DISK_ID}, ...]

Expand pool

First make sure autoexpand is set to on

zpool set autoexpand=on ${POOL_NAME}

Propagate changes to drives. Run the script for every drive of the pool

zpool online -e ${POOL_NAME} ${DRIVE_ID}

Add read cache to pool

zpool add ${POOL_NAME} cache ${DRIVE_ID}

Disable atime for pool (increase speed disabling access log)

zfs set atime=off ${POOL_NAME}

Create cloud init template images

Ubuntu

qm create 5000 --memory 4096 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0
cd /var/lib/vz/template/iso/
qm importdisk 5000 ${UBUNTU_VERSION}-server-cloudimg-amd64-disk-kvm.img ${STORAGE:-local-zfs}
qm set 5000 --scsihw virtio-scsi-pci --scsi0 ${STORAGE:-local-zfs}:vm-5000-disk-0
qm set 5000 --ide2 ${STORAGE:-local-zfs}:cloudinit
qm set 5000 --boot c --bootdisk scsi0
qm set 5000 --serial0 socket --vga serial0

Then change cpu stuff, disable memory balooning, set cloud init credentials and finally create template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment