little thingies
This commit is contained in:
parent
c6e1a01167
commit
0736f29f79
2 changed files with 70 additions and 1 deletions
69
03_vm_disk_enlargement.md
Normal file
69
03_vm_disk_enlargement.md
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
# 03 VM Disk Enlargement
|
||||||
|
|
||||||
|
How to enlarge the disk of an existing Proxmox VM that was provisioned via the tofu project.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Since the tofu VM resource uses `ignore_changes = all` in its lifecycle block, disk resizes are performed manually through the Proxmox UI and then expanded inside the guest OS. You should still update the tofu vars to keep them in sync with reality.
|
||||||
|
|
||||||
|
## Step 1: Update disk size in tofu vars
|
||||||
|
|
||||||
|
* Edit `tofu/nodito/terraform.tfvars` and bump the `disk_size_gb` value for the VM you want to resize.
|
||||||
|
* This won't trigger any actual change (because of `ignore_changes = all`), but keeps the declared state consistent so future readers know the real disk size.
|
||||||
|
|
||||||
|
## Step 2: Resize the disk in Proxmox
|
||||||
|
|
||||||
|
* Open the Proxmox web UI and navigate to the VM.
|
||||||
|
* Go to the **Hardware** tab.
|
||||||
|
* Select the **Hard Disk** entry (scsi0).
|
||||||
|
* Click **Disk Action** > **Resize**.
|
||||||
|
* Enter the amount of additional space you want to add (this is the increment, not the total). For example, to go from 10 GB to 30 GB, enter `20`.
|
||||||
|
* Click **Resize disk**.
|
||||||
|
|
||||||
|
The VM does **not** need to be stopped for this operation. Proxmox will grow the underlying block device while the VM is running.
|
||||||
|
|
||||||
|
## Step 3: Expand the partition and filesystem inside the VM
|
||||||
|
|
||||||
|
SSH into the VM and run these steps as root (or with `sudo`).
|
||||||
|
|
||||||
|
### Check the current layout
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see that the disk (`sda`) now shows the new total size, but the root partition (`sda1`) still has the old size.
|
||||||
|
|
||||||
|
### Grow the partition
|
||||||
|
|
||||||
|
Install `cloud-guest-utils` if `growpart` is not available:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt install -y cloud-guest-utils
|
||||||
|
```
|
||||||
|
|
||||||
|
Then grow the root partition to fill all available space:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
growpart /dev/sda 1
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note the space between the device and the partition number.
|
||||||
|
|
||||||
|
### Resize the filesystem
|
||||||
|
|
||||||
|
For ext4 (the default for Debian cloud images):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
resize2fs /dev/sda1
|
||||||
|
```
|
||||||
|
|
||||||
|
This works online; no reboot is required.
|
||||||
|
|
||||||
|
### Verify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
df -h /
|
||||||
|
```
|
||||||
|
|
||||||
|
The root filesystem should now reflect the new size.
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
retries = int(sys.argv[8])
|
retries = int(sys.argv[8])
|
||||||
ntfy_topic = sys.argv[9] if len(sys.argv) > 9 else "alerts"
|
ntfy_topic = sys.argv[9] if len(sys.argv) > 9 else "alerts"
|
||||||
|
|
||||||
api = UptimeKumaApi(api_url, timeout=60, wait_events=2.0)
|
api = UptimeKumaApi(api_url, timeout=120, wait_events=2.0)
|
||||||
api.login(username, password)
|
api.login(username, password)
|
||||||
|
|
||||||
# Get all monitors
|
# Get all monitors
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue