I am using some Debian VMs with f2fs root partition for development. My host machine crashed for some reason and this caused the f2fs partitions in the VMs to become corrupted. I tried to boot from Debian Live and repair the partitions but failed. ----------------------------------------------------------- root@debian:/# uname -a Linux debian 6.1.0-15-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09) x86_64 GNU/Linux root@debian:/# fsck.f2fs -V fsck.f2fs 1.16.0 (2023-04-11) root@debian:/# fsck.f2fs -f -d 3 /dev/nvme0n1p2 Info: Force to fix corruption Info: Debug level = 3 Info: MKFS version "Linux version 6.1.0-15-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09)" Info: FSCK version from "Linux version 6.1.0-15-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09)" to "Linux version 6.1.0-15-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09)" Info: superblock features = 0 : Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000 Info: fs errors: inconsistent_node_count +--------------------------------------------------------+ | Super block | +--------------------------------------------------------+ magic [0xf2f52010 : 4076150800] major_ver [0x 1 : 1] volum_name [] minor_ver [0x f : 15] log_sectorsize [0x 9 : 9] log_sectors_per_block [0x 3 : 3] log_blocksize [0x c : 12] log_blocks_per_seg [0x 9 : 9] segs_per_sec [0x 1 : 1] secs_per_zone [0x 1 : 1] checksum_offset [0x 0 : 0] block_count [0x efdd00 : 15719680] section_count [0x 7737 : 30519] segment_count [0x 77ed : 30701] segment_count_ckpt [0x 2 : 2] segment_count_sit [0x 4 : 4] segment_count_nat [0x 74 : 116] segment_count_ssa [0x 3c : 60] segment_count_main [0x 7737 : 30519] segment0_blkaddr [0x 200 : 512] cp_blkaddr [0x 200 : 512] sit_blkaddr [0x 600 : 1536] nat_blkaddr [0x e00 : 3584] ssa_blkaddr [0x f600 : 62976] main_blkaddr [0x 16e00 : 93696] root_ino [0x 3 : 3] node_ino [0x 1 : 1] meta_ino [0x 2 : 2] cp_payload [0x 0 : 0] crc [0x 0 : 0] version Linux version 6.1.0-15-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09) Info: Segments per section = 1 Info: Sections per zone = 1 Info: total FS sectors = 125757440 (61405 MB) Info: CKPT version = 251861d5 +--------------------------------------------------------+ | Checkpoint | +--------------------------------------------------------+ checkpoint_ver [0x251861d5 : 622354901] user_block_count [0x ea8800 : 15370240] valid_block_count [0x 707851 : 7370833] rsvd_segment_count [0x fe : 254] overprov_segment_count [0x 1f3 : 499] free_segment_count [0x 36a6 : 13990] alloc_type[CURSEG_HOT_NODE] [0x 0 : 0] alloc_type[CURSEG_WARM_NODE] [0x 0 : 0] alloc_type[CURSEG_COLD_NODE] [0x 0 : 0] cur_node_segno[0] [0x 21e : 542] cur_node_segno[1] [0x f07 : 3847] cur_node_segno[2] [0x b47 : 2887] cur_node_blkoff[0] [0x 2e : 46] cur_node_blkoff[1] [0x dc : 220] cur_node_blkoff[2] [0x 9b : 155] alloc_type[CURSEG_HOT_DATA] [0x 0 : 0] alloc_type[CURSEG_WARM_DATA] [0x 0 : 0] alloc_type[CURSEG_COLD_DATA] [0x 0 : 0] cur_data_segno[0] [0x ef7 : 3831] cur_data_segno[1] [0x 7583 : 30083] cur_data_segno[2] [0x 2e79 : 11897] cur_data_blkoff[0] [0x 15b : 347] cur_data_blkoff[1] [0x e2 : 226] cur_data_blkoff[2] [0x 7 : 7] ckpt_flags [0x c6 : 198] cp_pack_total_block_count [0x 5 : 5] cp_pack_start_sum [0x 2 : 2] valid_node_count [0x e8922 : 952610] valid_inode_count [0x e7b7c : 949116] next_free_nid [0x c5355 : 807765] sit_ver_bitmap_bytesize [0x 80 : 128] nat_ver_bitmap_bytesize [0x e80 : 3712] checksum_offset [0x ffc : 4092] elapsed_time [0x 549f : 21663] sit_nat_version_bitmap[0] [0x c6 : 198] do_record_fsync_data: [node] ino = 24573, nid = 0, blkaddr = 2063580 recover_data: ino = 24573, nid = 0, recorded = 0, err = 0 do_record_fsync_data: [node] ino = 471286, nid = 0, blkaddr = 2063581 recover_data: ino = 471286, nid = 0, recorded = 0, err = 0 [ASSERT] (do_record_fsync_data:3475) 0
Can you please try below patch? https://git.kernel.org/pub/scm/linux/kernel/git/chao/f2fs-tools.git/commit/?h=dev-test&id=20678a083d967948f3eeac6a61c17f691addaccd
That works! Thank you for your efforts.
(In reply to Kane Ch'in from comment #2) > That works! Thank you for your efforts. Thank you for the confirmation! I found above link is expired, let me attach the lore one for who wants check it later. https://lore.kernel.org/linux-f2fs-devel/20240114182118.38596-1-chao@kernel.org