Re: [SLUG] Help I just destroyed my Root filesystem

2003-06-13 Thread mlh


> when the old LILO bootloaded installed it used to back up the old
> first sector of the disk it was installing in under /boot.
> Hopefully GRUB does the same.
> 
> I can see an interesting looking /boot/boot.b on my system which
> might stand for "boot block". you may be able to dd that back onto
> /dev/hda5 and just maybe that will work. have a look at the time
> stamp on /boot/boot.b and see if it looks close to when you did
> the grub install

boot.b seems to be a lilo thing (do a strings /boot/boot.b)

unfortuneately grub does not seem to make a backup.

Maybe you make a another reiserfs on a another similarly
sized file system, and dd the the first block of that
onto your destroyed filesystem, then try a reiserfsck
on the result.  (clutching at straw here though, I don't
know how much info reiser puts in the first block)

Matt
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug


Re: [SLUG] Help I just destroyed my Root filesystem

2003-06-12 Thread Andrew McNaughton
On Fri, 13 Jun 2003, Richard Heycock wrote:

> Date: Fri, 13 Jun 2003 16:14:13 +1000 (EST)
> From: Richard Heycock <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
> Subject: Re: [SLUG] Help I just destroyed my Root filesystem
>
> > On Fri, 13 Jun 2003, Richard Heycock wrote:
> >
> >> Hi,
> >>
> >> I'm new to this list and I need some help! I just ran grub-install on
> >> my root partition instead of my boot partition and it appears to have
> >> wreaked it.
> >
> > Ouch.
> >
> >> If I run file -s /dev/hda5 I now get 'x86 boot sector' instead of
> >> 'ReiserFS V3.6 block...' and I can no longer mount it.
> >> When the machine tries to boot it loads the kernel (from /dev/hda6)
> >> but when it comes to mount the root partition it kernel panics as it
> >> cannot mountthe filesystem.
> >>
> >> I know at least some of the data is on the partition (`less
> >> /dev/hda5`). I'm guessing that grub-install has overwritten N number
> >> of bytes at the beginning of the partition but beyond that I'm at a
> >> complete loss at what to do.
> >
> > Your probably not in too bad shape.  The boot sector is just a single
>
> Arr nice to hear some positive thoughts :-) I've only been met with stoney
> silence on other lists (debian-users and reiserfs), though I'm told there
> are these things called time zones...
>
> > sector, and the rest of the drive should be untouched.  The trick is
> > recovering that first sector.
>
> When you say sector do you mean the sector as in the disc drive or something
> else?

I mean the first chunk of space on the device.  ie the disk partition.
It's probably only the first 512 bytes which have been clobbered.


> >
> > Your basic tool for moving stuff around is dd which you can use to copy
> > just the first sector from one file (ie probably a device file) to
> > another.
> >
> > I don't know the details of ReiserFS.  There's a good chance though
> > that the first sector contains only really generic stuff, and/or there
> > are backups stored elsewhere on the device.  You might even find it's
> > as easy as copying the first sector (only) from a healthy ReiserFS file
> > system to your damaged one.  There's nothing on that sector you're
> > trying to save, so just give it a whirl, but DONT MOUNT THE FILE SYSTEM
> > IN OTHER THAN READ ONLY MODE until you're pretty sure its OK, and then
> > consider copying the most important files out of the file system when
> > it becomes accessible.
>
> The first thing I did was to dd the entire partition on to another partition
> so I've got some scope for experiment.
>
> I've dd'ed the first 512 bytes from a healthy reiserfs partition but without
> success. I also tried to 'strace grub-install' to see how much data was
> being copied to the disc but I got an error message (something about the
> bios) but I am trying to do this from within Knoppix so things are unlikely
> to be the same.

Try looking at the two of them and see how much is different?

Can you rig something up to look for a duplicate of the first sector of
the healthy system further into the device?  If so, is there more than one
duplicate copy?  Are the blocks at the same offsets the same in the
damaged system?

If it was me I'd do this with a simple perl script. YMMV.

Where I've screwed up a file system in the past I wrote a script which
chugged through the device file and took any blocks of text (byte values
0..127) longer than 1K or so and put these into successively numbered
files.  It's a long way from putting a system back together, but if all
else fails, its a ways to make at least some of your files recoverable.

> > If it's not so happily simple and the first sector contains the root of
> > your file system, device parameters or something similar, then the
> > place to get help is probably a developers list for the ReiserFS file
> > system.
>
> I posted a message to this list but I haven't heard anything back yet, I'll
> wait and see what happens this evening. I'm in a bit of a panic at the
> moment so I'm trying everything I can think of!

The thing is to make it clear that you are making an effort to help
yourself.  Give enough detail that someone knowledgable can set you
straight without having to explain things from the beginning in order to
pick you up along the way somewhere.  Ask questions which are as specific
as you can manage and which are quick to answer, even if that's just
'where can I read up about XYZ'.

Andrew


--

No added Sugar.  Not tested on animals.  If irritation occurs,
discontinue use.

---
Andrew McNaughton   In Sydney
Working on a Product Recommender System
[EMAIL PROTECTED]
Mobile: +61 422 753 792 http://staff.scoop.co.nz/andrew/cv.doc



-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug


Re: [SLUG] Help I just destroyed my Root filesystem

2003-06-12 Thread stuartc
> >> I'm new to this list and I need some help! I just ran grub-install on
> >> my root partition instead of my boot partition and it appears to have
> >> wreaked it.

when the old LILO bootloaded installed it used to back up the old
first sector of the disk it was installing in under /boot.
Hopefully GRUB does the same.

