Score:0

Why does fsck not working when I try to repair the filesystem

in flag

I try to mount /dev/nvme0n1p1.

Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 980 PRO 500GB               
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: B1ED7DE3-D07A-2646-9A21-14A2ABF7CEB2

Device         Start       End   Sectors   Size Type
/dev/nvme0n1p1  2048 976773119 976771072 465.8G Linux filesystem

This doesn't work because I get this error

mount(2) system call failed: Structure needs cleaning.
dmesg(1) may have more information after failed mount system call.

After repairing it with fsck I always get the same error as already shown above.

EDIT: I rerun the fsck with -f -v and changed the output. The output showed new errors.

# sudo fsck -f -v /dev/nvme0n1p1 -y

e2fsck 1.46.6-rc1 (12-Sep-2022)
Pass 1: Checking inodes, blocks, and sizes
Inode 7 has illegal block(s).  Clear? yes

Illegal block #10280 (3396235583) in inode 7.  CLEARED.
Illegal block #10281 (1077962448) in inode 7.  CLEARED.
Illegal block #10282 (3443790753) in inode 7.  CLEARED.
Illegal block #10283 (2332978542) in inode 7.  CLEARED.
Illegal block #13384 (3894653357) in inode 7.  CLEARED.
Illegal block #13385 (3589061118) in inode 7.  CLEARED.
Illegal block #13386 (3771666462) in inode 7.  CLEARED.
Illegal block #13387 (2292560503) in inode 7.  CLEARED.
Illegal block #13416 (3837606578) in inode 7.  CLEARED.
Illegal block #13417 (3377237814) in inode 7.  CLEARED.
Illegal block #13418 (2597835013) in inode 7.  CLEARED.
Too many illegal blocks in inode 7.
Clear inode? yes

Restarting e2fsck from the beginning...
ext2fs_open2: Superblock checksum does not match superblock
fsck.ext4: Superblock invalid, trying backup blocks...
Resize inode not valid.  Recreate? yes

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
Block bitmap differences:  +(32768--33851) +(98304--99387) +(163840--164923) +(229376--230459) +(294912--295995) +(819200--820283) +(884736--885819) +(1605632--1606715) +(2654208--2655291) +(4096000--4097083) +(5768066--5768069) +5768073 +(5768075--5768080) +(5768082--5768083) +5768085 +(5768090--5768091) +(5768094--5768095) +(5768098--5768100) +(5768104--5768111) +5768113 +5768117 +(5768119--5768120) +5768122 +(5768126--5768129) +(5768132--5768133) +(5768135--5768136) +(5768138--5768139) +(5768142--5768146) +(5768148--5768150) +(5768152--5768154) +(5768156--5768157) +(5768160--5768161) +5768164 +5768168 +5768170 +5768172 +(5768174--5768175) +5768177 +5768179 +(5768182--5768184) +(5768187--5768188) +5768191 +5770187 +5772235 -5779403 -5781451 -5785547 -5788619 -5799883 +6293451 +6295499 -6319051 -6830027 -6842315 -6846411 +7344075 +7347147 -7351243 -7353291 -7361483 -7363531 -7364555 -7368651 +7865217 +(7865219--7865224) +(7865226--7865232) +7865236 +(7865239--7865240) +(7865242--7865244) +(7865249--7865251) +7865256 +7865258 +7865261 +(7865263--7865264) +7865267 +(7865269--7865272) +(7865275--7865280) +(7865282--7865283) +(7865286--7865287) +7865290 +7865292 +(7865295--7865296) +(7865298--7865299) +(7865302--7865303) +(7865305--7865306) +7865309 +(7865311--7865312) +(7865314--7865315) +7865320 +7865322 +7865325 +(7865328--7865329) +(7865332--7865333) +(7865335--7865336) +7865338 +7865341 +7865343 +7866315 -7884747 -7885771 -7893963 +(7962624--7963707) +8389579 -8408011 -8416203 +8913867 -8930251 +9438155 +9441227 +9444299 +9445323 -9446347 -9452491 -9455563 -9456587 -9464779 -9466827 +(11239424--11240507) +(20480000--20481083) +(23887872--23888955) +(30933888--30933889) +(30933893--30933895) +30933897 +30933900 +30933902 +30933904 +(30933906--30933907) +(30933912--30933914) +30933918 +(30933920--30933923) +30933926 +(30933929--30933932) +30933934 +(30933936--30933937) +(30933939--30933943) +(30933947--30933948) +30933951 +30933953 +(30933955--30933958) +30933961 +(30933963--30933964) +30933967 +(30933969--30933972) +30933974 +30933976 +30933979 +30933981 +30933987 +30933989 +(30933991--30933992) +(30933995--30933997) +(30933999--30934001) +30934003 +30934005 +(30934009--30934010) +(30934012--30934013) +30934015 +30936011 +30940107 -30945227 -30952395 -30956491 +31459275 -31466443 -31469515 -31470539 -31471563 -31474635 -31482827 -31487947 -31489995 +(31982465--31982467) +31982471 +(31982475--31982478) +31982480 +31982483 +(31982487--31982490) +(31982493--31982495) +(31982499--31982501) +31982503 +(31982506--31982508) +(31982510--31982511) +(31982513--31982514) +(31982516--31982522) +31982525 +(31982527--31982531) +(31982533--31982535) +31982538 +31982541 +(31982543--31982544) +31982547 +31982551 +31982553 +31982556 +31982559 +(31982561--31982562) +31982565 +(31982567--31982571) +31982573 +(31982575--31982576) +31982581 +(31982583--31982584) +(31982586--31982588) +(31982590--31982591) +31988683 +32512971 +32513995 -32519115 -32524235 +33033163 +33038283 -33048523 -33049547 -33060811 +33560523 -33566667 -33572811 -33575883 -33579979 -33582027 -33584075 -33586123 +34086859 -34099147 -34105291 -34108363 -34109387 +34603979 +34609099 +34610123 -34620363 -34622411 -34628555 -67645387 -67652555 -67654603 -67661771 +68162507 -68168651 -68187083 +68686795 -68705227 -68709323 +69206987 +(69207937--69207938) +69207940 +69207946 +(69207948--69207949) +(69207951--69207957) +(69207962--69207963) +(69207965--69207966) +(69207968--69207973) +69207976 +(69207978--69207982) +69207985 +69207994 +69207996 +69207998 +(69208000--69208001) +69208003 +69208008 +(69208011--69208013) +(69208015--69208019) +69208025 +(69208027--69208029) +(69208032--69208033) +69208035 +(69208037--69208039) +(69208041--69208044) +69208046 +69208049 +(69208056--69208058) +69212107 -69216203 -69229515 +69737419 -69757899 -69759947 +(70255488--70255492) +70255494 +(70255497--70255501) +70255505 +(70255507--70255508) +(70255510--70255511) +70255515 +(70255519--70255520) +70255523 +70255525 +(70255531--70255535) +(70255537--70255538) +70255540 +(70255543--70255544) +(70255549--70255550) +70255553 +70255561 +(70255564--70255567) +(70255572--70255573) +70255579 +(70255582--70255584) +(70255587--70255589) +(70255591--70255592) +(70255595--70255599) +(70255603--70255604) +70255606 +70255610 +70255613 +70258635 -70265803 -70267851 +70780875 +70783947 +70785995 -70791115 -70800331 -70806475 -70808523 +71306187 +71311307 -71313355 -71314379 -71322571 -71323595 -71325643 -71332811 -71333835 -71334859 +(71663616--71664699) +(78675968--78677051) +100665291 -100673483 +101192651 -101218251 +101714891 -101742539 +(102239105--102239106) +(102239108--102239109) +102239113 +(102239116--102239118) +(102239121--102239122) +(102239126--102239128) +(102239132--102239134) +102239137 +102239139 +102239141 +(102239146--102239147) +102239149 +(102239151--102239152) +(102239154--102239158) +(102239164--102239165) +102239167 +(102239173--102239174) +102239176 +102239178 +(102239180--102239183) +(102239185--102239186) +102239190 +(102239193--102239194) +(102239198--102239200) +102239202 +102239207 +(102239210--102239211) +(102239213--102239214) +(102239216--102239220) +(102239222--102239223) +102239225 +102239227 +102239230 +102240203 +102241227 -102246347 +(102400000--102401083) +102762443 -102771659 -102773707 -102777803 -102785995 -102787019 +103285638 +(103285641--103285642) +(103285644--103285645) +103285647 +103285650 +103285656 +103285659 +103285661 +103285663 +(103285666--103285668) +(103285670--103285671) +(103285674--103285676) +(103285678--103285679) +(103285682--103285689) +103285691 +(103285695--103285697) +(103285699--103285700) +(103285702--103285703) +103285707 +103285711 +103285713 +(103285716--103285717) +103285719 +103285721 +103285724 +(103285727--103285729) +103285732 +(103285735--103285739) +103285742 +(103285745--103285746) +103285756 +103285759 +103288779 -103295947 -103302091 -103308235 +103811019 +103815115 +103816139 -103839691 -103840715 +104335307 +(104336256--104336258) +104336262 +(104336264--104336265) +104336267 +104336271 +104336273 +104336276 +(104336279--104336280) +(104336282--104336285) +(104336287--104336289) +104336291 +104336294 +104336297 +104336299 +104336303 +104336315 +(104336317--104336318) +(104336321--104336323) +(104336329--104336330) +(104336332--104336337) +(104336339--104336340) +(104336344--104336345) +(104336347--104336352) +(104336358--104336359) +104336364 +(104336367--104336369) +104336372 +(104336375--104336377) +104336381 +104339403 -104344523
Fix? yes

