[GH-ISSUE #1575] qemu-img can't write VMDK sparse image #824

Closed
opened 2026-03-04 01:49:06 +03:00 by kerem · 1 comment
Owner

Originally created by @FATruden on GitHub (Feb 16, 2021).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1575

Additional Information

The following information is very important in order to help us to help you. Omission of the following details may delay your support request or receive no attention at all.
Keep in mind that the commands we provide to retrieve information are oriented to GNU/Linux Distributions, so you could need to use others if you use s3fs on macOS or BSD

Version of s3fs being used (s3fs --version)

v1.87

Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse)

2.9.2-11

Kernel information (uname -r)

3.10.0-1127.19.1.el7.x86_64

GNU/Linux Distribution, if applicable (cat /etc/os-release)

CentOS Linux release 7.8.2003 (Core)

s3fs command line used, if applicable

s3fs test-big /mnt -o url=https://our-ceph-storage/ -o use_path_request_style -o dbglevel=info -o curldbg -o no_check_certificate

/etc/fstab entry, if applicable

s3fs syslog messages (grep s3fs /var/log/syslog, journalctl | grep s3fs, or s3fs outputs)

if you execute s3fs with dbglevel, curldbg option, you can get detail debug messages

Details about issue

I'm not sure that there is a problem. Maybe you can help me to understand.

I try to convert qcow2 disk image to VMDK image:

qemu-img convert -f qcow2 -O vmdk /EBS/old.qcow2 /mnt/new.vmdk
qemu-img: Could not open '/mnt/new.vmdk': File truncated, expecting at least 196608 bytes

/mnt - is s3fs mount point.

By default qemu-img creates vmdk file as sparse file.

I tried to debug this by strace and you can see all syscalls with this FD (/mnt/new.vmdk):

open("/mnt/new.vmdk", O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0644) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
ftruncate(11, 0)            = 0 <===== size 0
close(11)

