tytso / e2fsprogs

Ext2/3/4 file system utilities
http://ext4.wiki.kernel.org
373 stars 219 forks source link

Can't repair ext4 partition after power outage, e2fsck keeps crashing #157

Closed zanerv closed 1 year ago

zanerv commented 1 year ago

After power outage, e2fsck couldn't repair ext4 and keeps throwing errors.

tune2fs -l /dev/sda2 :

tune2fs 1.45.5 (07-Jan-2020)
Filesystem volume name:   <none>
Last mounted on:          /root
Filesystem UUID:          61243e27-0f9f-4177-b475-3ce53073ca30
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         unsigned_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         not clean with errors
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              427257856
Block count:              3418032896
Reserved block count:     34180328
Free blocks:              3390809331
Free inodes:              397262837
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      418
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         4096
Inode blocks per group:   256
Flex block group size:    16
Filesystem created:       Sun Dec  6 13:22:22 2020
Last mount time:          Mon Jul 31 20:27:20 2023
Last write time:          Tue Aug  1 10:30:01 2023
Mount count:              21
Maximum mount count:      -1
Last checked:             Sun Dec  6 13:22:22 2020
Check interval:           0 (<none>)
Lifetime writes:          26 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      4e824684-88ad-4664-8d42-e3ba3d1de370
Journal backup:           inode blocks
FS Error count:           620135
First error time:         Thu Jan  1 00:00:14 1970
First error function:     ext4_validate_inode_bitmap
First error line #:       98
First error inode #:      0
First error block #:      0
Last error time:          Mon Jul 31 20:40:06 2023
Last error function:      ext4_validate_inode_bitmap
Last error line #:        98
Last error inode #:       0
Last error block #:       0
Checksum type:            crc32c
Checksum:                 0x448319a8

e2fsck /dev/sda2

e2fsck 1.45.5 (07-Jan-2020)
/dev/sda2 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Signal (6) SIGABRT si_code=SI_TKILL
e2fsck(+0x2fb80)[0x5558ba3b80]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x7f7cb27690]
/lib/aarch64-linux-gnu/libc.so.6(gsignal+0xe0)[0x7f7c89d138]
/lib/aarch64-linux-gnu/libc.so.6(abort+0x110)[0x7f7c889d68]
/lib/aarch64-linux-gnu/libext2fs.so.2(+0x14038)[0x7f7ca98038]
/lib/aarch64-linux-gnu/libext2fs.so.2(+0x14094)[0x7f7ca98094]
/lib/aarch64-linux-gnu/libext2fs.so.2(+0x303b8)[0x7f7cab43b8]
e2fsck(e2fsck_read_bitmaps+0x88)[0x5558b9c6b0]
e2fsck(e2fsck_pass5+0x90)[0x5558b970c0]
e2fsck(e2fsck_run+0x54)[0x5558b87224]
e2fsck(main+0x1490)[0x5558b83b70]
/lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe8)[0x7f7c88a090]
e2fsck(+0x118d8)[0x5558b858d8]

e2fsck -f /dev/sda2

e2fsck 1.45.5 (07-Jan-2020)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Signal (6) SIGABRT si_code=SI_TKILL

e2fsck -cpttv /dev/sda2

Signal (6) SIGABRT si_code=SI_TKILL
e2fsck(+0x2fb80)[0x556ebceb80]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x7fa0994690]
/lib/aarch64-linux-gnu/libc.so.6(gsignal+0xe0)[0x7fa070a138]
/lib/aarch64-linux-gnu/libc.so.6(abort+0x110)[0x7fa06f6d68]
/lib/aarch64-linux-gnu/libext2fs.so.2(+0x14038)[0x7fa0905038]
/lib/aarch64-linux-gnu/libext2fs.so.2(+0x14094)[0x7fa0905094]
/lib/aarch64-linux-gnu/libext2fs.so.2(+0x303b8)[0x7fa09213b8]
e2fsck(e2fsck_read_bitmaps+0x88)[0x556ebc76b0]
e2fsck(read_bad_blocks_file+0x44)[0x556ebc592c]
e2fsck(main+0x1a30)[0x556ebaf110]
/lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe8)[0x7fa06f7090]
e2fsck(+0x118d8)[0x556ebb08d8]

smartctl -H /dev/sda


smartctl 7.1 2019-12-30 r5022 [aarch64-linux-4.9.277-82] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED


Can't find out what's wrong?
I tried testdisk and can see all my files and directories.
There is a similar issue(#85), but that had fast_commit enabled
zanerv commented 1 year ago

I had to cancel a running e2fsck, and now it doesn't give any errors, just Killed

e2fsck -fv /dev/sda2

e2fsck 1.45.5 (07-Jan-2020)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Killed
zanerv commented 1 year ago

for those having the same issue, just run e2fsck on beefier system with more ram