All is simple if you have at hand═:
use fdisk to delete (d option) all the existing partitions on the damaged disk═;
use fdisk to create all the primary (1-4) partition mentioned on the paper═;
On my SuSE installation and anytime I had to do this for other peoples, this gives a good result.
hdparm -g /dev/hda1/dev/hda1: geometry════ = 2432/255/63, sectors = 4192902, start = 63
e2fsck -n /dev/hd?? |
You can even mount the partition and check the size:
mount -r /dev/hd?? /mnt df -T |
But there is a better way if you can still access the net or have “gpart” at hand. gpart is available in most distribution, by freshmeat.net or directly at http://www.stud.uni-hannover.de/user/76201/gpart.
“gpart - guess PC-type hard disk partitions” is the first line of the man page of gpart (man gpart).
“gpart tries to guess which partitions are on a hard disk. If the primary partition table has been lost, overwritten or destroyed the partitions still exist on the disk but the operating system cannot access them.” This is exactly what we need.
gpart is a very good tool.
The problem is the following: the first block of any partition is marked. But it's never “unmarked” if not overwritten. So many “first partition block” are existing on an old disk and gpart tries to do it's best guessing what is the good one. In fact it's not too difficult to try, nothing is written on the disk by gpart.
Here is the result of gpart on the previously seen disk hdb:
root@charles:/home/jdd > gpart /dev/hdb Begin scan... Possible partition(Linux ext2), size(1200Mb), offset(0Mb) Possible partition(Windows NTFS), size(1200Mb), offset(1200Mb) Possible partition(Linux ext2), size(1004Mb), offset(2402Mb) Possible partition(Windows NTFS), size(1600Mb), offset(4102Mb) End scan. Checking partitions... * Warning: partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX) ends beyond disk end . Partition(Linux ext2 filesystem): primary Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): primary Partition(Linux ext2 filesystem): primary Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): invalid primary Ok. Guessed primary partition table: Primary partition(1) type: 131(0x83)(Linux ext2 filesystem) size: 1200mb #s(2457880) s(63-2457942) chs: (0/1/1)-(152/254/61)d (0/1/1)-(152/254/61)r Primary partition(2) type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX) size: 1200mb #s(2457880) s(2457944-4915823) chs: (152/254/63)-(305/253/60)d (152/254/63)-(305/253/60)r Primary partition(3) type: 131(0x83)(Linux ext2 filesystem) size: 1004mb #s(2056256) s(4919781-6976036) chs: (306/61/49)-(434/60/47)d (306/61/49)-(434/60/47)r Primary partition(4) type: 000(0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r |
As you see, primary partition can be recovered, but for extended ones it's still to be done.
Dos partitions are labeled “windows NTFS” because they were created while trying to install Windows 2000 (a very awful experience!). The “invalid” one is, in fact the extended partition.
With this, one can use fdisk and try re-creating the partition table (remember, this is risk-free given the original one is already lost).
gpart is updated on a weekly basis :-) and so new makes may be more powerful than I know.
dd if=/dev/hd?? of=/tmp/recover_hd?? bs=512 skip=XXXX count=YYY |
XXX is the sector start and YYY the sector count (can be guessed).
mount -r -t ext2 -o loop /tmp/recover_hd?? /mnt/recover |
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |