Post Reply

[HOW TO] Check your filesystem (a la 'fsck')

OP ViperGeek

25th February 2013, 07:02 PM   |  #1  
ViperGeek's Avatar
OP Senior Member
Flag Merrimack, NH
Thanks Meter: 26
 
114 posts
Join Date:Joined: Sep 2008
More
I've been having lots of trouble with my SD and local filesystems getting corrupted, which in turn has been causing the flush-179 process to go ballistic (100% CPU loop, reboot hangs, etc.). If only there was a way to run a quick FSCK(8) on my Android's unmounted filesystems to check for problems. Well, there is!

This may be old, old news to some of the more seasoned OS hackers, so please be kind with any negative feedback about it being intuitively obvious. It wasn't to me, but after some research and testing, I've come up with these simple steps:
  1. Boot into Recovery
  2. Connect via USB to ADB shell
    Code:
       C:\Scratch\Android> adb devices
       C:\Scratch\Android> adb shell
  3. Mount /system and /data to determine the /dev/block names, then umount each
    Code:
       ~ # mount /system
       ~ # mount /data
       ~ # df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    tmpfs                   308620        64    308556   0% /dev
    /dev/block/mmcblk0p27
                            295509    121021    159231  43% /cache
    /dev/block/mmcblk0p26
                           1184268    848052    276060  75% /data
    /dev/block/mmcblk0p25
                            562384    461416     72400  86% /system
       ~ # umount /system
       ~ # umount /data
  4. Run e2fsck against each /dev/block filesystem
    Code:
       ~ # e2fsck -n /dev/block/mmcblk0p25
    e2fsck 1.41.6 (30-May-2009)
    /dev/block/mmcblk0p25: clean, 4168/35760 files, 117605/142847 blocks
       ~ # e2fsck -n /dev/block/mmcblk0p26
    e2fsck 1.41.6 (30-May-2009)
    /dev/block/mmcblk0p26: clean, 7173/75200 files, 216745/300799 blocks
       ~ #
The 'e2fsck' command takes the same command-line switches as UNIX FSCK(8), so you can be as creative and daring as you need.

- Dave
The Following 4 Users Say Thank You to ViperGeek For This Useful Post: [ View ]
25th April 2013, 04:32 PM   |  #2  
robcop19's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 10
 
148 posts
Join Date:Joined: Mar 2013
More
Smile some help
Quote:
Originally Posted by ViperGeek

I've been having lots of trouble with my SD and local filesystems getting corrupted, which in turn has been causing the flush-179 process to go ballistic (100% CPU loop, reboot hangs, etc.). If only there was a way to run a quick on my Android's unmounted filesystems to check for problems. Well, there is!

This may be old, old news to some of the more seasoned OS hackers, so please be kind with any negative feedback about it being intuitively obvious. It wasn't to me, but after some research and testing, I've come up with these simple steps:

  1. Boot into Recovery
  2. Connect via USB to ADB shell
    Code:
       C:\Scratch\Android> adb devices
       C:\Scratch\Android> adb shell
  3. Mount /system and /data to determine the /dev/block names, then umount each
    Code:
       ~ # mount /system
       ~ # mount /data
       ~ # df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    tmpfs                   308620        64    308556   0% /dev
    /dev/block/mmcblk0p27
                            295509    121021    159231  43% /cache
    /dev/block/mmcblk0p26
                           1184268    848052    276060  75% /data
    /dev/block/mmcblk0p25
                            562384    461416     72400  86% /system
       ~ # umount /system
       ~ # umount /data
  4. Run e2fsck against each /dev/block filesystem
    Code:
       ~ # e2fsck -n /dev/block/mmcblk0p25
    e2fsck 1.41.6 (30-May-2009)
    /dev/block/mmcblk0p25: clean, 4168/35760 files, 117605/142847 blocks
       ~ # e2fsck -n /dev/block/mmcblk0p26
    e2fsck 1.41.6 (30-May-2009)
    /dev/block/mmcblk0p26: clean, 7173/75200 files, 216745/300799 blocks
       ~ #
The 'e2fsck' command takes the same command-line switches as UNIX FSCK(8), so you can be as creative and daring as you need.

- Dave

on my phone i have a fiel called fsck.exfat and fsck_msod i think and im trying to run one (though not sure what the difference is) to fix some corrupted files in data internally. im trying to see if the file can be run through recovery without putting it through adb to unmount the data. im not too sure how to figure out what the data block is called because when i rum the mount i get a ton of different blocks (about 32 of them).
im trying to clean up the lost+found files i have and i have 3 of from a corrupted nandroid
The Following User Says Thank You to robcop19 For This Useful Post: [ View ]
25th April 2013, 04:59 PM   |  #3  
ViperGeek's Avatar
OP Senior Member
Flag Merrimack, NH
Thanks Meter: 26
 
114 posts
Join Date:Joined: Sep 2008
More
Quote:
Originally Posted by robcop19

on my phone i have a fiel called fsck.exfat and fsck_msod i think and im trying to run one (though not sure what the difference is) to fix some corrupted files in data internally. im trying to see if the file can be run through recovery without putting it through adb to unmount the data. im not too sure how to figure out what the data block is called because when i rum the mount i get a ton of different blocks (about 32 of them).
im trying to clean up the lost+found files i have and i have 3 of from a corrupted nandroid

Hi Rob.

