add disk tests for virsh

This commit is contained in:
2026-02-06 20:27:45 -05:00
parent 71a27b1b91
commit 837ea91a52
2 changed files with 12 additions and 4 deletions

View File

@@ -7,4 +7,4 @@ users:
lock_passwd: false lock_passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys: ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGQa781Qj8mNlUdRquFFqg0O2ornG9SBHe705y4+1vPI ssh@ducoterra.net - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGQa781Qj8mNlUdRquFFqg0O2ornG9SBHe705y4+1vPI ssh@ducoterra.net

View File

@@ -22,6 +22,7 @@ Virtual Machine Management
- [Create a Home Assistant VM](#create-a-home-assistant-vm) - [Create a Home Assistant VM](#create-a-home-assistant-vm)
- [Snapshots](#snapshots) - [Snapshots](#snapshots)
- [Creating and Attaching Disks](#creating-and-attaching-disks) - [Creating and Attaching Disks](#creating-and-attaching-disks)
- [Disk Testing and Scripts](#disk-testing-and-scripts)
- [Virt Builder](#virt-builder) - [Virt Builder](#virt-builder)
## Before you Begin ## Before you Begin
@@ -351,9 +352,14 @@ See [qemu qcow2 snapshots](/active/software_qemu/qemu.md#qcow2-snapshots)
To create and attach one disk: To create and attach one disk:
```bash ```bash
export VM_NAME="cloud-init-test-fedora" # QCOW
export VM_DISK_NAME="test1" qemu-img create -f qcow2 /var/lib/libvirt/images/my-disk.qcow2 1G
qemu-img create -f qcow2 /var/lib/libvirt/images/${VM_DISK_NAME}.qcow2 1G
# Raw (better performance, no snapshots or copy on write)
qemu-img create -f raw /var/lib/libvirt/images/my-disk.raw 1G
# Query disk info (like actual size on disk)
qemu-img info /var/lib/libvirt/images/my-disk.raw
virsh attach-disk ${VM_NAME} \ virsh attach-disk ${VM_NAME} \
--source /var/lib/libvirt/images/${VM_DISK_NAME} \ --source /var/lib/libvirt/images/${VM_DISK_NAME} \
@@ -362,6 +368,8 @@ virsh attach-disk ${VM_NAME} \
--live --live
``` ```
### Disk Testing and Scripts
To create and attach multiple disks (for raid testing) To create and attach multiple disks (for raid testing)
```bash ```bash