I can see an interesting looking /boot/boot.b on my system which
might stand for "boot block". you may be able to dd that back onto
/dev/hda5 and just maybe that will work. have a look at the time
stamp on /boot/boot.b and see if it looks close to when you did
the grub install.

there is a complicated procedure to rebuild ext2 partition tables
if through mischance you trash them. (i once spent 3/4 of a day doing
just this; there is a HOWTO about it that explains it pretty well)
it may or may not work for Reiserfs partition tables.

good luck,
stuart.
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug


Re: [SLUG] Help I just destroyed my Root filesystem

2003-06-12 Thread Richard Heycock
> On Fri, 13 Jun 2003, Richard Heycock wrote:
>
>> Hi,
>>
>> I'm new to this list and I need some help! I just ran grub-install on
>> my root partition instead of my boot partition and it appears to have
>> wreaked it.
>
> Ouch.
>
>> If I run file -s /dev/hda5 I now get 'x86 boot sector' instead of
>> 'ReiserFS V3.6 block...' and I can no longer mount it.
>> When the machine tries to boot it loads the kernel (from /dev/hda6)
>> but when it comes to mount the root partition it kernel panics as it
>> cannot mountthe filesystem.
>>
>> I know at least some of the data is on the partition (`less
>> /dev/hda5`). I'm guessing that grub-install has overwritten N number
>> of bytes at the beginning of the partition but beyond that I'm at a
>> complete loss at what to do.
>
> Your probably not in too bad shape.  The boot sector is just a single

Arr nice to hear some positive thoughts :-) I've only been met with stoney
silence on other lists (debian-users and reiserfs), though I'm told there
are these things called time zones...

> sector, and the rest of the drive should be untouched.  The trick is
> recovering that first sector.

When you say sector do you mean the sector as in the disc drive or something
else?

>
> Your basic tool for moving stuff around is dd which you can use to copy
> just the first sector from one file (ie probably a device file) to
> another.
>
> I don't know the details of ReiserFS.  There's a good chance though
> that the first sector contains only really generic stuff, and/or there
> are backups stored elsewhere on the device.  You might even find it's
> as easy as copying the first sector (only) from a healthy ReiserFS file
> system to your damaged one.  There's nothing on that sector you're
> trying to save, so just give it a whirl, but DONT MOUNT THE FILE SYSTEM
> IN OTHER THAN READ ONLY MODE until you're pretty sure its OK, and then
> consider copying the most important files out of the file system when
> it becomes accessible.

The first thing I did was to dd the entire partition on to another partition
so I've got some scope for experiment.

I've dd'ed the first 512 bytes from a healthy reiserfs partition but without
success. I also tried to 'strace grub-install' to see how much data was
being copied to the disc but I got an error message (something about the
bios) but I am trying to do this from within Knoppix so things are unlikely
to be the same.


>
> If it's not so happily simple and the first sector contains the root of
> your file system, device parameters or something similar, then the
> place to get help is probably a developers list for the ReiserFS file
> system.

I posted a message to this list but I haven't heard anything back yet, I'll
wait and see what happens this evening. I'm in a bit of a panic at the
moment so I'm trying everything I can think of!

rgh


>
> Andrew
>
>
>
> --
>
> No added Sugar.  Not tested on animals.  If irritation occurs,
> discontinue use.
>
> ---
> Andrew McNaughton   In Sydney
>Working on a Product Recommender System
> [EMAIL PROTECTED]
> Mobile: +61 422 753 792 http://staff.scoop.co.nz/andrew/cv.doc



-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug


Re: [SLUG] Help I just destroyed my Root filesystem

2003-06-12 Thread Andrew McNaughton
On Fri, 13 Jun 2003, Richard Heycock wrote:

> Hi,
>
> I'm new to this list and I need some help! I just ran grub-install on my
> root partition instead of my boot partition and it appears to have wreaked
> it.

Ouch.

> If I run file -s /dev/hda5 I now get 'x86 boot sector' instead of
> 'ReiserFS V3.6 block...' and I can no longer mount it.
> When the machine tries to boot it loads the kernel (from /dev/hda6) but
> when it comes to mount the root partition it kernel panics as it cannot
> mountthe filesystem.
>
> I know at least some of the data is on the partition (`less /dev/hda5`).
> I'm guessing that grub-install has overwritten N number of bytes at the
> beginning of the partition but beyond that I'm at a complete loss at what
> to do.

Your probably not in too bad shape.  The boot sector is just a single
sector, and the rest of the drive should be untouched.  The trick is
recovering that first sector.

Your basic tool for moving stuff around is dd which you can use to copy
just the first sector from one file (ie probably a device file) to
another.

I don't know the details of ReiserFS.  There's a good chance though that
the first sector contains only really generic stuff, and/or there are
backups stored elsewhere on the device.  You might even find it's as easy
as copying the first sector (only) from a healthy ReiserFS file system to
your damaged one.  There's nothing on that sector you're trying to save,
so just give it a whirl, but DONT MOUNT THE FILE SYSTEM IN OTHER THAN READ
ONLY MODE until you're pretty sure its OK, and then consider copying the
most important files out of the file system when it becomes accessible.

If it's not so happily simple and the first sector contains the root of
your file system, device parameters or something similar, then the place
to get help is probably a developers list for the ReiserFS file system.

Andrew



--

No added Sugar.  Not tested on animals.  If irritation occurs,
discontinue use.

---
Andrew McNaughton   In Sydney
Working on a Product Recommender System
[EMAIL PROTECTED]
Mobile: +61 422 753 792 http://staff.scoop.co.nz/andrew/cv.doc



-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug