Free space can be larger that size of volume if doing online resizing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I noticed a problem when doing ext4 online resizing and using according
resize parameters when creating the file system to allow for larger size
increase.

The problem was initially found on kernel v4.14.65, but I could verify
that it is still present in v4.19-rc2.

The script performs the following actions:

- a logical volume is created
- a new file system is created within
- the file system is mounted
- the logical volume size is increased
- the file system is resized
=> here the df already reports a free size larger than the size of the
file system

df -h /mnt
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg-foo31  1.1G  -16T   17T    - /mnt

- the file system is resized to a larger size
=> here the resize2fs will loop forever because a underflow happens
there when processing the file system information

A script for reproducing the problem as attached as reproducer, its
output is attached as reproducer.log

I already contacted tytso@xxxxxxx as Maintainer of the e2fsprogs and he
told me it seems to be a problem with the online resizing in the kernel.

I noticed that the problems disappears if I reduced the resize option to
a third of the value (357913941 instead of the current 1073741824).

With Regards,

	Torsten Hilbrich
# bash -x reproducer foo31
+ set -e
+ VG=vg
+ NAME=foo31
+ '[' -z foo31 ']'
+ lvcreate -n foo31 -L128M /dev/vg
  /dev/sdb: open failed: No medium found
  Logical volume "foo31" created.
+ mke2fs -F -m0 -b 4096 -t ext4 -O 'resize_inode,^has_journal' -E resize=1073741824 /dev/vg/foo31
mke2fs 1.44.3 (10-July-2018)
Discarding device blocks:  4096/32768           done                            
Creating filesystem with 32768 4k blocks and 32768 inodes

Allocating group tables: 0/1   done                            
Writing inode tables: 0/1   done                            
Writing superblocks and filesystem accounting information: 0/1   done

+ mount /dev/vg/foo31 /mnt
+ lvextend -f --size 1708M /dev/vg/foo31
  /dev/sdb: open failed: No medium found
  Size of logical volume vg/foo31 changed from 128.00 MiB (32 extents) to <1.67 GiB (427 extents).
  Logical volume vg/foo31 successfully resized.
+ df -h /mnt
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/vg-foo31  124M  2.1M  120M   2% /mnt
+ resize2fs /dev/vg/foo31 2361000s
resize2fs 1.44.3 (10-July-2018)
Filesystem at /dev/vg/foo31 is mounted on /mnt; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/vg/foo31 is now 295125 (4k) blocks long.

+ df -h /mnt
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/vg-foo31  1.1G  -16T   17T    - /mnt
+ resize2fs /dev/vg/foo31 3109200s
resize2fs 1.44.3 (10-July-2018)
^C
#!/bin/bash

set -e

VG="vg"
NAME="$1"
if [ -z "$NAME" ]; then
   echo "Need name as parameter" >&2
   exit 1
fi

lvcreate -n $NAME -L128M /dev/$VG
mke2fs -F -m0 -b 4096 -t ext4 -O resize_inode,^has_journal -E resize=1073741824 /dev/$VG/$NAME 
mount /dev/$VG/$NAME /mnt
lvextend -f --size 1708M /dev/$VG/$NAME
df -h /mnt
resize2fs /dev/$VG/$NAME 2361000s
df -h /mnt
resize2fs /dev/$VG/$NAME 3109200s
umount /mnt

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux