You are not logged in.

#1 2010-10-23 02:21:37

MaBeef
Member
Registered: 2010-05-21
Posts: 10

Find file that owns a given block (JFS)?

Well my 8 year old 160GB Western Digital is finally starting to fail. It's making clicking noises and sometimes it quits responding for about a minute, so obviously it's dying. I've been lazy with my backups and hadn't done one in months so I had to pull everything off of it. Fortunately it didn't die during the backup.

Out of curiosity I've been running tests on it. smartctl seems to think it's overall healthy somehow but both smartctl and badblocks found 5 blocks that are bad. I figured out based on the block numbers that they're near the beginning of my home partition somewhere. So what I'm wondering is if there's a way to find out which files own those blocks so I can figure out if anything important got messed up. Since that partition is formatted with JFS I looked into the man page of jfs_debugfs but didn't immediately see anything that could help me.

BTW, I actually did run a diff -r against my old backup but that didn't help verify any new files or files I changed.

Offline

#2 2010-10-28 00:35:24

MaBeef
Member
Registered: 2010-05-21
Posts: 10

Re: Find file that owns a given block (JFS)?

Turns out the drive wasn't failing, it was just a bad SATA power cord coming from my PSU. One of the wires has a break in it so if you use any of the plugs from that cord the drive will turn off and on anytime the wires move. I've got it on the other SATA power cord and now it's working fine, no clicks, no bad blocks, no reallocated sectors.

Also, I found the answer to my original question. With jfs_debugfs you can get the inode number by running the command "d (blocknum) 0 i". di_number is the inode number. From there you can find the file for that inode using the find command with the -inum option. You'll want to search just on the partition that bad block is on though in case there are files on different partitions with the same inode number. I'm going to post a small guide about this on the wiki though it's going to be very JFS specific.

Offline

#3 2010-10-28 10:27:22

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: Find file that owns a given block (JFS)?

Regardless of file system, you can use find:

find /home -xdev -inum 1234 -print

Replace /home with the mount of the block device you want to search.

Offline

Board footer

Powered by FluxBB