How to verify block numbers of file ?
Is there any method/command/utility to know what are the block numbers which are allocated to a file in ext2 fs? -- Regards, Kashish
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
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
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-... 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
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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Sandeep. “To learn is to change. Education is a process that changes the learner.”
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
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@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
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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Thanks - Manish
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
Hi, Manish I used debugfs . But it is not showing the required output. [root@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
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@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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards: Vineet Agarwal http://code.google.com/p/radc/ http://in.linkedin.com/in/vineetvagrwl
yaah, I read the man page It can be done in following way [root@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
participants (7)
-
abhi -
Abhijit Hoskeri -
Greg Freemyer -
kashish bhatia -
Manish Katiyar -
SandeepKsinha -
Vineet Agarwal