[Libguestfs] [PATCH] make-fs: Don't use du --apparent-size to estimate input size.

Richard W.M. Jones rjones at redhat.com
Tue Feb 18 14:22:19 UTC 2020


On Tue, Feb 18, 2020 at 04:15:36PM +0200, Nikolay Ivanets wrote:
> > I think it's a difficult problem and one which won't be solved using
> > du.  For comparison we have some nbdkit plugins for creating
> > filesystems and they are far more sophisticated, especially this one:
> > https://github.com/libguestfs/nbdkit/tree/master/plugins/floppy
> >
> > I would note that the reason the test fails was nothing to do with
> > free space.  It was actually running out of inodes.  With ext2/3/4 the
> > number of inodes in the metadata is fixed at creation and based on the
> > size of the disk (see /etc/mke2fs.conf inode_ratio and the mke2fs -i
> > and -N options).  Because of the small size of the disk, mke2fs was
> > choosing < 100 inodes, but because the test had 100+ files it failed
> > when creating the later files even though there was enough disk space.
> > There's no easy way to fix this.  I think it could even be considered
> > as a bug in mke2fs.
> >
> > Rich.
> 
> I've did extra testing and the issue really appears for small file systems
> composed from 100 x 10-bytes files or so because of lack of free inodes.
> Nevertheless we cannot swear that virt-make-fs will work for any possible
> file systems or set of files.--size=+N is for the rescue in such cases.
> 
> Your patch made things worse because of sparse files.
> I think we cannot apply it.

Sure, I've dropped it, it doesn't address the actual problem.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list