files and disk sectors
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Feb 5 17:05:51 UTC 2009
On Wed, Feb 04, 2009 at 03:20:39PM -0500, Matt Price wrote:
> thanks colin and lennart,
>
> On Wed, 2009-02-04 at 14:00 -0500, Lennart Sorensen wrote:
> > On Wed, Feb 04, 2009 at 01:44:33PM -0500, Matt Price wrote:
> > > while i'm thinking about this, is there a way to tell which files sit on
> > > a particular disk sector? something is accessing the bad sector on my
> > > disk over and over again, presumably reading a config file or something;
> > > if i could move that file to another sector things might get better for
> > > me.
> > >
>
> just to clarify, this is an ext3 fs on /dev/sda5
>
> > Try debugfs (in read only mode and with the filesystem mounted readonly)
> > and use icheck to find the inode number using the block (mapping block
> > to sector is going to be a different problem).
> >
> > Often the block size is 4k, but you can check with tune2fs -l on the
> > device. If it is 4k, well then your block number would be 1/8th of the
> > sector number. So sector 2 is in block 0, sector 14 is in block 1,
> > sector 55 is in block 6, etc.
>
> tune2fs shows block size of 4096 = 4k. dmesg gives this error:
> [231699.913878] end_request: I/O error, dev sda, sector 293198250
>
> so my first pass would be to call this block 36649781.
Right, except you have to subtract the start sector of the partition
first to convert to a partition sector number rather than a physical
disk sector number.
> > Of course you have to adjust the sector from starting at the begining of
> > disk to starting at the begining of the partition, so check the start
> > location of the partition using fdisk -lu to get the sector the
> > partition starts on, and subtract that from the physical sector number.
> >
> > So if your sector number was 123456789 and your partition starts at
> > sector 240000, you would get sector 123216789 on the partition which
> > would then be block 15402098 on the partition (and hence of the
> > filesystem). icheck 15402098 in debugfs on the partition should then
> > hopefully give you which inode number is using that block (and hence
> > sector). Then use ncheck with the inode number to get a list of paths
> > which refer to that inode number. This should hopefully find the file
> > you are dealing with.
>
> fdisk -lu gives:
> Device Boot Start End Blocks Id System
> /dev/sda1 63 465884 232911 83 Linux
> /dev/sda2 465885 61898444 30716280 83 Linux
> /dev/sda3 61898445 133580474 35841015 83 Linux
> /dev/sda4 133580475 488392064 177405795 5 Extended
> /dev/sda5 133580538 484295489 175357476 83 Linux
> ^ start of bad partition
>
> /dev/sda6 484295553 488392064 2048256 82 Linux swap /
>
> so do i want (293198250+133580538)/8= 53347348 ? or rather
> (293198250-133580538)/8=19952214 ? at first i thought you meant the
> former but the latter seems to make more sense, and also groups the bad
> sector nicely in with my other bad sectors, which is kinda comforting.
> currently running debugfs with the latter number, the first number gave
No you subtract. If sector 293198250 is the problem, and your partition
starts at 133580538, then the sector is number 159617712 in the
partition, and hence block 19952214. After all sector 159617712 on a
partition starting with 133580538 would be sector 293198250 from the
beginning of the disk.
> me:
> 53347348 <block not found>
> but this one is taking forever -- hanging on the dead sector no doubt --
> so thought i'd send this off without waiting for the outcome (esp in
> case my machine goes belly-up in the interim...)
--
Len Sorensen
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list