All of lore.kernel.org
 help / color / mirror / Atom feed
* How to verify block numbers of file ?
@ 2011-02-20 13:22 kashish bhatia
  2011-02-20 14:02 ` Abhijit Hoskeri
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: kashish bhatia @ 2011-02-20 13:22 UTC (permalink / raw)
  To: kernelnewbies

Is there any method/command/utility to know what are the block numbers which
are allocated to a file in ext2 fs?

-- 
Regards,
Kashish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110220/9641f91e/attachment.html 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 13:22 How to verify block numbers of file ? kashish bhatia
@ 2011-02-20 14:02 ` Abhijit Hoskeri
  2011-02-20 15:17   ` kashish bhatia
  2011-02-21  5:43   ` Greg Freemyer
  2011-02-20 14:18 ` abhi
  2011-02-20 17:03 ` Manish Katiyar
  2 siblings, 2 replies; 13+ messages in thread
From: Abhijit Hoskeri @ 2011-02-20 14:02 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 6:52 PM, kashish bhatia <koolest77@gmail.com> wrote:
> Is there any method/command/utility to know what are the block numbers which
> are allocated to a file in ext2 fs?
>

The FIBMAP ioctl gives you the block number give an integer, which is
the nth block attached to the inode. It includes blocks allocated to
store indirect blocks too.

-Abhijit

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 13:22 How to verify block numbers of file ? kashish bhatia
  2011-02-20 14:02 ` Abhijit Hoskeri
@ 2011-02-20 14:18 ` abhi
  2011-02-20 17:03 ` Manish Katiyar
  2 siblings, 0 replies; 13+ messages in thread
From: abhi @ 2011-02-20 14:18 UTC (permalink / raw)
  To: kernelnewbies

Install sleuthkit. It has a bunch of utilities to examine metadata,
blocks, etc. Specifically, checkout istat.

On Sun, Feb 20, 2011 at 6:52 PM, kashish bhatia <koolest77@gmail.com> wrote:
> Is there any method/command/utility to know what are the block numbers which
> are allocated to a file in ext2 fs?
>
> --
> Regards,
> Kashish
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



-- 
Queer little twists and quirks go into the making of an individual.
To suppress them all and follow clock and calendar and creed until the
individual is lost in the neutral gray of the host is to be less than
true to our inheritance.
Life, that gorgeous quality of life, is not accomplished by following
another man's rules.
It is true we have the same hungers and same thirsts, but they are for
different things and in different ways and in different seasons.
Lay down your own day, follow it to its noon, or you will sit in an
outer hall listening to the chimes but never reaching high enough to
strike your own. - Angelo Patri

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 14:02 ` Abhijit Hoskeri
@ 2011-02-20 15:17   ` kashish bhatia
  2011-02-20 15:42     ` Abhijit Hoskeri
  2011-02-21  5:27     ` SandeepKsinha
  2011-02-21  5:43   ` Greg Freemyer
  1 sibling, 2 replies; 13+ messages in thread
From: kashish bhatia @ 2011-02-20 15:17 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 7:32 PM, Abhijit Hoskeri
<abhijithoskeri@gmail.com>wrote:

> On Sun, Feb 20, 2011 at 6:52 PM, kashish bhatia <koolest77@gmail.com>
> wrote:
> > Is there any method/command/utility to know what are the block numbers
> which
> > are allocated to a file in ext2 fs?
> >
>
> The FIBMAP ioctl gives you the block number give an integer, which is
> the nth block attached to the inode. It includes blocks allocated to
> store indirect blocks too.
>
> -Abhijit
>


What exactly FIBMAP is  and how to use it ?

For instance , if I made my own module and I am using ioctl. Then how should
I use it?

Is it a function?


