Re: I used boot0cfg and destroyed the MBR.All labels dissapear! (How I Fixed it)

2005-05-04 Thread BigBrother-{BigB3}
Hi,
I managed to fix the error of all slices being destroyed. My system is up 
and running. i did not reinstall any programs, just edited the partition 
table and the labels. It took me 3 days to figure out the exact values, so 
I post here my findings, in case somebody faces the same problem.

The problem was solved using two programs from the fixit disk: fdisk and 
disklabel. Note that I am using a whole disc dedicated to freebsd. no 
other partitions exist.

This is a short guide of how to fix it:
a) boot the computer using the floppy disks and enter the Fixit menu with 
the fixit disc inserted.

b) go to menu Configure-Fdisk and delete all partitions (NOTE: I am 
using all the disc dedicated to freebsd. No other OS exist. On your 
situation this may vary).

c) On this screen then I pressed [A] - use Entire disc and saw the new 
automatically calculated sector values (and the offset).

d) I pressed CTRL+C to abort this screen. Only the numbers interested me.
e) i went to menu and pressed the fixit prompt. I went to fixit prompt.
( I run 'disklabel ad0' and 'disklabel -r ad0' and I noted down some 
numbers of the fake partitions. Especially I noted the size (in sectors) 
of itIf this process fails, then you have to repeat the disklabel step 
after every fdisk commans that follows. Also note the number of 
fsize,bsize, and bps/cpg).

f) I edited the partition table using fdisk.
fdisk -u ad0   (ad0 is my first disc)
I deleted all (fake) partitions and created one accoring to the numbers 
that I have extracted from the previous screen. The type was 165 Freebsd.
Thus I have created a big slice ad0s1.

I edited the slice ad0s1 because I saw that there is a hidden parition on 
every freebsd system with thse values:

fdisk ad0s1
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
UNUSED
The data for partition 2 is:
UNUSED
The data for partition 3 is:
UNUSED
The data for partition 4 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 0, size 5 (24 Meg), flag 80 (active)
beg: cyl 0/ head 0/ sector 1;
end: cyl 1023/ head 255/ sector 63

I do not know why, but every freebsd system (on my possesion) has a 
partition 4 on slice 1 with these values.

I then edit the labels on that slice using
disklabel -e ad0s1
If that operation fails then you have to install a fresh disklabel using
disklabel -w ad0s1 auto
or
disklabel -w ad0 auto

I edit the labels of that slice. The sectors off-set was known from a 
previous step where I had extracted them using disklabel. The offset is 
calulated by adding the sectors until know. The fsize and other numbers 
are known from the previous step also.

Then you edit the label and write the first line of
a: sectors size offset=0 4.2BSD fsize bsize bps/cpg
On the b label put in the offset the sectors size of the previous ( a 
slice) and repeat the process.

Note that the label 'c' correspongs to whole disc so this value shoule 
have size from offset 0 until size the number of disklabel: [sectors/unit: 
X]. The lats label starts from the sum of all the previous labels 
until the number of sectors/units.

Thus if the calulcated offset it 100 and sectors/unit is 300, then the 
last label will have size 200 and offset 100.

After editing the label, try to mount. Note that the /mnt2/ holds the 
devices for mounting labels.

try to:
mount /mnt2/dev/ad0s1a /mnt
if this succeeds then label a has correct values. If not try to edit 
disklabel with oteher numbers. Remember that as long as you do no issue
[newfs] the inode table is somewhere hidden on the disc and you just have 
to figure out the label information (where it starts and where it ends for 
every slice).

Finally, install bootblocks using
fdisk -B ad0
fdisk -B ad0s1
disklabel -B ad0 auto
disklabel -B ad0s1 auto
and to be 100% sure enter sysinstall and go to fdisk menu and press Q 
quit. it will then ask you to install a boot manager...Say yes to it and 
your PC is 100% ready!

Reboot and enjoy:)

it took me 3 days to figure out this process but I managed to succeed in 
it.

Of course the best advice is (in order to avoid this) to print the 
partitoin information for your hard disc so you know before hand all the 
values...

Just issue (in case you have a ad0 disc)
fdisk ad0  [depending on your disc]
fdisk ad0s1 [--]
disklabel ad0
disklabel ad0s1

i hope that you will not need my short guide on fixing such kind of 
problems, but your never know :)

BB
---
Dreams have no limits!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


I used boot0cfg and destroyed the MBR.All labels dissapear!

2005-05-02 Thread BigBrother-{BigB3}

Dear,
Please help me with this strange situation, that is due to using boot0cfg 
with wrong switches. I googled it but I did not find any similar case.

On  a working 4.11 freebsd system I wanted to create a floppy bootable 
disk.
This system had one slice and four labels.

I run this command:
boot0cfg -B -o update -s 1 -t 20 fd0
After I run this command I rebooted and I faced a situation where
a) the floppy booting only showed
F1 ???
F2 ???
F3 ???
F4 ???
(whatever I pressed it causes to beep and nothing happens)
b) I removed the floppy disk and booted from the hard disc, but
the same list appeared..and nothing happened.
c) I boot with the 2 kernel/mfsroot diskcs with fixit also and I saw:
fdisk from the 'sysinstall' shows that no slices exist, and all the space 
is unused.

fdisk ad0 shows that there are 4 partitions with information like
==
sysid 32 (uknown)
1919950958, 544437093 (265838 Meg) (flag 0x80 active)
beggining: cylinder 356 head 97 sector 46
end:   cyllinder 357 head 116 secotr 40
sysid 107 (unknown)

sysid 83 (unknown)
...
sysid 73 (unknown)
...

Meanwhile I got the message
slice ad0s1 starts beyong end of the disk: rejecting it
slice ad0s2 ..rejecting it
slice ad0s3   rejecting it
slice ad0s4 ...   rejecting it

It seems that all the labels of the single slice have become seperated 
slices.

As a result I cannot mount anything and it seems that all my data is 
inaccessible.


because this is my home freeBSD firewall and I would like to bring it back 
online without reinstalling and setting it up from the beggining (no 
backups sniff:(  ) how can I fix this?

If I recreate partitions (how?) without erasing the file/inode table? how 
can I change the type of every partition to be freebsd? And how can i 
change the slices to be one big slice? I think disklabel can help but I am 
not sure how. How can I save/backup the data on the disk?


Thank you very much in advance!!!
Please if you have any hint of where to search or what to do help me and I 
will post the results (and hopefully the solution)  of this case as a 
reference.

regards,
BB

---
Dreams have no limits!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]