Bug 253754 - growfs(8): Fails to resize with 13.0-BETA3: "is not clean - run fsck."
Summary: growfs(8): Fails to resize with 13.0-BETA3: "is not clean - run fsck."
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL: https://reviews.freebsd.org/D29021
Keywords: needs-qa, regression
Depends on:
Blocks: 231027
  Show dependency treegraph
 
Reported: 2021-02-22 09:21 UTC by Daniel Morante
Modified: 2021-03-09 14:15 UTC (History)
5 users (show)

See Also:
koobs: maintainer-feedback+
koobs: mfc-stable13?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Morante 2021-02-22 09:21:24 UTC
I'm testing 13.0-BETA3 in a Bhyve virtual machine. Whenever I try to resize the file system while it's mounted I get an error from growfs saying the filesystem "is not clean - run fsck.". The fsck error is misleading.  The file system is clean and running it does not change anything.

For example:

```
    root@freebsd:~ # growfs /dev/gpt/storage0
    growfs: /dev/gpt/storage0 is not clean - run fsck.
    
    root@freebsd:~ # umount /dev/gpt/storage0
    root@freebsd:~ # growfs /dev/gpt/storage0
    It's strongly recommended to make a backup before growing the file system.
    OK to grow filesystem on /dev/gpt/storage0 from 35GB to 45GB? [yes/no] yes
    super-block backups (for fsck_ffs -b #) at:
     74266176, 75546624, 76827072, 78107520, 79387968, 80668416, 81948864, 83229312, 84509760, 85790208, 87070656, 88351104, 89631552, 90912000,
     92192448, 93472896
```

In a 12.2-RELEASE vm it works as expected:

```
root@freebsd:~ # growfs /dev/gpt/storage0
Device is mounted read-write; resizing will result in temporary write suspension for /mnt/storage0.
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/gpt/storage0, mounted on /mnt/storage0, from 1.0GB to 2.0GB? [yes/no] yes
super-block backups (for fsck_ffs -b #) at:
 2097088, 2621312, 3145536, 3669760
```

The same occurs if I try the resize on the root volumes. I'm using the images from https://download.freebsd.org/ftp/releases/VM-IMAGES/ and the storage device is a just a disk image.
Comment 1 Andrey Fesenko 2021-03-01 17:18:11 UTC
Confirm FreeBSD-13.0-BETA4

Simple default install (auto ufs), tested bhyve and vmware. If mount raw partition on host, growfs work fine, or single user https://64.media.tumblr.com/619e06b701b5a5beabc17441a3f23691/5263be8dddbbc666-47/s1280x1920/49722e0d1b8f0e2b5b3cf3ce1e1bddee8da7f941.png