-- 
Regards,
Kashish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110220/24645042/attachment.html 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 15:17   ` kashish bhatia
@ 2011-02-20 15:42     ` Abhijit Hoskeri
  2011-02-21  5:27     ` SandeepKsinha
  1 sibling, 0 replies; 13+ messages in thread
From: Abhijit Hoskeri @ 2011-02-20 15:42 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 8:47 PM, kashish bhatia <koolest77@gmail.com> wrote:
> What exactly FIBMAP is? and how to use it ?
>
> For instance , if I made my own module and I am using ioctl. Then how should
> I use it?

FIBMAP is an ioctl. It is supposed to be called from a userspace
program. You can use it from userspace like this:

http://smackerelofopinion.blogspot.com/2009//fibmap-ioctl-file-system-block-number.html

If that is what you want to do, you can do the same thing from the
kernel, you can look up ioctl_fibmap in fs/ioctl.c and see if you get
what you need.

-Abhijit

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 13:22 How to verify block numbers of file ? kashish bhatia
  2011-02-20 14:02 ` Abhijit Hoskeri
  2011-02-20 14:18 ` abhi
@ 2011-02-20 17:03 ` Manish Katiyar
  2011-02-20 18:05   ` kashish bhatia
  2 siblings, 1 reply; 13+ messages in thread
From: Manish Katiyar @ 2011-02-20 17:03 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 5:22 AM, kashish bhatia <koolest77@gmail.com> wrote:
> Is there any method/command/utility to know what are the block numbers which
> are allocated to a file in ext2 fs?

Use debugfs which comes with e2fsprogs.


>
> --
> Regards,
> Kashish
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



-- 
Thanks -
Manish

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 17:03 ` Manish Katiyar
@ 2011-02-20 18:05   ` kashish bhatia
  2011-02-20 20:39     ` Manish Katiyar
  0 siblings, 1 reply; 13+ messages in thread
From: kashish bhatia @ 2011-02-20 18:05 UTC (permalink / raw)
  To: kernelnewbies

Hi, Manish

How to use debugfs?





-- 
Regards,
Kashish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110220/cefd2b66/attachment.html 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 18:05   ` kashish bhatia
@ 2011-02-20 20:39     ` Manish Katiyar
  2011-03-08 10:25       ` kashish bhatia
  0 siblings, 1 reply; 13+ messages in thread
From: Manish Katiyar @ 2011-02-20 20:39 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 10:05 AM, kashish bhatia <koolest77@gmail.com> wrote:
> Hi, Manish
>
> How to use debugfs?


debugfs:  ncheck 12
Inode	Pathname
12	//abc

debugfs:  stat <12>
Inode: 12   Type: regular    Mode:  0644   Flags: 0x0
Generation: 143681507    Version: 0x00000000
User:  1000   Group:  1000   Size: 104466
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 208
Fragment:  Address: 0    Number: 0    Size: 0
ctime: 0x4d617b78 -- Sun Feb 20 12:37:12 2011
atime: 0x4d617b78 -- Sun Feb 20 12:37:12 2011
mtime: 0x4d617b78 -- Sun Feb 20 12:37:12 2011
BLOCKS:
(0-11):35-46, (IND):47, (12-102):48-138
TOTAL: 104


>
>
>
>
>
> --
> Regards,
> Kashish
>
>



-- 
Thanks -
Manish

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 15:17   ` kashish bhatia
  2011-02-20 15:42     ` Abhijit Hoskeri
@ 2011-02-21  5:27     ` SandeepKsinha
  1 sibling, 0 replies; 13+ messages in thread
From: SandeepKsinha @ 2011-02-21  5:27 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 8:47 PM, kashish bhatia <koolest77@gmail.com> wrote:
>
>
> On Sun, Feb 20, 2011 at 7:32 PM, Abhijit Hoskeri <abhijithoskeri@gmail.com>
> wrote:
>>
>> On Sun, Feb 20, 2011 at 6:52 PM, kashish bhatia <koolest77@gmail.com>
>> wrote:
>> > Is there any method/command/utility to know what are the block numbers
>> > which
>> > are allocated to a file in ext2 fs?
>> >
>>
You can use debugfs utility. Otherwise if you want to use the API, you
can use FIBMAP.
Google for usage of FIBMAP, you will get it for sure !

>> The FIBMAP ioctl gives you the block number give an integer, which is
>> the nth block attached to the inode. It includes blocks allocated to
>> store indirect blocks too.
>>
>> -Abhijit
>
>
> What exactly FIBMAP is? and how to use it ?
>
> For instance , if I made my own module and I am using ioctl. Then how should
> I use it?
>
> Is it a function?
>
>
> --
> Regards,
> Kashish
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



-- 
Regards,
Sandeep.






?To learn is to change. Education is a process that changes the learner.?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 14:02 ` Abhijit Hoskeri
  2011-02-20 15:17   ` kashish bhatia
