I'm trying to automatically create cloud images using virt-builder.

I am using the following command in Centos 7 and it keeps failing. Any idea behind the issue ?

# virt-builder debian-9 -o /var/lib/libvirt/images/DB9-20G.qcow2 --format qcow2 --hostname ip.com --update --root-password password:root123 --firstboot-command 'dhclient ens3' --size 20G

This is the output:

[   2.3] Downloading: http://libguestfs.org/download/builder/debian-9.xz
[   3.3] Planning how to build this image
[   3.3] Uncompressing
[   6.2] Resizing (using virt-resize) to expand the disk to 20.0G
virt-resize: error: libguestfs error: resize2fs: e2fsck 1.42.9 
(28-Dec-2013)
/dev/sda1 has unsupported feature(s): metadata_csum
e2fsck: Get a newer version of e2fsck!

If reporting bugs, run virt-resize with debugging enabled and include the 
complete output:

  virt-resize -v -x [...]

Update-01: Seems e2fsprogs in Centos 7 is quite old to handle this issue. Is there any alternative way to better handle creating of cloud images on fly from command line ?

e2fsprogs as shipped with CentOS 7 is slightly too old to understand the ext4 filesystem feature metadata_csum with which that disk image was built. Userland support appeared in 1.43 (as the way outdated wiki suggested it might).

The wiki also states that old tools which don't understand the feature aren't safe to use with it.

Thus, you were advised to: "Get a newer version of e2fsck!"

In my ideal world Red Hat would backport this bit into e2fsprogs, or just rebase it, but I wouldn't count on that.

Since you're building newer operating system images, you should consider using a more modern operating system as the workstation. I use Fedora (currently 27, occasionally betas) for similar purposes.

  • Thanks for the update. I agree using more modern operating system but as i dont want to keep changing the host OS in my server I am sticking latest version of Centos i.e Centos 7. – codingfreak Jan 26 at 19:00
  • For your server that is probably fine, but then you would need to build these images elsewhere, or perhaps backport e2fsprogs yourself. – Michael Hampton Jan 26 at 20:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.