User avatar
paaland
Posts: 71
Joined: Mon Mar 12, 2012 2:30 pm
Location: Norway
Contact: Website

How to check filesystem for errors

Fri Jun 15, 2012 8:20 am

After my last reboot the root file-system was mounted read-only due to an error. dmesg reports:

Code: Select all

[   39.556518] EXT4-fs error (device mmcblk0p3): add_dirent_to_buf:1270: inode #                                                   204: block 8322: comm dhclient-script: bad entry in directory: rec_len % 4 != 0                                                    - offset=3584(3584), inode=17498628, rec_len=26739, name_len=97
[   39.590756] EXT4-fs (mmcblk0p3): Remounting filesystem read-only
[   39.606110] EXT4-fs error (device mmcblk0p3) in ext4_evict_inode:170: Readonl                                                  y filesystem
How to force a check and make ths fs read-write again?
Dragon 32>BBC Model B>PC>PC>PC>PC>Raspberry PI (circle complete)

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: How to check filesystem for errors

Fri Jun 15, 2012 8:41 am

fsck is the command to check and repair the filesystem
http://linux.die.net/man/8/fsck

Respectech
Posts: 53
Joined: Sat Sep 29, 2012 12:27 am

Re: How to check filesystem for errors

Thu Sep 12, 2013 6:03 am

Problem with fsck is this:

$ fsck
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/mmcblk0p2 is mounted.



WARNING!!! The filesystem is mounted. If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.


Do you really want to continue<n>?

-----

The proper way to check is this:

shut down and check the file system on reboot:
sudo shutdown -F -r now

after the RasPI is up and running again, check the results in /var/log/fsck/

User avatar
VascoFerraz
Posts: 78
Joined: Thu Aug 30, 2012 11:54 am

Re: How to check filesystem for errors

Mon Apr 04, 2016 9:05 am

Hi,

Is this command working on Jessie?

The issue is in -F or -f flags. If I don't use them, the system reboots fine.

I am getting this message:

Code: Select all

[email protected]:/ $ sudo shutdown -F -r now
Code should not be reached 'Unhandled option' at ../src/systemctl/systemctl.c:6316, function shutdown_parse_argv(). Aborting.
Thanks.

Vasco
Vasco Ferraz

User avatar
jojopi
Posts: 3041
Joined: Tue Oct 11, 2011 8:38 pm

Re: How to check filesystem for errors

Mon Apr 04, 2016 9:19 am

If the filesystem goes read-only due to serious errors, fsck should run on the next boot automatically. (Assuming the corruption does not prevent booting.)

I do not see much point forcing an fsck that the system does not think it needs. However, one way to do so in jessie is to add to /boot/cmdline.txt: "fsck.mode=force fsck.repair=yes".

User avatar
VascoFerraz
Posts: 78
Joined: Thu Aug 30, 2012 11:54 am

Re: How to check filesystem for errors

Mon Apr 04, 2016 11:00 am

Thanks for the explanation.
Vasco Ferraz

jahboater
Posts: 2928
Joined: Wed Feb 04, 2015 6:38 pm

Re: How to check filesystem for errors

Mon Apr 04, 2016 5:23 pm

Or stick the SD card in a card reader and plug it into a Pi or any Linux system, then run fsck.

Return to “Raspbian”

Who is online

Users browsing this forum: Bing [Bot] and 30 guests