Fedora Linux Support Community & Resources Center
  #1  
Old 7th March 2009, 07:27 PM
jtmoon07 Offline
Registered User
 
Join Date: Mar 2007
Location: WA, USA
Posts: 19
Question how do I find names of files affected by fsck ?

Hi,

I would like to know the names of files affected by fsck.ext3 .
It seems like this is an important feature entirely missing from fsck.

Currently, the only information fsck shows is block numbers and inode numbers.
like Inode 310945 has a extra size (33252) which is invalid

Is there a way to find out file names affected by an fsck repair (specifically fsck.ext3)?
Is there a different program that can lookup block numbers to file names?


-J_Tom_Moon_79

btw, this is also posted here: http://www.linuxquestions.org/questi...y-fsck-709867/
__________________
-JTMoon79
Reply With Quote
  #2  
Old 7th March 2009, 11:01 PM
gthill Offline
Registered User
 
Join Date: May 2005
Location: g-land, east java
Age: 50
Posts: 387
Is this what you are after

[gordon@tc2 ~]$ ls -i /etc/hosts # to find the inode reference
65603189 /etc/hosts
[gordon@tc2 ~]$ sudo find / -inum 65603189 # to find the pathname reference
/etc/sysconfig/networking/profiles/default/hosts
/etc/hosts
[gordon@tc2 ~]$
Reply With Quote
  #3  
Old 8th March 2009, 12:12 AM
jtmoon07 Offline
Registered User
 
Join Date: Mar 2007
Location: WA, USA
Posts: 19
yes, that's close, thanks.
How would I find the name of the file that fsck is currently repairing? More specifically,
given an unmounted filesystem with fsck running, how would I find the name of the files referenced by the inode numbers fsck reports?

given gthill's suggestion,
something like this psuedo code might work
  1. run fsck in read-only mode (no changes made)
    and capture fsck output to a file
    fsck -N /dev/sdb > fsck-output.txt
  2. parse fsck output file for all inode numbers
    cat fsck-output.txt | grep inode /d+ > fsck-output-inodes.txt
  3. mount the suspect filesystem (the reason fsck should offer the file name lookup option, is this mount step will often fail if the filesystem superblock is damaged)
    mount /dev/sdb /mnt/sdb
  4. lookup all inode numbers
    foreach $i in fsck-output-inodes.txt ; do
    find /mnt/sdb -inum $i ;
    done

I would prefer that fsck offered to do this work itself. so it goes...
-J_Tom_Moon_79
__________________
-JTMoon79
Reply With Quote
  #4  
Old 8th March 2009, 12:03 PM
gthill Offline
Registered User
 
Join Date: May 2005
Location: g-land, east java
Age: 50
Posts: 387
I am not quite sure what you are trying to achieve but you might find
ls -Ri /mnt/sdb1 > inode.list
to be useful for obtaining all inodes on the mounted partition. Then you can use grep to lookup the filename.
This is much faster than using find for each inode number
eg.
for i in `cat fsck-output-inodes.txt`
do grep $i inode.list
done
Reply With Quote
  #5  
Old 8th March 2009, 08:24 PM
jtmoon07 Offline
Registered User
 
Join Date: Mar 2007
Location: WA, USA
Posts: 19
Thanks for the suggestion.

I would like to see file names printed by fsck, something like this:
$ fsck /dev/sdb1
...
Inode 310945 (/foobar/somefile.txt) has a extra size (33252) which is invalid
...
In this case, /foobar/somefile.txt is the file name, as seen from the root of the filesystem on /dev/sdb1, that is affected by the inode problem that fsck found.

That doesn't appear possible with fsck.
So the next best thing I'm trying to achieve is a method that would associate inode numbers with file names before fsck makes changes to the filesystem.
This way I can understand the files that will be affected by fsck (instead of inodes affected, which for me the end-user, is useless).

-J_Tom_Moon_79
Reply With Quote
Reply

Tags
ext3, fsck, fsck.ext3, inode

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query rmp database to find files affected by last update? Vector Using Fedora 3 5th October 2008 03:25 AM
fsck.vfat on large image files tonyingesson Using Fedora 0 27th June 2008 10:28 PM
fsck can't find ext3fs label? VSarkiss Using Fedora 1 9th December 2007 12:25 AM
find security-affected packages jzim Security and Privacy 5 4th August 2007 09:34 PM


Current GMT-time: 02:23 (Thursday, 02-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat