# 產生 preallocated image $ ddif=/dev/zero of=/tmp/dbvm_disk1.img bs=1G count=10 10+0 records in 10+0 records out 10737418240 bytes (11 GB) copied, 8.32924 s, 1.3 GB/s
# 產生 thin-provisioned image $ ddif=/dev/zero of=/tmp/dbvm_disk1_seek.img bs=1G seek=10 count=0 0+0 records in 0+0 records out 0 bytes (0 B) copied, 0.000307303 s, 0.0 kB/s
# 查詢 image 資訊 (preallocated image 已經完全佔據磁碟空間) $ qemu-img info /tmp/dbvm_disk1.img image: /tmp/dbvm_disk1.img file format: raw virtual size: 10G (10737418240 bytes) disk size: 10G # 查詢 image 資訊 (thin-provisioned image 並未預先佔據磁碟空間) $ qemu-img info /tmp/dbvm_disk1_seek.img image: /tmp/dbvm_disk1_seek.img file format: raw virtual size: 10G (10737418240 bytes) disk size: 0
# 查詢 pool 列表 $ $ virsh -c qemu+ssh://root@10.20.190.2/system pool-list Name State Autostart ------------------------------------------- default active yes
```bash # 定義 storage pool (會產生 XML 定義檔案在 /etc/libvirt/storage 目錄中) $ virsh -c qemu+ssh://root@10.20.190.2/system pool-define-as dedicated_storage dir - - - - "/vms" Pool dedicated_storage defined
# 建立 storage pool (建立指定目錄 & 設定 SELinux 相關權限) $ virsh -c qemu+ssh://root@10.20.190.2/system pool-build dedicated_storage Pool dedicated_storage built
# 啟動 storage pool $ virsh -c qemu+ssh://root@10.20.190.2/system pool-start dedicated_storage Pool dedicated_storage started
# 設定 libvirtd 啟動時,同時啟動此 storage pool $ virsh -c qemu+ssh://root@10.20.190.2/system pool-autostart dedicated_storage Pool dedicated_storage marked as autostarted