Location of sections
hard drive
ZET-9
12.03.2005
Last edit 22.05.2005
Information obtained by experiment and cha
partially from the books on MS-DOS.
As for the standard PC-screws t.e.vin
Comrade, sections of which were created on the PC with
using the program fdisk, Partition magic and
similar to them.
Digression
Standard partitioning mi
in fdisk.
fdisk.exe - a standard program
It is also on a boot diskette MS-DOS.
After the program's operation on the screw
ALL INFORMATION WILL BE LOST!
1) Create a primary partition (he calls
Xia "first"). If he is the only
it removes the entire screw. If you need more
sections, then it removes the part of the screw -
For example, 20%.
In the fdisk can only create
one primary partition. Therefore, if needed
More sections, we turn to the creation of additional
positive.
2) Create an additional section - a
It is usually allocated by the remaining part
screw.
Now begin to create more sections -
they will be created as a supplement to internally
lnogo section. In the fdisk they
are called logical drives.
3) Create the logical drives in any finite
lichestve (one) thing to them about
total volume did not exceed the amount of additional
the second partition (the program still is not on
zvolit do).
As a result, we get to screw one major
section and some additional separation
fishing.
With the help of Partition Magic can
zhno do a lot of things, while in some
In some cases infa on the screw remains - it
the main difference between it and fdisk. And one more thing
difference: you can create a few basic
sections - a maximum of 4 (if not to create
additional information), or on already existing
tvuyuschem screw (which is a major
section and a few more) to create
2 more major sections (eg, by
reduce the length of the first major separation
la) - then the screw will be 3 main and
several additional sections.
Main Sections
The very first sector on the screw - it's MBR
(Master boot record - Master Boot
Record).
At the beginning of a sector may be ka
Coyte PC-shny boot length # 01BE bytes.
# 01BE at offset from the beginning of this (the first
Vågå) sector is a table separated
crystals of length 64 bytes. Last 2 bytes in
Gaza - # 55, # AA. If they are not, then this
screw "nonstandard" (for PCs), and define
Tb, which have sections on the screw, but rather all
second, it does not, but you can try.
Partition table
Its length is 64 bayta.Vsego it discharged
records for four razdelov.Na every time
Affairs - 16 bytes. The record contains a
several fields with the data.
Offset Length Field Name
from the beginning of the field,
Table B
0 1 signs of activity
section - the flag.
; Accepts values 0 (inactive) or # 80
(Active). The active can be only one
of the sections. BIOS on the PC will produce
download code from this section.
March 1 beginning of the section in
format CHS.
; These 3 bytes contain the values for registration
ditch the cylinder heads and sectors (Cyl, Head,
Sec - abbreviated CHS), which should send
the screw to read the first sector of the
Forum:
- 1-byte - is the number of heads (used
is four least significant bits);
- 2-byte:
lower 6 bits - the number of sectors;
Bits 6, 7 - are bits 8, 9 cylinder number
Register for a cylinder (they correspond
bits 0 and 1 in the register Cylinder Hi);
- 3rd byte - are bits 0 .. 7 rooms cylinder
pa for the registers of the cylinder (the byte is shown
pertains to the register Cylinder Low).
Offset Length Field Name
from the beginning of the field,
Table B
April 1 byte System.
; Byte indicates the type of partition. Values:
0 - unusual section;
1 - primary partition DOS (FAT12) (main)
size 0 .. 15 MB;
4 - primary partition DOS (FAT16) (main)
size 16 .. 32 MB;
5 - Advanced razd.DOS (optional)
size 0 .. 2 GB;
6 - "huge" razd.DOS (> 32Mb) (main)
size 32 MB .. 2 GB (FAT16);
# 0B - major (FAT32),
Size 512 MB .. 2 terabytes
(Value used in OS / 2);
# 0C - basic (FAT32),
Size 512 MB .. 2 terabytes
(This value is now used in all
Windows for large screws);
# 0E - basic (FAT16), size 32 MB .. 2T;
# 0F - Extended (optional) 0 .. 2T;
# 83 - denoted as the main section
with broken rotor system Linux;
# 85 - so designated partition for swap
with broken screws on Linux.
Offset Length Field Name
from the beginning of the field,
Table B
May 3 End section
in the format of CHS.
; These 3-byte values for the registers Goals
ki, sectors and cylinders indicate the end
Forum:
- 1-byte - is the number of heads (used
is four least significant bits);
- 2-byte:
lower 6 bits - the number of sectors;
Bits 6, 7 - are bits 8, 9 cylinder number
Register for a cylinder (they correspond
bits 0 and 1 in the register Cylinder Hi);
- 3rd byte - are bits 0 .. 7 rooms cylinder
pa for the registers of the cylinder (the byte is shown
pertains to the register Cilinder Low).
Offset Length Field Name
from the beginning of the field,
Table B
August 4 Number of sectors to
beginning of the section.
; Number of sectors of 512 bytes, which must be
skip to the beginning of this razdela.Eto on
les used in LBA mode instead valued th
from the 'beginning of partition in the format of CHS ".
In fact, this block number in the mode LBAadresatsii (blocks
are numbered from zero).
April 12 Number of sectors
in this section.
The length of the section in the sectors of 512 bytes.
Here are 16 bytes in each entry for
each of the existing partitions.
Sections can be determined by the system
byte: if it is 0 - hence, the section
No, if it is 5 - so this additional
section are positive, another value - the main
section.
The coordinates beginning section (CHS or
LBA) to load the sector - this is the first
sector of the partition, it's called Boot Record
(MBR) or Boot Sector (zag
ruzochny sector). Format Boot-sector distribution
see at the end of the article.
Additional sections
To work with additional sections
should:
1) In the MBR, partition table to find the section
with the value system byte to 5
(Or # 0C, or # 0F) - a byte at offset
4 from the recording of this section;
2) Get information about this topic from
field "the beginning of the section (in the format of CHS or
LBA). This information is for additional
section does not point to the beginning of supplement
lnogo section, and the sector, which contains
contains SBR (Secondary Boot Record).
When operating in LBA mode to remember
this value, you'll need it later.
We call it ADRES_LBA;
3) Download sector SBR.Etot sector has
em structure is almost the same as the MBR, but not
contains a boot loader and partition table
(Located at offset # 01BE from the beginning
this sector), only the first
two records (in contrast to the MBR, where the use
form a 4 records) of 16 bytes each.
The last 2 bytes of the sector are SBR
# 55, # AA. Records contain fields similar to those
fields in the MBR. In this case, the first record containing
contains information about the additional time
Indeed, while the second entry points to the following
schuyu SBR (if you have multiple supplement
lnyh sections). The SBR for the latest dopo
lnitelnogo section is used only
first record;
4) If this is an additional section,
that we need, go to step 5.
Otherwise:
looking for the following additional section;
taken from the 2 nd table entries
value of "top section of the corresponding
schego field, and if the mode of CHS, then immediately
upload the following SBR. In LBA mode
must add this value to the
ADRES_LBA and assign the result
variable ADRES_LBA - and only after this
th download SBR. Next, go to nachalo
this paragraph;
5) Take out a second record in the table separated
fishing beginning of this section of the corresponding
ing fields and load the Boot-sector of the
section.
Attention! Box top section of the form
mate CHS "(at offset 1 from the beginning of recording)
indicates the first sector of the additional
Indeed razdela.Prosto use it to
Download Boot-sector.
Box top section in a format LBA "(for
offset 8 from the beginning of record) contains a number of
Lo sectors prior to the additional time
case, but not from the beginning of the hard drive (!), and from
values ADRES_LBA. Therefore, to obtain
the actual number of sectors to start to
Executive section, we add these two
value and then load the Boot-sector.
Now, when loaded with Boot-sector nuzh
Nogo us section, we take from it all information
tion on the FAT file system on this time
case.
The structure of this section.
- 1 st sector of the partition - this is Boot-sector;
- A few unused sectors (which
may be missing - they count learn from
two bytes at offset 14 from the start of the Boot Sector);
- 1-th copy of FAT;
- 2-th copy of the FAT;
- The root directory;
- Data.
Note:
When using the hard drive on the other
file system (not FAT) is necessary in
driver, the hard drive to store the value
lichestva sectors before partition (if
format is used CHS, it must be recalculated
a thief in the top section of the CHS format LBA), and
when referring to the section the driver will be at
ppend this value to the number of sectors to
tory to download / burn. Exactly
just do it at work with an additional
lnymi partitions FAT (sm.primechanie to displacements
scheniyu # 1C in the Boot-sector).
Format Boot-sector
Attention! The format of this sector is valid
Liv file systems FAT12 and FAT16.
Here, the length of the sector - 512 bytes.
Boot-sector - is the first sector on the dis
Kothe file system FAT12 (floppy
MS-DOS). On the disk with the file system
FAT12 or FAT16 is the first sector of the partition
(Not to be confused with the first sector of your hard drive, in
which is located MBR).
Contains the following data:
Offset Length Purpose
0 3 transition team at the code
loader.
August 3 system identifier (a name
program - the formatter).
; Usually "MSWIN4.1".
# 0B 2 Length in bytes of the sector.
; Usually 512.
# 0D 1 Number of sectors
cluster.
; Floppy = 1;
; For HDD (FAT12) = 8;
; For HDD (FAT16) can 4,8,16,32,64.
# 0E 2 Number reserved
different sectors.
; This is the number of sectors to 1 second copy of FAT (on
floppy disk is actually a number of sectors where
FAT; hard drive - the number of sectors
from the beginning of this section). It can not be 0.
# 10 1 Number of FAT.
, Usually 2.
# 11 2 Maximum effort
number of files in
root directory.
; Floppy usually 56;
; For the HDD is usually 512.
# 13 2 Total number of sectors
on the disk.
; To a floppy disk and hard drive for up to
32 MB RAM, and if> 32 MB, then this field soda
rzhit 0, 0).
# 15 1 Code format
(Byte descriptor type of disc)
The value of this byte is:
# F0 - floppy disks, 2 sides, 18 sectors
on track;
# F8 - Hard drive;
# F9 - floppy disks, 2 sides, 15 sectors
on track;
# FC - A floppy disk, 1-sided, 9 sectors
on track;
# FD - A floppy disk, 2-sided, 9 sectors
on track;
# FE - A floppy disk, 1-sided, 8 sectors
on track;
# FF - A floppy disk, 2-sided, 8 sectors
on track.
# 16 2 Number of sectors
one FAT.
# 18 2 Number of sectors
one track.
; Floppy = 9;
; For the HDD - this parameter Sec.
# 1A 2 Number of heads on
disk.
; For the HDD - this option Head.
# 1C 4 Number of special
(Hidden) sectors.
; Very important parameter for the hard drive -
a number of sectors before partition.
Attention! For the main sections of this real
finite number of sectors from the beginning of the hard drive
before this section. For additional sections
This number coincides with the value of the field Co.
lichestvo sectors prior to the section, taken
Tym from the partition table in the SBR.
# 20 4 Number of sectors on the disk.
; Used if the size of the hard drive> 32M.
1 ID # 24 drive (drive number
to the hard drive in the BIOS).
; First = # 80.
# 25 1 reserve.
# January 26 Signature Extended
sector, ie only that
wrote that DOS 4.0 and above,
includes here # 29.
# April 27 Serial number of the volume.
; Serial number - written by formatirova
SRI disc contains a unique number and
date.
# 26 11 The name of the disk.
# 36 8 Contains "FAT12" or
"FAT16".
Supplement:
It was noted that hard drives supported
equation describing mode LBA, when you create them again
Delov get the next option.
Beginning of the first primary partition is always
is set to # 3F (in the "number of cross
Ktorov before partition) and cylinder 0,
head 1, sector 1 (in the "beginning of the partition
format CHS ").
This was observed in the following screws:
DHAA-2270 (258 Mb);
IBM-DB0A-2540 (541 Mb);
IBM-20 (20 Gb);
Maxtor (40 Gb);
Western Digital (160 Gb).
As a result - some of the screws
(Small - 200-500 meters), not as a result
regime CHS use the Start section
format CHS ", as in fact to
chalo section is not there, but you can use
the "number of sectors before the separation
la, "but only if the screw under the
supported the regime of LBA (ie working with him
mode LBA).
More about Boot-sector
Under the Boot-sector will understand all the cross
Ktorov before the first primary partition.
On the screws with FAT16 is used only
is the first sector, the rest of the sector to
beginning of the section are free.
On the screws with FAT32, but the very first
sector, the sector is still in use 6 - there
holds a copy of the first sector (to
entropy of the partition table), and in sector 2 contains
contained additional information on the number
space of free disk space on the first
free cluster on the disk.
The contents of the 2 nd sector (assuming that the sector
with the first):
Offset Length Value
0 4 # 41, # 61, # 52, # 52
; Dop.sektora Id.
4 480
; Field is reserved (zero).
# 01E4 4 # 61, # 41, # 72, # 72
; Dop.sektora Id.
# 01E8 4
; Free clusters on diske.Esli this field
has a value of # FFFFFFFF - need to calculate.
# 01EC 4
; Number of cluster on the disk from which the starting
nat find a free cluster. If this
field has a value of # FFFFFFFF - hence
should compute.
12 # 01F0
; Field is reserved (zero).
# 01FC 4 # 00, # 00, # 55, # AA
; Dop.sektora Id.