# Proxmox

# Miscellaneous Proxmox Commands

#### Get VM Disk Usage (assumes ZFS pool is "pool1" adjust accordingly):

```
zfs list -t volume -o name,volsize,used -r pool1 | awk 'NR==1 || $1 ~ /^pool1\/vm-/'
```

#### Show VM Disk Reseervations in Pool (assumes ZFS pool is "pool1" adjust accordinly). if refreservation is none then it's thin provision: 

```
zfs get -H -o name,property,value refreservation | grep '^pool1/vm-'
```

#### Convert Single Disk to Thin:

##### <span class="token">Verify current state</span> 

```
 zfs get volsize,refreservation,used pool1/vm-104-disk-1 
```

##### <span class="token">Convert thick → thin</span> 

```
zfs set refreservation=none pool1/vm-104-disk-1 
```

##### <span class="token">Verify it took</span> 

```
zfs get volsize,refreservation,used pool1/vm-104-disk-1
```

#### Bulk: convert all thick VM disks on pool1

##### 1) Dry‑run: show what would be changed  


```
bash
zfs get -H -o name,value refreservation \
  | awk '$1 ~ /^pool1\/vm-/ && $2 != "none" {print "zfs set refreservation=none " $1}'
```

#### 2) Apply: actually flip them to thin

```
bash
zfs get -H -o name,value refreservation \
  | awk '$1 ~ /^pool1\/vm-/ && $2 != "none" {print $1}' \
  | while read disk; do
      echo "Converting $disk to thin (refreservation=none)..."
      zfs set refreservation=none "$disk"
    done
```

#####   

# How to resizea Linux (Ubuntu) disk in Proxmox

In proxmox, ensure the VM is off and then select the VM you wish to resize the disk. Click on **Hardware**, locate and select the disk and then on top click on **Disk Action --&gt; Resize**. In the **Resize disk** window enter the size in GB you wish to increase by and click on **Resize disk**. Next, power on the machine, login to the CLI as root and run the following commands:

```
# 1. Identify the disk device
fdisk -l
Disk /dev/sda: 650 GiB, 697932185600 bytes, 1363148800 sectors
Disk model: QEMU HARDDISK   
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: 218F2D76-B023-4E53-A9A3-1C99785FF2AF

Device     Start        End    Sectors  Size Type
/dev/sda1   2048       4095       2048    1M BIOS boot
/dev/sda2   4096 1363148766 1363144671  650G Linux filesystem

# 2. Grow the partition to fill the disk  (note the SPACE: "sda 2", not "sda2")
sudo growpart /dev/sda 2

# 3. Grow the ext4 filesystem to fill the partition
sudo resize2fs /dev/sda2

# 4. verify
df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  2.7M  1.6G   1% /run
/dev/sda2       639G  129G  482G  22% /
tmpfs           7.9G     0  7.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock

```