Bug 816098 - virt-make-fs fails to make a btrfs filesystem because it doesn't allocate enough space
virt-make-fs fails to make a btrfs filesystem because it doesn't allocate eno...
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-25 05:19 EDT by Richard W.M. Jones
Modified: 2012-05-03 11:49 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-03 11:49:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2012-04-25 05:19:58 EDT
Description of problem:

btrfs has a minimum filesystem size of 256 MB.  virt-make-fs
doesn't take this into account when estimating the size of
filesystem to create, so if the input files are less than this
size it will fail with an error similar to:

mkfs: btrfs: /dev/vda1: device /dev/vda1 is too small (must be at least 256 MB) at /usr/bin/virt-make-fs line 451.

Version-Release number of selected component (if applicable):

1.17.33

How reproducible:

100%

Steps to Reproduce:
1. Choose a small tarball (much smaller than 256 MB in size)
2. virt-make-fs -F qcow2 -t btrfs --partition=mbr input.tar output.qcow2

Actual results:

Fails with an error as above.

Expected results:

It should increase the estimate to the minimum size and thus
not fail.

Additional info:
Comment 1 Richard W.M. Jones 2012-04-25 05:25:29 EDT
Note that the overhead of btrfs is much larger than expected.
eg: With a 6 MB tarball, a 512 MB disk doesn't have enough space:

$ virt-make-fs -F qcow2 -t btrfs --partition=mbr --size=512M \
    libguestfs-1.17.1.tar.gz /tmp/disk.qcow2
Formatting '/tmp/disk.qcow2', fmt=qcow2 size=536870912 encryption=off cluster_size=65536 
virt-make-fs: error copying contents into filesystem
An error here usually means that the program did not estimate the
filesystem size correctly.  Please read the BUGS section of the manpage.
tar_in: tar subcommand failed on directory: /: tar: libguestfs-1.17.1/ChangeLog: Cannot write: No space left on device
tar: libguestfs-1.17.1/.gitignore: Cannot write: No space left on device
[...]

With a 1 GB filesystem, only 388 MB is usable, indicating an
overhead of 636 MB just for btrfs(!)

$ virt-make-fs ... --size=1G ...
$ virt-df -h /tmp/disk.qcow2 
Filesystem                                Size       Used  Available  Use%
disk.qcow2:/dev/sda1                      1.0G        37M       351M    4%
Comment 4 Richard W.M. Jones 2012-05-03 09:37:03 EDT
Patches posted to the upstream mailing list:
https://www.redhat.com/archives/libguestfs/2012-May/msg00015.html
Comment 5 Richard W.M. Jones 2012-05-03 11:49:08 EDT
Fixed in 1.17.39.

Note You need to log in before you can comment on or make changes to this bug.