Re: Fwd: Re: Please help. Can't see HD

2003-12-29 Thread Malcolm Kay
On Tue, 30 Dec 2003 01:12, Francisco Reyes wrote:
> On Mon, 29 Dec 2003 20:53:06 +1030, Malcolm Kay wrote:
> >OK; how did you install initially? Was the whole disk used for BSD?
> >Did you follow the defaults during installation?
> >
> >If both the latter questions are answered in the affirmative then you
> >might go back to installation and try to create the same slices,
> > partitions and mount points.
>
> I thought I had recorded my partition sizes, but I had not saved
> them.
> I found enough data in my backups so the data loss is minimal.
> At this stage I want to concentrate on improving my backups for
> the next time.
>
> >> Is there a way to backup the disklable and slice info?
> >
> >Yes, disklabel and fdisk  have facilities for outputting their current
> > state and this can be redirected to file and then stored on your backup
> > media or a floppy disk.
> >
> >I do this on a regular basis
>
> Could you share the commands please?
>

# fdisk ad2 > ad2.fdisk
# disklabel ad2s1 > ad2s1.disklabel

> >In my opinion dump and restore are the best backup and recovery mechanisms
> >for BSD.
>
> I will work on a dump/restore mechanism. I will do that weekly.
> Have a database running which may not backup well. On weekends I
> can shutdown everything for the dump process. I plan to dump to
> a file in the second HD if that is possible. I also just bought
> a DVD burner to backup to it essential data to take offsite
> besides the copy on the second HD.
>
> Thanks for the advice. If I had only had a backup of the disk
> info this whole experience would have been less problematic.

If you have dumps of all partitions then the slicing and partitioning sizes
are not too important so long as thay are big enough.
Just use say 'fdisk -BI ad2' to set it up with one slice for BSD.

Then use disklabel on ad2s1 first to obtain a skeleton file then fill in
the partitions and sizes you want and write it back with
# disklabel -R -B ad2s1 prototypelabel

Now create file systems in the partitions to be mounted (newfs).

You should now be able to restore your backups to each partition in turn.

Malcolm Kay


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fwd: Re: Please help. Can't see HD

2003-12-29 Thread Francisco Reyes
On Mon, 29 Dec 2003 20:53:06 +1030, Malcolm Kay wrote:

>OK; how did you install initially? Was the whole disk used for BSD?
>Did you follow the defaults during installation?
>
>If both the latter questions are answered in the affirmative then you 
>might go back to installation and try to create the same slices, partitions
>and mount points.

I thought I had recorded my partition sizes, but I had not saved
them.
I found enough data in my backups so the data loss is minimal.
At this stage I want to concentrate on improving my backups for
the next time.

>> Is there a way to backup the disklable and slice info?
>>
>
>Yes, disklabel and fdisk  have facilities for outputting their current state and this
>can be redirected to file and then stored on your backup media or a floppy disk.
>
>I do this on a regular basis

Could you share the commands please?

>In my opinion dump and restore are the best backup and recovery mechanisms 
>for BSD.

I will work on a dump/restore mechanism. I will do that weekly.
Have a database running which may not backup well. On weekends I
can shutdown everything for the dump process. I plan to dump to
a file in the second HD if that is possible. I also just bought
a DVD burner to backup to it essential data to take offsite
besides the copy on the second HD.

Thanks for the advice. If I had only had a backup of the disk
info this whole experience would have been less problematic.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fwd: Re: Please help. Can't see HD

2003-12-29 Thread Sergey 'DoubleF' Zaharchenko
On Mon, 29 Dec 2003 14:57:13 +1030
Malcolm Kay <[EMAIL PROTECTED]> probably wrote:

