I am trying to find out particular files details in Linux(Centos) by java program.
I create one text file & stored on Desktop.
Now i want to get info like at which partition of hard disk it stored?
at what block it used? exact location in terms of hdd internal?
I know few commands which show me hdd details like
but that not sufficient?
Millions saw the apple fall, but Newton asked why.
But fdisk and mount won't show you the location of individual files; at best, fdisk will show the sizes of the partitions.
I don't know that you can actually get at the locations of file from the file tables.
Linux runs data management through multiple layers of abstractions, some of which are plug-replaceable. The absolute sector address of a particular byte in a particular file can be calculated, but unless you're writing a low-level disk utility, it's not usually worth the trouble.
the "df" command issued using the directory of the file will tell you what partition the file is located in. That may be a raw partition (/dev/sda1), an LVM Logical Volume (/dev/VolGroup0/LogVol00), or even a network share ("host1:/export/myfiles"), although in the case of a network share, you might was well give up right now.
For a raw partition, the classical next step would be to get the sector extent which used to be something that the fdisk utility could display, but the old partition tables are on their way out.
For LVM, a logical volume consists of one or more transparent blocks of sectors which may be moved around at need. You'd have to use the LVM utilities to get the logical and physical sector addresses, then get the extents of whatever raw partition the LVM Physical Volume was working out of. And that's not even counting the mapper, which also gets into the act.
Nor did I allow for how different filesystems map sectors, RAID, or other considerations.
Or how the disk hardware itself may remap things owing to stuff like badblock remapping.
Virtually none of the services that you need to ferret out all this information is available to straight Java code, since it's extremely system-dependent and thus doesn't all under Java's "write once/run anywhere" constraints.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.