On Ubuntu 18.04 I created an image with the following command:
Code:
qemu-img create -f qcow2 /var/lib/libvirt/images/image.qcow2 500G;
I then attached it with the following command:
Code:
virsh attach-disk vm_name --source /var/lib/libvirt/images/image.qcow2 --persistent --target vdb
When I go into the vm and run lsblk, it reports the disk is only 200k.
Code:
root@JQ3XL02:~# virsh console vm_name
root@ubuntu:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 30G 0 disk
└─vda1 253:1 0 30G 0 part /
vdb 253:16 0 200K 0 disk
vdc 253:32 0 200K 0 disk
vdd 253:48 0 200K 0 disk
vde 253:64 0 200K 0 disk
vdf 253:80 0 200K 0 disk
vdg 253:96 0 200K 0 disk
root@ubuntu:~# parted /dev/vdb
GNU Parted 3.2
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/vdb: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 205kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
qemu-img info /var/lib/libvirt/images/image.qcow2 reports:
image: /var/lib/libvirt/images/image.qcow2
file format: qcow2
virtual size: 500G (536870912000 bytes)
disk size: 200K
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false