> On Mon, 29 Dec 2003 14:39, Francisco Reyes wrote:
> > On Mon, 29 Dec 2003 14:27:01 +1030, Malcolm Kay wrote:
> > >This is likely your problem source!!!
> > >
> > >/dev/rad[n] is an alias of /dev/ad[n]; that is it refers to IDE drive n.
> > >(Historically they had somewhat different meanings but even then still
> > >refered to the same physical device -- the 'r' means raw)
> > >
> > >If n was 2 you have over written the beginning of ad2.
> >
> > Well I guess the good news is that the HD is probably ok then.
> >
> > :-)
> 
> Yes; should be.
> >
> > In FAT I seem to recall there are two copies of the boot sector.
> > Does FreeBSD has anything like that?
> >
> 
> I seem to recall some options or utilities under MS-DOS that did 
> something like that, but think this was mainly for floppies.
> Certainly there are duplicate copies of the FAT allocation tables,
> but these are next to one another on the disk so don't really protect
> against this sort of calamity.
> 
> I guess the nearest thing in FreeBSD is mutiple copies of the 
> superblocks within the file system, but unless you can reconstruct 
> the slice table(partition in MS terms) I don't believe it will help.
> 
> > If what I did trashed the first sectors would that have affected
> > all mount points?
> 
> How big was the image you copied to the disk? -- that should tell
> you how much of your drive is overwritten.
> 
> It is probable your disklabel has also disappeared, so you 

And the superblock, and some large piece of data.

> probably need to reconstruct both the slice table in the MBR and 
> the disklabel in the first slice. With some vague recollections of 
> what you did originally to install FBSD it is possible that some 
> lucky guesses might work.

For the `slice table' (MBR) sysutils/gpart could be of some help. Not
sure about the disklabel, though. 

> If you can find the first sector of a slice carrying an installed file

Where `find' might mean 

# hd < /dev/ad6s1 | grep "54 19 01 00"

if looking for a ufs1 filesystem or

# hd < /dev/ad6s1 | grep "19 01 54 19"

for ufs2. (see the archive for details; in the discussion the method
seemed to work)

> system then this might hold a copy of the slice table allowing
> reconstruction of the original MBR with some confidence. 
> 
> Malcolm Kay
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
> 


-- 
DoubleF
Vote for ME -- I'm well-tapered, half-cocked, ill-conceived and
TAX-DEFERRED!



pgp0.pgp
Description: PGP signature


Re: Fwd: Re: Please help. Can't see HD

2003-12-29 Thread Malcolm Kay
On Mon, 29 Dec 2003 17:09, Francisco Reyes wrote:
> On Mon, 29 Dec 2003 14:57:13 +1030, Malcolm Kay wrote:
> >How big was the image you copied to the disk? -- that should tell
> >you how much of your drive is overwritten.
>
> The image was about 4MB.

Before or after decompression;
It probably doesn't matter anyway. If you were using the slice partition 
for BSD (not necessarily slice slice 1; but) the first one physically after 
the MBR then then it  is likely you have overwritten the disklabel and a 
substantial part of the 'a' or root partition whether 4Mb is the 
compressed or expanded size. And without some form of dual boot we 
can guess that this is the only slice carrying a file-system (or systems).

Given that the above assumptions are valid we are lead to the 
conclusion that the first sector of the BSD slice has gone along with the
disklabel information and a substantial prt of the root file system.

> >It is probable your disklabel has also disappeared, so you
> >probably need to reconstruct both the slice table in the MBR and
> >the disklabel in the first slice. With some vague recollections of
> >what you did originally to install FBSD it is possible that some
> >lucky guesses might work.
>
> How would I go about that?

OK; how did you install initially? Was the whole disk used for BSD?
Did you follow the defaults during installation?

If both the latter questions are answered in the affirmative then you 
might go back to installation and try to create the same slices, partitions
and mount points. It looks as though the root partition has been 
destroyed but you might hope that the rest are intact. Make sure that 
you mark the 'a' partition for a new file system and all others as already 
existing. The partitions are marked 'Y' or 'N' in the installation menu
but I can't remember which is which -- read the help explanation.

Proceed with a minimum installation and you should (with luck) retain
anything you have added to the non-root partitions.

After booting into the recreated system
you'll need to recreate users with their original UIDs. You can see what 
these are by using ls -l in the user directories /usr/home/{user-name}
when the numericl uid will be displayed instead of the user name.]

If either of the questions were answered in the negative we'll need to look 
for a different approach and some more difficult guesses!
   
>
> >If you can find the first sector of a slice carrying an installed file
> >system then this might hold a copy of the slice table allowing
> >reconstruction of the original MBR with some confidence.
>
> How?

Hopefully as above.

>
> Other than not playing around with dd how can one safeguard from
> something like this in the future?

Only issue instructions as 'root' when you are fully awake and thinking clearly
about what you are doing and then double chheck evry command before 
hitting . Keep operation under user root to an absolute 
minimum. You are unlikely to be permitted to create this degree of havoc as
an ordinary user.

> Is there a way to backup the disklable and slice info?
>

Yes, disklabel and fdisk  have facilities for outputting their current state and this
can be redirected to file and then stored on your backup media or a floppy disk.

I do this on a regular basis for a number of machines under my control. I also
include a copy of /etc/fstab and the output from df.

> After all this is cleared I am also going to check what is the
> best way to keep a working copy of my entire system. On windows
> I have a program, driveimage, which I use to every night keep an
> image of the entire disk while the system is on. Has saved me
> many times..

In my opinion dump and restore are the best backup and recovery mechanisms 
for BSD. But to duplicate, in its entirety, the original setup you need to also save
fdisk and disklabel information. Disk images are unreasonably expensive in time
since they also backup empty space, require a physically identical disk for recovery
and can give some difficlties as the image 
is usually of an open file system which checks out as unclean.

Malcolm Kay

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fwd: Re: Please help. Can't see HD

2003-12-28 Thread Francisco Reyes
On Mon, 29 Dec 2003 14:57:13 +1030, Malcolm Kay wrote:

>How big was the image you copied to the disk? -- that should tell
>you how much of your drive is overwritten.

The image was about 4MB.


>It is probable your disklabel has also disappeared, so you 
>probably need to reconstruct both the slice table in the MBR and 
>the disklabel in the first slice. With some vague recollections of 
>what you did originally to install FBSD it is possible that some 
>lucky guesses might work.

How would I go about that?

>If you can find the first sector of a slice carrying an installed file
>system then this might hold a copy of the slice table allowing
>reconstruction of the original MBR with some confidence. 

How?

Other than not playing around with dd how can one safeguard from
something like this in the future?
Is there a way to backup the disklable and slice info?

After all this is cleared I am also going to check what is the
best way to keep a working copy of my entire system. On windows
I have a program, driveimage, which I use to every night keep an
image of the entire disk while the system is on. Has saved me
many times..

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fwd: Re: Please help. Can't see HD

2003-12-28 Thread Malcolm Kay
On Mon, 29 Dec 2003 14:39, Francisco Reyes wrote:
> On Mon, 29 Dec 2003 14:27:01 +1030, Malcolm Kay wrote:
> >This is likely your problem source!!!
> >
> >/dev/rad[n] is an alias of /dev/ad[n]; that is it refers to IDE drive n.
> >(Historically they had somewhat different meanings but even then still
> >refered to the same physical device -- the 'r' means raw)
> >
> >If n was 2 you have over written the beginning of ad2.
>
> Well I guess the good news is that the HD is probably ok then.
>
> :-)

Yes; should be.
>
> In FAT I seem to recall there are two copies of the boot sector.
> Does FreeBSD has anything like that?
>

I seem to recall some options or utilities under MS-DOS that did 
something like that, but think this was mainly for floppies.
Certainly there are duplicate copies of the FAT allocation tables,
but these are next to one another on the disk so don't really protect
against this sort of calamity.

I guess the nearest thing in FreeBSD is mutiple copies of the 
superblocks within the file system, but unless you can reconstruct 
the slice table(partition in MS terms) I don't believe it will help.

> If what I did trashed the first sectors would that have affected
> all mount points?

How big was the image you copied to the disk? -- that should tell
you how much of your drive is overwritten.

It is probable your disklabel has also disappeared, so you 
probably need to reconstruct both the slice table in the MBR and 
the disklabel in the first slice. With some vague recollections of 
what you did originally to install FBSD it is possible that some 
lucky guesses might work.

If you can find the first sector of a slice carrying an installed file
system then this might hold a copy of the slice table allowing
reconstruction of the original MBR with some confidence. 

Malcolm Kay
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fwd: Re: Please help. Can't see HD

2003-12-28 Thread Francisco Reyes
On Mon, 29 Dec 2003 14:27:01 +1030, Malcolm Kay wrote:

>This is likely your problem source!!!
>
>/dev/rad[n] is an alias of /dev/ad[n]; that is it refers to IDE drive n.
>(Historically they had somewhat different meanings but even then still
>refered to the same physical device -- the 'r' means raw)
>
>If n was 2 you have over written the beginning of ad2.

Well I guess the good news is that the HD is probably ok then.
:-)


In FAT I seem to recall there are two copies of the boot sector.
Does FreeBSD has anything like that?

If what I did trashed the first sectors would that have affected
all mount points?

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fwd: Re: Please help. Can't see HD

2003-12-28 Thread Malcolm Kay
On Mon, 29 Dec 2003 13:29, Francisco Reyes wrote:
> On Sun, 28 Dec 2003 20:54:06 -0500, Francisco Reyes wrote:
> >Is there a way to recover the label info? I don't know if the HD
> >is dying or whether the filesystem/HD boot sector is messed up.
>
> More info..
> When starting /stand/sysinstall it shows:
> ad2: raw partition size != slice size
> ad2: start 0, end 78168359, size 78165360
> ad2c: start 0, end 10239, size 10240
>
> This after upgrading to 4.9 stable as of 12-29-2003.
> The other thing I did today which I don't know if is related. I
> enabled USB today and was writing to a CF card in preparation to
> install M0n0wall on a soekris machine. After installing USB
> support and seen the card I did:
>
> gzcat net45xx-pbxrxxx.img | dd of=/dev/rad[n] bs=16k
>

This is likely your problem source!!!

/dev/rad[n] is an alias of /dev/ad[n]; that is it refers to IDE drive n.
(Historically they had somewhat different meanings but even then still
refered to the same physical device -- the 'r' means raw)

If n was 2 you have over written the beginning of ad2.


> Where the xxx were the version for the image and [n] was 1...
> /dev/rad1 (or was it.. 0..). Isn't that the CF card writer? I
> got the number after looking at camcontrol and usbdevs (can't
> remember which one from)... Did I messed up the drive when
> writing that image?
>

The scsii / usb devices appear under names such as da[n] or rda[n].

Yes; I think you did.

Likely you will need to reconfigure your drive and 
reinstall from your backup.

Malcolm Kay


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Fwd: Re: Please help. Can't see HD

2003-12-28 Thread Francisco Reyes
On Sun, 28 Dec 2003 20:54:06 -0500, Francisco Reyes wrote:

>Is there a way to recover the label info? I don't know if the HD
>is dying or whether the filesystem/HD boot sector is messed up.

More info..
When starting /stand/sysinstall it shows:
ad2: raw partition size != slice size
ad2: start 0, end 78168359, size 78165360
ad2c: start 0, end 10239, size 10240

This after upgrading to 4.9 stable as of 12-29-2003.
The other thing I did today which I don't know if is related. I
enabled USB today and was writing to a CF card in preparation to
install M0n0wall on a soekris machine. After installing USB
support and seen the card I did:

gzcat net45xx-pbxrxxx.img | dd of=/dev/rad[n] bs=16k

Where the xxx were the version for the image and [n] was 1...
/dev/rad1 (or was it.. 0..). Isn't that the CF card writer? I
got the number after looking at camcontrol and usbdevs (can't
remember which one from)... Did I messed up the drive when
writing that image?

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"