Free blocks count wrong for group #0 (23453, counted=23454).
Fix? yes

Free blocks count wrong (119899042, counted=119899043).
Fix? yes

Directories count wrong for group #3713 (2790064128, counted=0).
Fix? yes

Padding at end of inode bitmap is not set. Fix? yes


/dev/nvme0n1p1: ***** FILE SYSTEM WAS MODIFIED *****

          11 inodes used (0.00%, out of 30531584)
           0 non-contiguous files (0.0%)
           0 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 2/1
     2197341 blocks used (1.80%, out of 122096384)
           0 bad blocks
           0 large files

           0 regular files
           2 directories
           0 character device files
           0 block device files
           0 fifos
           0 links
           0 symbolic links (0 fast symbolic links)
           0 sockets
------------
           2 files

Is there anything I do wrong or do I miss something?

diya avatar
la flag
In your question I miss you following up on the initial system recommendation: *`dmesg(1) may have more information after failed mount system call.`* - What additional error messages, if any, did the kernel give you? What output is `dmesg` showing?
John Mahowald avatar
cn flag
For comparison, see this other question on ext4 mount problems where they included dmesg information, which included inode and block number: https://serverfault.com/questions/1074552/mount-filesystem-with-structure-needs-cleaning-on-ext4 You will not have the same problem, just note that you can expect the file system code to printk something in this type of error situation.
CrazyDuck avatar
in flag
`dmesg`showed me, that the mounting point was duplicated. After deleting the duplcates I had no other errors in relation to mounting the SSD.
CrazyDuck avatar
in flag
I used `sudo file -s /dev/nvme0n1` and this showed me the following output: `/dev/nvme0n1: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 976773167 sectors, extended partition table (last)` This is a bit confusing because the drive stands in no relation with my Win10 partition.
Score:0
in flag

I found the solution. After running sudo gdisk /dev/nvme0n1 I got the following output:

GPT fdisk (gdisk) version 1.0.9

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.

If you use the p command it shows you where your drive has already used blocks. The easiest way to fix this -> x -> z and then both 'yes'. Then you cleaned (AND DELETED) your complete drive. After that create a new partition table with gdisk, fdisk or gparted and create a new partition with some unallocated space BEFORE the partition (in my case it was before, sometimes you need to let free space afterwards). The next step is to clean the structure and then you are able to mount.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.