Re: файловые системы
Добрый вечер, Denis,
Вы писали 10 мая 2002 г. в 19:48:49 следующее:
Вооружайся DiskEditor'ом и терпением.
DAK> Хочу попытаться восстановить руками. Но разбивка полностью не известна.
DAK> Было 3 раздела: 1 swap и 2 ext2.
Были ли логические (в extended) разделы, или только primary?
DAK> MBR восстановливается запросто. Потом,
DAK> насколько я помню, сразу идет таблица разделов,
таблица разделов находится в первом секторе нулевого цилиндра нулевой
головки диска (т.е. в том секторе где расположен MBR) по смещению от
начала сектора 1BEh.
Привожу данные о MBR и PartitionEntryRec
MasterBootRec
Offset Size Contents
ЇЇЇЇЇЇ ЇЇЇЇ ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ
+0 1beH abBootCode master boot executable code
+1beH 10H rPrtnInfo_1 partition 1 entry (see below)
+1ceH 10H rPrtnInfo_2 partition 2 entry
+1deH 10H rPrtnInfo_3 partition 3 entry
+1eeH 10H rPrtnInfo_4 partition 4 entry
+1feH 2 wPrtnTblSig partition table signature (aa55H)
512 size of the master boot sector
PartitionEntryRec
Offset Size Contents
ЇЇЇЇЇЇ ЇЇЇЇ ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ
+0 1 bBootFlag 0=not active, 80H = active (boot this partition)
+1 1 bBeginHead partition begins at this head...
+2 2 rBeginSecCyl ...and this sector and cylinder (see below)
+4 1 bFileSysCode file system type
+5 1 bEndHead partition ends at this head...
+6 2 bEndSecCyl ...and this sector and cylinder (see below)
+8 4 lBeginAbsSec partition begins at this absolute sector #
+0cH 4 lTotalSects total sectors in this partition
16 size of a PartitonEntryRec
+10H start of next entry or AA55H if last entry
bBootFlag specifies if this partition is the active, bootable partition.
00H means not active (or not bootable)
80H means this is the partition to boot
Only one entry can be set to 80H.
bBeginHead the head number to use as the start of this partition.
rBeginSecCyl the sector and cylinder number of the first sector in this
partition.
Sector and Cylinder values are actually 6 bits and 10 bits:
1 1 1 1 1 1
+5-4-3-2-1-0-9-8-7-6-5-4-3-2-1-0+
іc c c c c c c c C c S s s s s sі
+-------------------------------+
The high two bits of the second byte are used as the high bits
of a 10-bit value. This allows for as many as 1024 cylinders
and 64 sectors per cylinder.
This is ordered so that when you load CX with the 16-bit
value, it will be set up for a call to INT 13H to read the
desired portion of the disk.
Если за пределами 1024 цилиндра, то там похоже ставятся
FFh FFh
bFileSysCode The following codes are recognized by DOS:
00H unknown file system type
01H DOS 12-bit FAT; partition smaller than 10 MB
04H DOS 16-bit FAT; partition smaller than 32 MB
05H Extended DOS Partition (see notes, below)
06H DOS 16-bit FAT; partition larger than or exactly 32 MB
Other codes may exist; for instance, in non-DOS partitions.
Types 1, 4, and 6, are given their own drive ID. Type 5
provides a way to have more than 4 DOS partitions on a drive.
bEndHead the head number for identifying the end of the partition
bEndSecCyl the sector and cylinder number of the last sector in this
partition (see rBeginSecCyl, above)
Если за пределами 1024 цилиндра, то там похоже ставятся
FFh FFh
lBeginAbsSec the partition starts at the absolute sector # (just another
way to express rBeginHead and rBeginSecCyl; see notes, below).
lTotalSects total number of sectors in this partition.
Notes: і The absolute sector value at offset 08H of each entry is
equivalent to the head, sector, and cylinder of the partition
start address:
Relative sector 0 is equal to cylinder 0, head 0, sector 1.
The relative sector number increments first for each
sector-per-track, next for each head, and finally for each
cylinder. This formula applies:
relSec = (CylNo * SecsPerTrack * Heads)
+ (HeadNo * SecsPerTrack)
+ (SecNo - 1)
Use SecNo-1 since sectors are always numbered starting with 1.
You can obtain low-level information such as sectors-per-track
by using INT 13H, fn 08H.
і Partitions begin on an even cylinder number, except for the
first partition which may begin on cylinder 0, head 0, sector 2
(since sector 1 is occupied by the Master Boot Record).
і When the boot record of a partition receives control, its
partition table entry is pointed to by DS:SI.
если первый раздел был primary, то запись в rPrtnInfo_1 должна быть
скорее всего вида:
00h 01h 01h 00h 83h скорее всего FEh два байта требуют вычисления
(сектор & цилиндр которыми кончается раздел)??h ??h
далее четыре байта скорее всего (начало раздела) 3Fh 00h 00h 00h
далее четыре байта требуют вычисления (размер раздела)??h ??h ??h ??h
83h - тип файловой системы swap
82h - соответственно ext2
DAK> после которой начинается
DAK> swap. Его размер известен точно.
придется вычислять некоторые параметры для rPrtnInfo
DAK> Сразу после него начинается ext2-раздел.
Первый его сектор - boot и заканчивается он (сектор) сигнатурой
55h AAh. По этому факту можно уточнить размер первого раздела и
соответственно начало второго.
DAK> И где-то там с середины винта идет другой ext2.
DAK> Тот, что в середине можно вычислить по сигнатуре (0xEF53).
Если он primary и ты можешь поймать его начало (началом primariy
раздела является его boot сектор), то считай что восстановить его
скорее всего возможно. Если он в extended, то сразу не вспомню как они
идут, но можно вспомнить.
DAK> По крайней мере
DAK> найти несколько копий суперблока (смещение каждого от начала раздела
что ты понимаешь под суперблоком?
DAK> известно) и так вычислить положение первого. Который, насколько понимаю, и
DAK> являет собой начало раздела (и, соответствено, конец следующего).
DAK> Вроде ничего не перепутал .. ?
Возможно :-)))
DAK> Sorry, вопросы наверно очень глупые, но время несколько поджимает.
Да нет, вопросы нормальные.
DAK> Собственно, надо как-то восстановить таблицу разделов, а что делать дальше
DAK> - ясно.
думаю это возможно
PS сам я не восстанавливал винты, просто недавно изучали эти структуры
в университете и читали данные из них на низком уровне, поэтому могу
ошибаться, но считаю, что у тебя есть вполне реальные шансы.
PSS кажется, что если диск в lba, то для расчетов считай, что у него
255 головок и 63 сектора на дорожке. Точнее можно определить глянув в
BIOS (IMHO)
--
Всего наилучшего,
Anseis mailto:anseis1@ezmail.ru
--
To UNSUBSCRIBE, email to debian-russian-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: