LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Problem running fsck on SD card containing raspberry pi distro (https://www.linuxquestions.org/questions/linux-software-2/problem-running-fsck-on-sd-card-containing-raspberry-pi-distro-4175487870/)

bomberb17 12-13-2013 02:23 PM

Problem running fsck on SD card containing raspberry pi distro
 
Hello all,
I have Arch linux installed on a 4GB SD card for my raspberry pi. Strange things were happening lately so I took the SD out and ran fsck on my Ubuntu computer. By running fsck I was getting a lot of errors so I tried running fsck with the -a option. But I got:
Code:

panos@ubuntu:~$ sudo fsck -a /dev/sdf2
fsck from util-linux 2.20.1
/dev/sdf2 contains a file system with errors, check forced.
/dev/sdf2: Resize inode not valid. 

/dev/sdf2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)

so i run fsck without -a. After getting lots of errors (hitting enter accepting default choices) I start getting errors as follows:

Code:

Directory inode 45366 has an unallocated block #215970.  Allocate<y>? yes

Directory inode 45366 has an unallocated block #215971.  Allocate<y>? yes

Directory inode 45366 has an unallocated block #215972.  Allocate<y>? yes

Directory inode 45366 has an unallocated block #215973.  Allocate<y>? yes

Directory inode 45366 has an unallocated block #215974.  Allocate<y>? yes

Directory inode 45366 has an unallocated block #215975.  Allocate<y>? yes

Directory inode 45366 has an unallocated block #215976.  Allocate<y>?

The problem is that I have to keep the enter key pressed all the time, and these errors just never end. I am sitting with the enter key pressed for over an hour and the errors just keep on. How can I overcome this to fix my SD?

qlue 12-14-2013 05:26 AM

The easiest way is to reformat and restore it from your backup. (You do have a backup I hope)
Depending on how much the card has been used, you may need to consider replacing it soon.

Can you still access the card to retrieve your data files?

bomberb17 12-14-2013 08:22 AM

I do have a backup but it is a little old.. The card is still accessible

qlue 12-14-2013 11:25 AM

Then what I'd do is backup all data files from the home directory and 're-flash' with the latest disk image. These flash memory cards tend to go wonky from time to time and, since they're only a few GiB, it's generally easier to reformat than to try to solve file system errors on them.
I usually use dd to make a simple, uncompressed backup which I can just dd back to the card whenever I need to 'restore' it. Works even better than a Windows restore point. ;)

jpollard 12-14-2013 11:57 AM

You can also try a "fsck -y" which answers yes to those questions...

panosvatikiotis 09-14-2016 07:49 AM

same problem here i run
e2fsck -fy /dev/sda2 for the last 24 hours and i still get:
Directory inode 656034 has an unallocated block #291984. Allocate? yes
however the block # is advancing


All times are GMT -5. The time now is 11:39 AM.