Just checked gparted's source code:
https://github.com/GNOME/gparted/blob/GPARTED_1_7_0/src/f2fs.cc#L135

Seems unlikely. :/

On Tue, Apr 15, 2025 at 8:34 PM Chao Yu <c...@kernel.org> wrote:
>
> On 4/16/25 03:28, Juhyung Park wrote:
> > Hm.
> >
> > Would this be what @uplinkr might have encountered?
>
> Maybe, :)
>
> @uplinkr, previously, if you used '-s' parameter while expand-resizing,
> that could be the reason it corrupted your partition.
>
> Thanks,
>
> >
> > On Mon, Apr 14, 2025 at 4:13 AM Chao Yu via Linux-f2fs-devel
> > <linux-f2fs-devel@lists.sourceforge.net> wrote:
> >>
> >> w/ below testcase, resize will generate a corrupted image which
> >> contains inconsistent metadata:
> >>
> >> touch img
> >> truncate -s $((512*1024*1024*1024)) img
> >> mkfs.f2fs -f img $((256*1024*1024))
> >> resize.f2fs -s img -t $((1024*1024*1024))
> >> mount img /mnt/f2fs
> >>
> >> [   31.725200] F2FS-fs (loop0): Wrong bitmap size: sit: 192, 
> >> sit_blk_cnt:4762
> >> [   31.728441] F2FS-fs (loop0): Failed to get valid F2FS checkpoint
> >>
> >> The root cause is safe mode (via -s option) is not compatible
> >> w/ expand resize, due to in safe mode, we will keep all parameters
> >> related to NAT, SIT, SSA area, e.g. sit_bitmap_size, however, we
> >> will update segment_count_main according new partition size, result
> >> in there is no enough sit_bitmap and SIT blocks to address the
> >> entire block address of new partition.
> >>
> >> Adding a check condition to avoid expanding partition in safe
> >> mode, and change manual accordingly.
> >>
> >> Signed-off-by: Chao Yu <c...@kernel.org>
> >> ---
> >>  fsck/resize.c     | 12 ++++++++----
> >>  man/resize.f2fs.8 |  2 +-
> >>  2 files changed, 9 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/fsck/resize.c b/fsck/resize.c
> >> index 1ab7d75..58914ec 100644
> >> --- a/fsck/resize.c
> >> +++ b/fsck/resize.c
> >> @@ -756,18 +756,22 @@ int f2fs_resize(struct f2fs_sb_info *sbi)
> >>
> >>         /* may different sector size */
> >>         if ((c.target_sectors * c.sector_size >>
> >> -                       get_sb(log_blocksize)) < get_sb(block_count))
> >> +                       get_sb(log_blocksize)) < get_sb(block_count)) {
> >>                 if (!c.safe_resize) {
> >>                         ASSERT_MSG("Nothing to resize, now only supports 
> >> resizing with safe resize flag\n");
> >>                         return -1;
> >>                 } else {
> >>                         return f2fs_resize_shrink(sbi);
> >>                 }
> >> -       else if (((c.target_sectors * c.sector_size >>
> >> +       } else if (((c.target_sectors * c.sector_size >>
> >>                         get_sb(log_blocksize)) > get_sb(block_count)) ||
> >> -                       c.ignore_error)
> >> +                       c.ignore_error) {
> >> +               if (c.safe_resize) {
> >> +                       ASSERT_MSG("Expanding resize doesn't support safe 
> >> resize flag");
> >> +                       return -1;
> >> +               }
> >>                 return f2fs_resize_grow(sbi);
> >> -       else {
> >> +       } else {
> >>                 MSG(0, "Nothing to resize.\n");
> >>                 return 0;
> >>         }
> >> diff --git a/man/resize.f2fs.8 b/man/resize.f2fs.8
> >> index bdda4fd..5b6daf5 100644
> >> --- a/man/resize.f2fs.8
> >> +++ b/man/resize.f2fs.8
> >> @@ -69,7 +69,7 @@ Skip caution dialogue and resize partition directly.
> >>  Specify support write hint.
> >>  .TP
> >>  .BI \-s
> >> -Enable safe resize.
> >> +Enable safe resize, it can only be used w/ shrink resize.
> >>  .TP
> >>  .BI \-V
> >>  Print the version number and exit.
> >> --
> >> 2.49.0
> >>
> >>
> >>
> >> _______________________________________________
> >> Linux-f2fs-devel mailing list
> >> Linux-f2fs-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to