I'm not sure if I can be of any specific assistance. exFAT is a type of filesystem format, like UNIX/Android ext3 and ext4, but beyond that, I couldn't tell you what those programs do. I do know that on some operating systems, the only way to fix the file chains and blocks is to make sure it's unmounted in single user mode. ADB is the closest we Android guys can get to UNIX single user mode without some clever Recovery Mode ZIP file programming.

– Dave
Last edited by ViperGeek; 25th April 2013 at 05:01 PM.
The Following User Says Thank You to ViperGeek For This Useful Post: [ View ]
25th April 2013, 05:17 PM   |  #4  
robcop19's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 10
 
148 posts
Join Date:Joined: Mar 2013
More
Smile alrighty
Quote:
Originally Posted by ViperGeek

Hi Rob.

I'm not sure if I can be of any specific assistance. , but beyond that, I couldn't tell you what those programs do. I do know that on some operating systems, the only way to fix the file chains and blocks is to make sure it's unmounted in single user mode. ADB is the closest we Android guys can get to UNIX single user mode without some clever Recovery Mode ZIP file programming.

Dave

well thank you for at least writing back on it. im not sure how to run adb let alone run the progrma to try and fix this but i will be learning up on it
25th April 2013, 05:27 PM   |  #5  
ViperGeek's Avatar
OP Senior Member
Flag Merrimack, NH
Thanks Meter: 26
 
114 posts
Join Date:Joined: Sep 2008
More
Quote:
Originally Posted by robcop19

well thank you for at least writing back on it. im not sure how to run adb let alone run the progrma to try and fix this but i will be learning up on it

ADB isn't all that difficult to use. Here's a good primer on it:

http://droidlessons.com/how-to-insta...-windows-7-pc/

Once installed, just boot your phone into Recovery (power off completely, then power on with the Vol Down key held, then select RECOVERY). Once it's sitting there, connect your phone to the PC via USB, wait for Windows to find the right drivers, and you're connected. 'adb devices' should list your phone in the "List of devices attached", after which you're good to go.

– Dave

ps. I've not tried it personally, but there's supposedly a "universal USB driver" available here:

https://plus.google.com/103583939320...ts/BQ5iYJEaaEH
25th April 2013, 05:31 PM   |  #6  
robcop19's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 10
 
148 posts
Join Date:Joined: Mar 2013
More
Smile wow
[QUOTE=ViperGeek;40700429]ADB isn't all that difficult to use. Here's a good primer on it:


Once installed, just boot your phone into Recovery (power off completely, then power on with the Vol Down key held, then select RECOVERY). Once it's sitting there, connect your phone to the PC via USB, wait for Windows to find the right drivers, and you're connected. 'adb devices' should list your phone in the "List of devices attached", after which you're good to go.

Dave

ps. I've not tried it personally, but there's supposedly a "universal USB driver" available here:

Wow thank you very much for the help youre giving me I will see if i can go and start finding a solution
The Following User Says Thank You to robcop19 For This Useful Post: [ View ]
19th June 2013, 01:32 AM   |  #7  
Junior Member
Thanks Meter: 2
 
17 posts
Join Date:Joined: Jun 2013
Quote:
Originally Posted by ViperGeek

The 'e2fsck' command takes the same command-line switches as UNIX FSCK(8), so you can be as creative and daring as you need.

- Dave

I figured this out about a week ago now I guess and did indeed find that there were corrupted partitions. My phone had been acting up for several weeks before and it pretty much unusable now. I do manage to clean system and data up, and was even able to flash a new ROM which I hadn't been able to, they'd always abort.

I have a question though, is this only good for ext2 partitions? I have the same version as shown in the tutorial and if you run 'e2fsck -V' the output makes me think that maybe it's not happy checking ext3 and ext4 partitions and that's why i was popping up errors, or at least that's why even when i fixed errors it maybe wasn't really fixing the issue.

Thanks.

I've got a different phone, but a search brought me here to this thread. I think my issues though are more corrupted memory rather than device specific so hope you don't mind my post here.
19th June 2013, 02:50 AM   |  #8  
bsmitty83's Avatar
Recognized Contributor
Flag Detroit
Thanks Meter: 7,779
 
2,534 posts
Join Date:Joined: Apr 2012
More
I think this will answer your question


http://linux.die.net/man/8/fsck.ext3

(It should be good for all ext partitions)

Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2
2nd October 2013, 05:29 PM   |  #9  
Junior Member
Flag suroboyo
Thanks Meter: 1
 
20 posts
Join Date:Joined: Mar 2010
More
ahh the good old fsck
glad i found this thread
thanks a lot mannnn
24th October 2013, 10:31 PM   |  #10  
ViperGeek's Avatar
OP Senior Member
Flag Merrimack, NH
Thanks Meter: 26
 
114 posts
Join Date:Joined: Sep 2008
More
One more helpful tidbit.

Even if you run 'e2fsck -n' and find a "clean" file system, it may be useful to force a scan via 'e2fsck -f'. This just happened to me. I had something funny going on, and so rebooted into recovery and checked my file systems. Everything was cool like Fonzie, which I didn't believe, and so I used 'e2fsck -f' and found lots of fuglies that got fixed.

Be careful running -f on a cross-linked file system like the /data partition on a Galaxy S3/S4. It can have the tendency to unlink the elfin magic Samsung used and make a mess.

- Dave
Last edited by ViperGeek; 26th October 2013 at 06:34 PM.

Post Reply Subscribe to Thread

Tags
filesystem, filesystem corruption, fsck, recovery
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes