最後更新: 2022-02-16
目錄
- Online resize disk
- logical_block_size & physical_block_size
logical_block_size & physical_block_size
For Linux this would be the value returned by the
BLKSSZGET (logical_block_size) ioctl and describes the smallest units for disk I/O.
BLKPBSZGET (physical_block_size) ioctl and describes the disk's hardware sector size which can be relevant for the alignment of disk data.
XML
<disk type='block' device='disk'> ... <blockio logical_block_size='512' physical_block_size='4096'/> </disk>
Online resize disk
1. 查看 Instance 的 disk image path 及 device name
virsh qemu-monitor-command lxc-r8 --hmp "info block"
drive-scsi0-0-0-1 (#block326): /mnt/raid/lxc-r8/data.raw (raw) Attached to: scsi0-0-0-1 Cache mode: writeback
2. 查看 image size
qemu-img info /mnt/raid/lxc-r8/data.raw
image: /mnt/raid/lxc-r8/data.raw file format: raw virtual size: 20G (21474836480 bytes) disk size: 2.5G
3. resize
virsh qemu-monitor-command lxc-r8 --hmp "block_resize drive-scsi0-0-0-1 30G"
qemu-img info /mnt/raid/lxc-r8/data.raw
image: /mnt/raid/lxc-r8/data.raw file format: raw virtual size: 30G (32212254720 bytes) disk size: 2.5G