Gentoo Archives: gentoo-user

From: "Poison BL." <poisonbl@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Identifying a file by a block number...how?
Date: Thu, 18 Dec 2014 21:14:43
Message-Id: CAOTuDKrgTQH2hk5rJEQLgndQ2qtEzm=9mZzyqmWgOtcQO3N3ag@mail.gmail.com
In Reply to: [gentoo-user] Identifying a file by a block number...how? by meino.cramer@gmx.de
1 On Thu, Dec 18, 2014 at 3:24 PM, <meino.cramer@×××.de> wrote:
2 > Hi,
3 >
4 > with
5 >
6 > sysctl vm.block_dump=1
7 >
8 > one can enable the logging of IO to the harddisk/flashmem/...
9 > into dmesg.
10 > The logs report the block number of the file in question...
11 > but not the filename itsself.
12 >
13 > Is there any other way as examine each single file of the
14 > filesystem to find the file to which a certain block number
15 > is assigned?
16 >
17 > Thank you very mcuh for any help!
18 > Best regards,
19 > Meino
20 >
21 >
22 >
23
24 That depends entirely on the filesystem being used. In the case of
25 ext2/3/4, I believe /sbin/debugfs will do the trick with its icheck
26 command to get the inode, and once you have the inode, you can get the
27 filename via find. What I'm not 100% certain of is whether the block
28 numbers involved map 1:1 with physical sectors, and how that plays
29 with the 512B vs 4KB sectors, etc. With NTFS it's a hair quicker with
30 ntfscluster and ntfsinfo doing the trick fairly trivially (I use a
31 tool centered around that combo to identify files lost when I recover
32 peoples windows drives with ddrescue).
33
34 --
35 Poison [BLX]
36 Joshua M. Murphy

Replies

Subject Author
Re: [gentoo-user] Identifying a file by a block number...how? Sid S <r030t1@×××××.com>