stat("/mnt/new.vmdk", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/mnt/new.vmdk", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 <===== size 0
close(11)                   = 0

stat("/mnt/new.vmdk", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/mnt/new.vmdk", O_RDWR|O_CLOEXEC) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lseek(11, 0, SEEK_END)      = 0 <===== size 0
fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0


pwrite64(11, "KDMV", 4, 0)  = 4
pwrite64(11, "\1\0\0\0\3\0\0\0\0\0 \0\0\0\0\0\200\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0"..., 75, 4 <unfinished ...>

fstat(11, {st_mode=S_IFREG|0644, st_size=79, ...}) = 0 <===== new size 79
fstat(11, {st_mode=S_IFREG|0644, st_size=79, ...}) = 0

ftruncate(11, 196608)       = 0 <===== new size 196608
lseek(11, 0, SEEK_END)      = 79 <===== why is SEEK_END at 79?

pwrite64(11, "\26\0\0\0\32\0\0\0\36\0\0\0\"\0\0\0&\0\0\0*\0\0\0.\0\0\0002\0\0\0"..., 512, 10752 <unfinished ...>

pwrite64(11, "\227\0\0\0\233\0\0\0\237\0\0\0\243\0\0\0\247\0\0\0\253\0\0\0\257\0\0\0\263\0\0\0"..., 512, 76800 

fdatasync(11)
close(11)                   = 0

stat("/mnt/new.vmdk", {st_mode=S_IFREG|0644, st_size=77312, ...}) = 0 why is size = 77312?
open("/mnt/new.vmdk", O_RDWR|O_CLOEXEC) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=77312, ...}) = 0
lseek(11, 0, SEEK_END)      = 77312
fstat(11, {st_mode=S_IFREG|0644, st_size=77312, ...}) = 0
pwrite64(11, "# Disk DescriptorFile\nversion=1\n"..., 310, 512) = 310
fdatasync(11)

write(2, "qemu-img: Could not open '/mnt/n"..., 90qemu-img: Could not open '/mnt/new.vmdk': File truncated, expecting at least 196608 bytes

in the end - qemu-img expects 196608 but actual size is (77312):

ll /mnt/new.vmdk
-rw-r--r-- 1 root root 77312 Feb 16 19:42 /mnt/new.vmdk
Originally created by @FATruden on GitHub (Feb 16, 2021). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1575 ### Additional Information _The following information is very important in order to help us to help you. Omission of the following details may delay your support request or receive no attention at all._ _Keep in mind that the commands we provide to retrieve information are oriented to GNU/Linux Distributions, so you could need to use others if you use s3fs on macOS or BSD_ #### Version of s3fs being used (s3fs --version) v1.87 #### Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse) 2.9.2-11 #### Kernel information (uname -r) 3.10.0-1127.19.1.el7.x86_64 #### GNU/Linux Distribution, if applicable (cat /etc/os-release) CentOS Linux release 7.8.2003 (Core) #### s3fs command line used, if applicable ``` s3fs test-big /mnt -o url=https://our-ceph-storage/ -o use_path_request_style -o dbglevel=info -o curldbg -o no_check_certificate ``` #### /etc/fstab entry, if applicable ``` ``` #### s3fs syslog messages (grep s3fs /var/log/syslog, journalctl | grep s3fs, or s3fs outputs) _if you execute s3fs with dbglevel, curldbg option, you can get detail debug messages_ ``` ``` ### Details about issue I'm not sure that there is a problem. Maybe you can help me to understand. I try to convert qcow2 disk image to VMDK image: ``` qemu-img convert -f qcow2 -O vmdk /EBS/old.qcow2 /mnt/new.vmdk qemu-img: Could not open '/mnt/new.vmdk': File truncated, expecting at least 196608 bytes ``` `/mnt` - is s3fs mount point. By default qemu-img creates vmdk file as sparse file. I tried to debug this by strace and you can see all syscalls with this FD (/mnt/new.vmdk): ``` open("/mnt/new.vmdk", O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0644) = 11 fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 ftruncate(11, 0) = 0 <===== size 0 close(11) stat("/mnt/new.vmdk", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 open("/mnt/new.vmdk", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 11 fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 <===== size 0 close(11) = 0 stat("/mnt/new.vmdk", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 open("/mnt/new.vmdk", O_RDWR|O_CLOEXEC) = 11 fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 lseek(11, 0, SEEK_END) = 0 <===== size 0 fstat(11, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 pwrite64(11, "KDMV", 4, 0) = 4 pwrite64(11, "\1\0\0\0\3\0\0\0\0\0 \0\0\0\0\0\200\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0"..., 75, 4 <unfinished ...> fstat(11, {st_mode=S_IFREG|0644, st_size=79, ...}) = 0 <===== new size 79 fstat(11, {st_mode=S_IFREG|0644, st_size=79, ...}) = 0 ftruncate(11, 196608) = 0 <===== new size 196608 lseek(11, 0, SEEK_END) = 79 <===== why is SEEK_END at 79? pwrite64(11, "\26\0\0\0\32\0\0\0\36\0\0\0\"\0\0\0&\0\0\0*\0\0\0.\0\0\0002\0\0\0"..., 512, 10752 <unfinished ...> pwrite64(11, "\227\0\0\0\233\0\0\0\237\0\0\0\243\0\0\0\247\0\0\0\253\0\0\0\257\0\0\0\263\0\0\0"..., 512, 76800 fdatasync(11) close(11) = 0 stat("/mnt/new.vmdk", {st_mode=S_IFREG|0644, st_size=77312, ...}) = 0 why is size = 77312? open("/mnt/new.vmdk", O_RDWR|O_CLOEXEC) = 11 fstat(11, {st_mode=S_IFREG|0644, st_size=77312, ...}) = 0 lseek(11, 0, SEEK_END) = 77312 fstat(11, {st_mode=S_IFREG|0644, st_size=77312, ...}) = 0 pwrite64(11, "# Disk DescriptorFile\nversion=1\n"..., 310, 512) = 310 fdatasync(11) write(2, "qemu-img: Could not open '/mnt/n"..., 90qemu-img: Could not open '/mnt/new.vmdk': File truncated, expecting at least 196608 bytes ``` in the end - qemu-img expects 196608 but actual size is (77312): ``` ll /mnt/new.vmdk -rw-r--r-- 1 root root 77312 Feb 16 19:42 /mnt/new.vmdk ```
kerem closed this issue 2026-03-04 01:49:06 +03:00
Author
Owner

@gaul commented on GitHub (Apr 25, 2021):

@FATruden Thanks for the detailed bug report! It made fixing this easy.

<!-- gh-comment-id:826243482 --> @gaul commented on GitHub (Apr 25, 2021): @FATruden Thanks for the detailed bug report! It made fixing this easy.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#824
No description provided.