LCN and physical sector

Hi all,

just two questions…

  1. How can I find out the cluster size of a volume (f.e “C:”) used by
    FAT or NTFS from a kernel mode driver? (Any other possibility than
    reading the boot record and interpreting its content.)

  2. Is there a way to convert the LCN of a file to the physical sector
    number of the harddisk ?

Thanks,

Gerhard Wallhäußer

> 1. How can I find out the cluster size of a volume (f.e “C:”) used
by

FAT or NTFS from a kernel mode driver? (Any other possibility than
reading the boot record and interpreting its content.)

Send the query volume information IRP. The details are in NTIFS.H

  1. Is there a way to convert the LCN of a file to the physical
    sector
    number of the harddisk ?

FSCTL_QUERY_RETRIEVAL_POINTERS will return the runlist for a file.

Max

Maxim S. Shatskih wrote:

>1. How can I find out the cluster size of a volume (f.e “C:”) used

by

>FAT or NTFS from a kernel mode driver? (Any other possibility than
>reading the boot record and interpreting its content.)

Send the query volume information IRP. The details are in NTIFS.H

Ok.

>2. Is there a way to convert the LCN of a file to the physical

sector

>number of the harddisk ?

FSCTL_QUERY_RETRIEVAL_POINTERS will return the runlist for a file.

Max

Ok, but in ntifs.h I can find the following comment:

// Note: FSCTL_QUERY_RETRIEVAL_POINTER and FSCTL_MARK_AS_SYSTEM_HIVE only
// work from Kernel mode on local paging files or the system hives.

So it seems that FSCTL_QUERY_RETRIEVAL_POINTER can not be used on usual
files?

If it will work on usual files, what are the structures used with
FSCTL_QUERY_RETRIEVAL_POINTERS?

BTW:

What are the differences between FSCTL_QUERY_RETRIEVAL_POINTERS and
FSCTL_GET_RETRIEVAL_POINTERS?

Thanks,
Gerhard

Maxim S. Shatskih wrote:

>What are the differences between FSCTL_QUERY_RETRIEVAL_POINTERS and
>FSCTL_GET_RETRIEVAL_POINTERS?

Sorry. FSCTL_GET_RETRIEVAL_POINTERS for sure.
FSCTL_QUERY_RETRIEVAL_POINTERS is really for a pagefile only.

Max

FSCTL_GET_RETRIEVAL_POINTERS returns for my understanding the LCNs
(logical cluster numbers) of a file, counted from the beginning of a
volume (which means usually a partition). How can this LCN be converted
to the physical sector number of the harddisk on which the volume is
located?

Thanks,
Gerhard

> volume (which means usually a partition). How can this LCN be
converted

to the physical sector number of the harddisk on which the volume is
located?

IOCTL_DISK_GET_DRIVE_LAYOUT will give you the partition table of the
disk.
You will also need the mount manager IOCTLs to determine what
partition on the disk is your FS volume.

Max

The problem is that you assume a one-to-one mapping from the logical blocks
on a volume to the underlying physical storage - no such restriction is in
place. For example, suppose you are running a stripe set (using dynamic or
basic disks).

That is why FSCTL_QUERY_RETRIEVAL_POINTERS only works on the boot drive’s
paging file (the dump driver needs the blocks to dump it.)

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Looking forward to seeing you at our revised and updated file systems class
in February 2003 (Boston, MA).

-----Original Message-----
From: Gerhard Wallh?u?er [mailto:gerhard.wallhaeusser@ce-infosys.com]
Sent: Tuesday, February 11, 2003 9:59 AM
To: File Systems Developers
Subject: [ntfsd] Re: LCN and physical sector

Maxim S. Shatskih wrote:

>What are the differences between FSCTL_QUERY_RETRIEVAL_POINTERS and
>FSCTL_GET_RETRIEVAL_POINTERS?

Sorry. FSCTL_GET_RETRIEVAL_POINTERS for sure.
FSCTL_QUERY_RETRIEVAL_POINTERS is really for a pagefile only.

Max

FSCTL_GET_RETRIEVAL_POINTERS returns for my understanding the LCNs
(logical cluster numbers) of a file, counted from the beginning of a
volume (which means usually a partition). How can this LCN be converted
to the physical sector number of the harddisk on which the volume is
located?

Thanks,
Gerhard


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com