Fsck output does not match tutorials...

Keith keith at caramail.com
Sat Mar 26 17:36:33 UTC 2022


On 3/26/22 2:16 AM, Bo Berglund wrote:
> On Tue, 22 Mar 2022 17:45:36 -0500, Keith <keith at caramail.com> wrote:
>
>> On 3/22/22 3:21 PM, Bo Berglund wrote:
>>> I have an erroneous disk (it ran out of disk space during a sudo apt
>>> full-upgrade operation and Linux crashed).
>>> Linux won't boot now.
>>>
>>> I can put it into a USB carrier and examine it on another system:
>>>
>>> sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
>>> UUID                                 NAME        FSTYPE  SIZE MOUNTPOINT LABEL
>>> MODEL
>>>                                        sda                 7.4G
>>> UHSII_uSD_Reader
>>> 1591-0E10                            +-sda1      vfat    256M
>>> c14f2d5f-b499-41df-b7ce-15bdf933cdff +-sda2      ext4    7.2G <== repair?
>>>
>>> It turned out that free space on sda2 is zero, that is why Linux crashed, I
>>> guess.
>>> But now I have freed up 40% by deleting a few very big files in the home dir.
>>> But there is more to do because Linux will not boot anyway.
>>>
>>> So I figured I could do as several on-line tutorials suggest:
>>>
>>> sudo fsck -N /dev/sda2
>>> fsck from util-linux 2.33.1
>>> [/sbin/fsck.ext4 (1) -- /dev/sda2] fsck.ext4 /dev/sda2
>>>
>>> This response is not shown in any of the tutorials I found....
>>>
>>> What am I doing wrong?
>>> Can the disk be repaired?
>>>
>>
>> -N is not going to anything and the output is exactly what you would
>> expect. If you want a non-destructive check then try:
>>
>> sudo fsck.ext4 -n -v -f /dev/sda2
>>
>> This performs a forced, verbose, read-only filesystem check.
>> this is what it looks like for my USB drive /dev/sdf1
>>
>> sudo fsck.ext4 -n -v -f /dev/sdf1
>> e2fsck 1.45.5 (07-Jan-2020)
>> Warning!  /dev/sdf1 is mounted.
>> Warning: skipping journal recovery because doing a read-only filesystem
>> check.
>> 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
>>
>>           23532 inodes used (0.19%, out of 12189696)
>>             779 non-contiguous files (3.3%)
>>              19 non-contiguous directories (0.1%)
>>                 # of inodes with ind/dind/tind blocks: 0/0/0
>>                 Extent depth histogram: 23271/184
>>        13375930 blocks used (27.44%, out of 48740328)
>>               0 bad blocks
>>               1 large file
>>           20841 regular files
>>           2613 directories
>>               0 character device files
>>               0 block device files
>>               0 fifos
>>               0 links
>>              69 symbolic links (69 fast symbolic links)
>>               0 sockets
>> ------------
>>           23523 files
>>
>> If it finds problems, unmount the drive and rerun without the "-n"
>> option and with the "-p" option to autofix any filesystem errors that
>> doesn't require human intervention.
>>
>> sudo fsck.ext4 -v -f -p /dev/sda2
>
> Thanks Keith!
> So the tutorial I used did not show the correct options...
>
> I checked the drive again now, first with and then without -n:
>
> $ sudo fsck.ext4 -n -v -f /dev/sdb2
> e2fsck 1.46.2 (28-Feb-2021)
> 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
>
>        163625 inodes used (34.78%, out of 470496)
>           191 non-contiguous files (0.1%)
>           205 non-contiguous directories (0.1%)
>               # of inodes with ind/dind/tind blocks: 0/0/0
>               Extent depth histogram: 144828/73
>       1159490 blocks used (61.71%, out of 1879040)
>             0 bad blocks
>             1 large file
>
>        131668 regular files
>         13015 directories
>             0 character device files
>             0 block device files
>             0 fifos
>          1136 links
>         18856 symbolic links (18639 fast symbolic links)
>            77 sockets
> ------------
>        164752 files
>
>
> $ sudo fsck.ext4 -v -f /dev/sdb2
> e2fsck 1.46.2 (28-Feb-2021)
> 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
>
>        163625 inodes used (34.78%, out of 470496)
>           191 non-contiguous files (0.1%)
>           205 non-contiguous directories (0.1%)
>               # of inodes with ind/dind/tind blocks: 0/0/0
>               Extent depth histogram: 144828/73
>       1159490 blocks used (61.71%, out of 1879040)
>             0 bad blocks
>             1 large file
>
>        131668 regular files
>         13015 directories
>             0 character device files
>             0 block device files
>             0 fifos
>          1136 links
>         18856 symbolic links (18639 fast symbolic links)
>            77 sockets
> ------------
>        164752 files
>
> Did this actually do anything?
> It looks like it did not.
> So the problem is not errors on the file system but probably the truncation of
> some or several files due to disk space running out during an apt full-upgrade
> operation.
>

I'm not sure what happened with any truncation, but if fsck were to
correct filesystem errors, it would print out what its doing. You can
run the command again without the -f option and it'll likely not do
anything but print out that the filesystem is clean.

> THis cannot be solved by fsck.
>
> I have bitten the bullet and started over rebuilding the system from scratch on
> a new bigger disk. I can check my settings from the damaged disk since it is
> readable when mounted on a running system.
>
> I will now update my Linux notes and add these working fsck commands to them.
>
>
Another extN filesystem utility you may want to acquaint yourself with
is tune2fs. As you might guess this utility lets you tune/view
parameters of your extN filesystem. For example,

$ sudo tune2fs -l /dev/sda2

will non-destructively list the current parameters set on the extN
filesystem on /dev/sda2

--
Keith




More information about the ubuntu-users mailing list