qemu ide/sata disks do not work well with discard/trim
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-images |
New
|
Undecided
|
Unassigned | ||
qemu (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
I encountered this problem using this script to create a GNS3 appliance:
https:/
I'm running a stock gns3-server on Ubuntu 18. I called it like this:
./ubuntu.py -r 20 -s $((1024*1024)) --vnc --boot-script opendesktop.sh
This uses the Ubuntu 20 server cloudimg to create a new GNS3 appliance with a thin provisioned disk resized to 1024*1024 MB = 1 TB.
Although the disk holds less than 5 GB of data once the installation scripts finishes, the qcow2 disk file balloons to over 35 GB, and watching the processes running in the virtual machine shows that the culprit is "ext4lazyinit".
I posted a question about this at https:/
Shutting down the instance, mounting the disk using qemu-nbd, and running "debugfs -R dump_unused" on the first partition shows all kind of junk in the unused blocks.
Running "zerofree" on the partition shows hundreds of thousands of blocks being zeroed
Then using "qemu-img convert -O qcow2" to copy the disk image to another qcow2 file and discard zero blocks reduces its size to 4.3 GB.
I tried modifying gns3 to set discard=on option on the qemu command line; this seems to have no effect.
Here's an actual qemu command line (called from gns3):
/usr/bin/
The qemu disk image was created by "qemu-img create", backed by ubuntu-
My best guess is that this is a bug in qemu's handling of disk DISCARD operations.
Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https:/ /wiki.ubuntu. com/Bugs/ FindRightPackag e. You might also ask for help in the #ubuntu-bugs irc channel on Libera.chat.
To change the source package that this bug is filed about visit https:/ /bugs.launchpad .net/ubuntu/ +bug/1974100/ +editstatus and add the package name in the text box next to the word Package.
[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]