This bug exist longtime ago,more half year

 root@checkfs:~ # gpart show
 =>     40  6291376  da0  GPT  (3.0G)
       40     1024    1  freebsd-boot  (512K)
     1064  6290352    2  freebsd-ufs  (3.0G)

 root@checkfs:~ # df -h /
 Filesystem    Size    Used   Avail Capacity  Mounted on
 /dev/da0p2    2.8G    1.1G    1.4G    44%    /
 root@checkfs:~ # growfs /dev/da0p2
 growfs: /dev/da0p2 is not clean - run fsck.
 
 root@checkfs:~ # fsck -y /dev/da0p2
 ** /dev/da0p2 (NO WRITE)
 ** SU+J Recovering /dev/da0p2
 
 USE JOURNAL? no
 
 ** Skipping journal, falling through to full fsck
 
 SETTING DIRTY FLAG IN READ_ONLY MODE
 
 UNEXPECTED SOFT UPDATE INCONSISTENCY
 ** Last Mounted on /
 ** Root file system
 ** Phase 1 - Check Blocks and Sizes
 ** Phase 2 - Check Pathnames
 ** Phase 3 - Check Connectivity
 ** Phase 4 - Check Reference Counts
 ** Phase 5 - Check Cyl groups
 16543 files, 294909 used, 426570 free (562 frags, 53251 blocks, 0.1%  fragmentation)
 root@checkfs:~ # growfs /dev/da0p2
 growfs: /dev/da0p2 is not clean - run fsck.
 
 root@checkfs:~ # dumpfs -m /dev/da0p2
 # newfs command for /dev/da0p2 (/dev/da0p2)
 newfs -O 2 -U -a 32 -b 32768 -d 32768 -e 4096 -f 4096 -g 16384 -h 64 -i 8192 -j -k 6400 -m 8 -o time -s 5972992 /dev/da0p2
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2021-03-02 09:57:16 UTC
(In reply to Andrey Fesenko from comment #1)

Any chance of a bisection?
Comment 3 Andrey Fesenko 2021-03-02 10:50:37 UTC
(In reply to Kubilay Kocak from comment #2)
Unfortunately not, I only remember that this behavior has been for a long time.

Since the release is approaching, I decided to check it out and was surprised that it was not fixed.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2021-03-02 20:33:09 UTC
Ah, this is the responsible commit:

commit 6eb925f8450ffbb849195f26e26bfd4eadbcfb1d
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date:   Sun Oct 25 01:36:33 2020 +0000

    Filesystem utilities that modify the filesystem (growfs(8), tunefs(8),
    and fsirand(8)) should check the filesystem status and require that
    fsck(8) be run if it is unclean. This requirement is not imposed on
    fsdb(8) or clri(8) since they may be used to clean up a filesystem.
    
    MFC after:    2 weeks
    Sponsored by: Netflix

Notes:
    svn path=/head/; revision=367035
Comment 5 Ed Maste freebsd_committer freebsd_triage 2021-03-02 22:44:54 UTC
A proposed patch in https://reviews.freebsd.org/D29021
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-03-03 23:36:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0dcde5cc12744e5188300711a8829e5e6a9cd0de

commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-03-02 22:35:48 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-03-03 23:35:21 +0000

    growfs: allow operation on RW-mounted filesystems

    growfs supports growing mounted filesystems (writes are temporarily
    suspended while the grow happens).  Drop the check for fs_clean == 0
    to restore this case.  Leave fs_flags check for FS_UNCLEAN or
    FS_NEEDSFSCK which represent the state of the filesystem when it was
    mounted, and fsck should be run first if they are set.

    PR:             253754
    Reviewed by:    mckusick
    MFC after:      3 days
    Fixes:          6eb925f8450f ("Filesystem utilities that modify the...")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D29021

 sbin/growfs/growfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-03-06 01:13:34 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b5920128c7ebcf5060605928263a54b31b317993

commit b5920128c7ebcf5060605928263a54b31b317993
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-03-02 22:35:48 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-03-06 01:12:12 +0000

    growfs: allow operation on RW-mounted filesystems

    growfs supports growing mounted filesystems (writes are temporarily
    suspended while the grow happens).  Drop the check for fs_clean == 0
    to restore this case.  Leave fs_flags check for FS_UNCLEAN or
    FS_NEEDSFSCK which represent the state of the filesystem when it was
    mounted, and fsck should be run first if they are set.

    PR:             253754
    Reviewed by:    mckusick
    Fixes:          6eb925f8450f ("Filesystem utilities that modify the...")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D29021

    (cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de)

 sbin/growfs/growfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-03-06 01:13:36 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=56d80e35a3338e10e7670823f264cd82443c9d1e

commit 56d80e35a3338e10e7670823f264cd82443c9d1e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-03-02 22:35:48 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-03-06 01:13:09 +0000

    growfs: allow operation on RW-mounted filesystems

    growfs supports growing mounted filesystems (writes are temporarily
    suspended while the grow happens).  Drop the check for fs_clean == 0
    to restore this case.  Leave fs_flags check for FS_UNCLEAN or
    FS_NEEDSFSCK which represent the state of the filesystem when it was
    mounted, and fsck should be run first if they are set.

    PR:             253754
    Reviewed by:    mckusick
    Fixes:          6eb925f8450f ("Filesystem utilities that modify the...")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D29021

    (cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de)

 sbin/growfs/growfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2021-03-06 19:47:33 UTC
A commit in branch releng/13.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d25741b633af6652fe8bfff1cb157a31e66cc60

commit 8d25741b633af6652fe8bfff1cb157a31e66cc60
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-03-02 22:35:48 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-03-06 19:46:31 +0000

    growfs: allow operation on RW-mounted filesystems

    growfs supports growing mounted filesystems (writes are temporarily
    suspended while the grow happens).  Drop the check for fs_clean == 0
    to restore this case.  Leave fs_flags check for FS_UNCLEAN or
    FS_NEEDSFSCK which represent the state of the filesystem when it was
    mounted, and fsck should be run first if they are set.

    PR:             253754
    Reviewed by:    mckusick
    Approved by:    re (gjb)
    Fixes:          6eb925f8450f ("Filesystem utilities that modify the...")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D29021

    (cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de)
    (cherry picked from commit b5920128c7ebcf5060605928263a54b31b317993)

 sbin/growfs/growfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 10 Ed Maste freebsd_committer freebsd_triage 2021-03-09 14:15:38 UTC
Now merged to all affected branches and will be in FreeBSD 13.0