Re: Want to help with NTFS

From: Anton Altaparmakov (aia21@cam.ac.uk)
Date: Sun Jul 09 2000 - 12:08:03 EST


At 16:24 09/07/2000, Steve Dodd wrote:
>On Sun, Jul 09, 2000 at 02:05:19PM +0200, Igmar Palsenberg wrote:
> > Any clues yet in what way NTFS v 3.0 (win 2K) differs ?? The old driver
> > ate the FS :-))
>
>I inferred from something Jeff said a while back that the volume management
>stuff was storing data in blocks that were marked free in the block bitmap.

I don't think so. This would cause corruption by the WinNT4 driver as
well... (Unless there is a safe-guard in NT4 we are missing in linux.)

> >From what I know of the on-disk structures, there's 8 bytes of "magic"
> in the boot sector,

That's news to me! - Which bytes (offsets?) are you referring to exactly? -
My understainding of the boot sector is at the bottom of the email - it is
described in the MS WinNT4 ws resource kit book along with the partition
and mbr structures, I have integrated it into one structure for easier
reading. - It doesn't have any magic AFAICS.

>and a filesystem version in one of the system files; I don't
>know if either of these are changed by Win2K. Also, I don't know what the

The version is changed from 1.2 in NT4 to 3.0 in Win2k (note: Gary
Nebbett's book is wrong in stating that NT4 uses v2.1. At least on my PC it
uses v1.2 when a new partition is formatted...). - The current linux driver
actually reads the version number from special file $Volume, attribute
$VolumeInformation to determine whether to allow write-mount of a ntfs
partition (v3.0+ is mounted read-only). See fs/ntfs/super.c function
ntfs_get_version().

>semantics of the filesystem version number are - it's split into major /
>minor parts, but what do to changes to either part signify?

Now that's a different question...

Anton

--- NTFS Boot Sector ---

Partition Boot Sector for NTFS volume:

Byte Ofs Length e.g. Meaning
                 (bytes) Value

0x00 3 EB 5B 00 Jump instruction
0x03 8 NTFS OEM Identifier

[0x0B 25 BIOS Parameter Block]
0x0B WORD 0x0002 Bytes per Sector.
0x0D BYTE 0x01 Sectors per Cluster.
0x0E WORD 0x0000 Reserved sectors.
0x10 BYTE 0x00 Always 0.
0x11 WORD 0x0000 Always 0.
0x13 WORD 0x0000 Not used by NTFS.
0x15 BYTE 0xF8 Media Type.
0x16 WORD 0x0000 Always 0.
0x18 WORD 0x3F00 Sectors per Track.
0x1A WORD 0x1000 Number of Heads.
0x1C DWORD 90 42 06 00 Hidden Sectors. (unused by
NTFS???)
0x20 DWORD 00 00 00 00 Not used by NTFS.

[0x24 48 Extended BIOS Parameter Block]
0x24 DWORD 80 00 80 00 Not used by NTFS.
0x28 LONGLONG A0 3E 06 00 00 00 00 00 Total Sectors.
0x30 LCN 10 00 00 00 00 00 00 00 Logical cluster
number for $MFT.
0x38 LCN 51 1F 03 00 00 00 00 00 Logical cluster no.
for $MFTMirr.
0x40 DWORD 02 00 00 00 Clusters per file
record segment.
0x44 DWORD 04 00 00 00 Clusters per index
block.
0x48 LONGLONG 5B 1F DD 2C 4F DD 2C A2 Volume Serial Number.
0x50 DWORD 00 00 00 00 Checksum. (unused???)

0x54 426 bytes Bootstrap code
0x1FE WORD 0x55AA End of sector marker

The bootstrap code on NTFS volumes is in fact longer than shown here. When
formating a NTFS partition the first 16 sectors are allocated for the partition
boot sector & bootstrap code.

The MFT is not located in a predefined sector & can be moved if there is a bad
sector in its normal location. If 0x30 and 0x38 do not point to valid targets,
NT4 assumes that the partition has not been formatted yet.

--

"Education is what remains after one has forgotten everything he learned in school." - Albert Einstein

-- Anton Altaparmakov Voice: 01223-333541(lab) / 07712-632205(mobile) Christ's College eMail: AntonA@bigfoot.com Cambridge CB2 3BU ICQ: 8561279 United Kingdom WWW: http://www-stu.christs.cam.ac.uk/~aia21/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:10 EST