Re: Tracking the block numbers of a specific file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 14, 2002 at 05:05:32PM -0700, Karthik Mohan wrote:
> some of these things can be found using the ls command
> and it's flags but i could'nt figure out some like the
> block numbers !!

Indeed, ls can't show you everything. I suggest looking at the stat(2)
system call for some ideas on easily available information. To get this
information from the kernel, look at the struct inode structure, defined
in include/linux/fs.h. The block information is located within the union
u that contains roughly 27 filesystem specific information; the on-disk
layout is specific to the filesystem, so you'll have to read the
specific structures for the filesystems you are interested in.

Note that with the md driver, or hardware raid devices the block number
is going to be a logical block number; the specific block devices may
assing the data to other blocks on the device. (Standard IDE and SCSI
devices also feel free to remap blocks around the device to work around
errors, but I don't think the kernel is in charge of those changes,
though I think the SMART standard can help the kernel figure out some
information about the devices.)

I hope this helps you find what you need.

-- 
http://www.wirex.com/

Attachment: pgp00102.pgp
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux