summary refs log tree commit diff stats
path: root/gitlab/issues/target_missing/host_missing/accel_missing/688.toml
blob: d9ed1764d3c57d5ecc3e859ebb35e6e07e3a3c6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
id = 688
title = "Shrinking an image with qemu-img  does not reduce image file size"
state = "closed"
created_at = "2021-10-23T06:18:00.794Z"
closed_at = "2021-10-27T08:21:03.786Z"
labels = ["Storage", "qemu-img"]
url = "https://gitlab.com/qemu-project/qemu/-/issues/688"
host-os = "Gentoo Linux AMD64"
host-arch = "x86_64"
qemu-version = "qemu-img version 6.0.0"
guest-os = "n/a"
guest-arch = "n/a"
description = """I have a macOS 10.9 VM using a qcow2 image that was 151GB. The image was originally converted from a VMware image with:
```
qemu-img convert macOS-10.9.vmdk -O qcow2 -o preallocation=falloc macOS-10.9.qcow2
```
This resulted in `macOS-10.9.qcow2` being 151GB big:
```
$ du -h macOS-10.9.qcow2 
151G     macOS-10.9.qcow2
```
After reducing the filesystem size from within macOS to 25GB with DiskUtil, I shut down the VM and resized the image to 30GB with:
```
qemu-img resize -f qcow2 --shrink macOS-10.9.qcow2 30G
```
This succeeded. However, the file still consumes 151GB of space:
```
$ du -h macOS-10.9.qcow2 
151G     macOS-10.9.qcow2
```
Even though `qemu-img info` shows:
```
$ qemu-img info macOS-10.9.qcow2 
image: macOS-10.9.qcow2
file format: qcow2
virtual size: 30 GiB (32212254720 bytes)
disk size: 30 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
```
The size inside the VM is also reported as being 30GB.

The whole point of resizing that image was to free up disk space on the host. But this doesn't seem to be happening.

My filesystem is ext4."""
reproduce = """1. Create a vmdk image with `qemu-img create -f vmdk test.vmdk 5G`
2. Convert the vmdk image to qcow2 with `qemu-img convert test.vmdk -O qcow2 -o preallocation=falloc test.qcow2`
3. Shrink the new image with `qemu-img resize -f qcow2 --shrink test.qcow2 3G`

The resulting `test.qcow2` file should be 3GB, but it's not. It's 5GB."""
additional = "n/a"