[SOLVED] qm importdisk increased the disk size from 96.5GB to 476.94 GB

Feb 16, 2021
6
0
21
45
I have successfully migrated a test Windows server 2022 to Proxmox. Yay! :)

The server boots and appears to be working perfectly. . Double Yay! :) :)

However, when I issued the command to import the disk:

qm importdisk 101 /var/lib/vz/template/qcow/WIN-4GSGQMJ1U8A.qcow2 local-lvm

The progress showed

….. of 476.94 GB

And the final machine has disk size 488388M (476.9GB)


Code:
root@pve001:/var/lib/vz/template/qcow# qm config 101

bios: ovmf
boot: order=sata0
cores: 4
cpu: x86-64-v2-AES
efidisk0: local-lvm:vm-101-disk-2,efitype=4m,pre-enrolled-keys=1,size=4M
ide2: none,media=cdrom
machine: pc-i440fx-10.0+pve1
memory: 8000
meta: creation-qemu=10.0.2,ctime=1760955315
name: Winserver2022
net0: virtio=BC:24:11:0F:7B:22,bridge=vmbr0,firewall=1
numa: 0
ostype: win11
sata0: local-lvm:vm-101-disk-1,size=488388M
scsihw: virtio-scsi-pci
smbios1: uuid=73090d36-0f52-4c5c-ac4e-5f9ef9cfdfe9
sockets: 1
usb0: host=1-11
vmgenid: 4091f29f-6545-49fd-a70f-28acb19b47a7



The original C: on the Physical server was 96.52 GB but only using 18.77GB.

The WIN-4GSGQMJ1U8A.qcow2 file is only 19GB (give or take)

Code:
-rwxr-xr-x 1 root root 19385352192 Oct 20 15:59 WIN-4GSGQMJ1U8A.qcow2

When I boot the migrated server on Proxmox C: is 96.5GB

How / where has the extra 380GB come from?

How can I reduce the size of the disk to the correct size?
 
Hi @JAZZIT Support ,

What does qemu-img info [original_file] say?
Whats do lsblk and lvs show?
What about lvdisplay /dev/pve/vm-101-disk-1 ?

Just because the partitioned/formatted space in original Windows server was 100G, does not mean that the underlying disk was not 350G. Do you still have access to the original VM/server? If you do, what does "disk manager" show?


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
@bbgeek17 many thank for super quick reply. And you have identified the source of the rogue 380GB!

What does qemu-img info [original_file] say?

Code:
root@pve001:/var/lib/vz/template/qcow# qemu-img info WIN-4GSGQMJ1U8A.qcow2
image: WIN-4GSGQMJ1U8A.qcow2
file format: qcow2
virtual size: 477 GiB (512110190592 bytes)
disk size: 18.1 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
Child node '/file':
    filename: WIN-4GSGQMJ1U8A.qcow2
    protocol type: file
    file length: 18.1 GiB (19385352192 bytes)
    disk size: 18.1 GiB

Whats do lsblk and lvs show?

Code:
root@pve001:/var/lib/vz/template/qcow# lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sr0                           11:0    1  1024M  0 rom 
nvme0n1                      259:0    0 238.5G  0 disk
├─nvme0n1p1                  259:1    0  1007K  0 part
├─nvme0n1p2                  259:2    0     1G  0 part /boot/efi
└─nvme0n1p3                  259:3    0   237G  0 part
  ├─pve-swap                 252:0    0   7.6G  0 lvm  [SWAP]
  ├─pve-root                 252:1    0  69.4G  0 lvm  /
  ├─pve-data_tmeta           252:2    0   1.4G  0 lvm 
  │ └─pve-data-tpool         252:4    0 141.2G  0 lvm 
  │   ├─pve-data             252:5    0 141.2G  1 lvm 
  │   ├─pve-vm--100--disk--0 252:6    0     4M  0 lvm 
  │   ├─pve-vm--100--disk--1 252:7    0    32G  0 lvm 
  │   ├─pve-vm--101--disk--1 252:9    0 476.9G  0 lvm 
  │   └─pve-vm--101--disk--2 252:10   0     4M  0 lvm 
  └─pve-data_tdata           252:3    0 141.2G  0 lvm 
    └─pve-data-tpool         252:4    0 141.2G  0 lvm 
      ├─pve-data             252:5    0 141.2G  1 lvm 
      ├─pve-vm--100--disk--0 252:6    0     4M  0 lvm 
      ├─pve-vm--100--disk--1 252:7    0    32G  0 lvm 
      ├─pve-vm--101--disk--1 252:9    0 476.9G  0 lvm 
      └─pve-vm--101--disk--2 252:10   0     4M  0 lvm

Code:
root@pve001:/var/lib/vz/template/qcow# lvs
  LV            VG  Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data          pve twi-aotz-- <141.20g             15.60  1.55                           
  root          pve -wi-ao----  <69.36g                                                   
  swap          pve -wi-ao----   <7.57g                                                   
  vm-100-disk-0 pve Vwi-a-tz--    4.00m data        14.06                                 
  vm-100-disk-1 pve Vwi-a-tz--   32.00g data        10.37                                 
  vm-101-disk-1 pve Vwi-aotz--  476.94g data        3.92                                   
  vm-101-disk-2 pve Vwi-aotz--    4.00m data        14.06

What about lvdisplay /dev/pve/vm-101-disk-1 ?

Code:
root@pve001:/var/lib/vz/template/qcow# lvdisplay /dev/pve/vm-101-disk-1
  --- Logical volume ---
  LV Path                /dev/pve/vm-101-disk-1
  LV Name                vm-101-disk-1
  VG Name                pve
  LV UUID                096L4m-tw6Y-ZJxd-dM99-NBnR-Y0Ox-PLIP71
  LV Write Access        read/write
  LV Creation host, time pve001, 2025-10-20 16:02:35 +0100
  LV Pool name           data
  LV Status              available
  # open                 1
  LV Size                476.94 GiB
  Mapped size            3.92%
  Current LE             122097
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:9


The Original Disk on the physical server does have 379.8GB Unallocated!

IMG_20251020_171228389.jpg

This is the same on the Migrated server.

Thankyou. bbgeek17
 
You should be able to shrink the original qcow2 with:
Code:
qemu-img resize WIN-4GSGQMJ1U8A.qcow2 --shrink 100G
This will truncate most of that unallocated disk space - leaving you with a disk size of 100GB. You will then need to re-import/create a VM using that shrunken image.

(NOTE: You should always have backups/copy when doing such a procedure).
 
Last edited: