user1587643
user1587643

Reputation: 63

How to get sector numbers of a file

We are developing Android application (Android UI and C application through JNI) and File system is ext4.

Is there any Linux system call or Android API to find out sector numbers allocated for a file.

Please share your ideas.

Upvotes: 1

Views: 2605

Answers (2)

curratore
curratore

Reputation: 141

Hello you can get the file blocks and more information using stat command.

stat [OPTIONS]... FILE ...

For example you could know the info about my.cnf like this:

stat /etc/my.cnf

You can use the options to get different format sequences for files using the --help option alone.

Upvotes: 1

CL.
CL.

Reputation: 180280

You can use the FIBMAP or FIEMAP ioctls to read file blocks or file extents.

Upvotes: 3

Related Questions