@ 2011-02-21  5:43   ` Greg Freemyer
  1 sibling, 0 replies; 13+ messages in thread
From: Greg Freemyer @ 2011-02-21  5:43 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Feb 20, 2011 at 9:02 AM, Abhijit Hoskeri
<abhijithoskeri@gmail.com> wrote:
> On Sun, Feb 20, 2011 at 6:52 PM, kashish bhatia <koolest77@gmail.com> wrote:
>> Is there any method/command/utility to know what are the block numbers which
>> are allocated to a file in ext2 fs?
>>
>
> The FIBMAP ioctl gives you the block number give an integer, which is
> the nth block attached to the inode. It includes blocks allocated to
> store indirect blocks too.
>
> -Abhijit

hdparm has a FIBMAP argument iirc.  I've never used it.

Greg

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-02-20 20:39     ` Manish Katiyar
@ 2011-03-08 10:25       ` kashish bhatia
  2011-03-08 13:54         ` Vineet Agarwal
  0 siblings, 1 reply; 13+ messages in thread
From: kashish bhatia @ 2011-03-08 10:25 UTC (permalink / raw)
  To: kernelnewbies

Hi, Manish


I used debugfs . But it is not showing the required output.


[root at KASHISH mnt]# debugfs
debugfs 1.41.9 (22-Aug-2009)
debugfs:  ncheck 14
ncheck: Filesystem not open
debugfs:  stat <14>
stat: Filesystem not open



I mounted my ext2 fs which I created on /dev/sda5 in /mnt directory and I
want to check block numbers of file with inode 14. How to open the file
system?

-- 
Regards,
Kashish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110308/b2b05416/attachment.html 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-03-08 10:25       ` kashish bhatia
@ 2011-03-08 13:54         ` Vineet Agarwal
  2011-03-08 15:01           ` kashish bhatia
  0 siblings, 1 reply; 13+ messages in thread
From: Vineet Agarwal @ 2011-03-08 13:54 UTC (permalink / raw)
  To: kernelnewbies

Hey Kashish,

On Tue, Mar 8, 2011 at 3:55 PM, kashish bhatia <koolest77@gmail.com> wrote:

> Hi, Manish
>
>
> I used debugfs . But it is not showing the required output.
>
>
> [root at KASHISH mnt]# debugfs
> debugfs 1.41.9 (22-Aug-2009)
> debugfs:  ncheck 14
> ncheck: Filesystem not open
> debugfs:  stat <14>
> stat: Filesystem not open
>
>
>
You need to specify the device name along with debugfs. Look in the man page
for debugfs.


>
> I mounted my ext2 fs which I created on /dev/sda5 in /mnt directory and I
> want to check block numbers of file with inode 14. How to open the file
> system?
>
> --
> Regards,
>  Kashish
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
Regards:
Vineet Agarwal
http://code.google.com/p/radc/
http://in.linkedin.com/in/vineetvagrwl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110308/e1fc35b5/attachment-0001.html 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* How to verify block numbers of file ?
  2011-03-08 13:54         ` Vineet Agarwal
@ 2011-03-08 15:01           ` kashish bhatia
  0 siblings, 0 replies; 13+ messages in thread
From: kashish bhatia @ 2011-03-08 15:01 UTC (permalink / raw)
  To: kernelnewbies

yaah, I read the man page


It can be done in following way

[root at KASHISH KASHISH]# debugfs
debugfs 1.41.9 (22-Aug-2009)
debugfs:  open -c /dev/sda5
/dev/sda5: catastrophic mode - not reading inode or group bitmaps
debugfs:  stat <14>
Inode: 14   Type: regular    Mode:  0644   Flags: 0x0
Generation: 1688944868    Version: 0x00000000
User:     0   Group:     0   Size: 48911
File ACL: 1507838    Directory ACL: 0
Links: 1   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
ctime: 0x4d75ffd3 -- Tue Mar  8 15:37:15 2011
atime: 0x4d75ffd3 -- Tue Mar  8 15:37:15 2011
mtime: 0x4d75ffd3 -- Tue Mar  8 15:37:15 2011
Size of extra inode fields: 0
BLOCKS:
(0-11):30720-30731
TOTAL: 12






-- 
Regards,
Kashish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110308/9dacbc20/attachment.html 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-03-08 15:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-20 13:22 How to verify block numbers of file ? kashish bhatia
2011-02-20 14:02 ` Abhijit Hoskeri
2011-02-20 15:17   ` kashish bhatia
2011-02-20 15:42     ` Abhijit Hoskeri
2011-02-21  5:27     ` SandeepKsinha
2011-02-21  5:43   ` Greg Freemyer
2011-02-20 14:18 ` abhi
2011-02-20 17:03 ` Manish Katiyar
2011-02-20 18:05   ` kashish bhatia
2011-02-20 20:39     ` Manish Katiyar
2011-03-08 10:25       ` kashish bhatia
2011-03-08 13:54         ` Vineet Agarwal
2011-03-08 15:01           ` kashish bhatia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.