Re: how to recover a corrupted disk

2021-12-03 Thread Sandeep Gupta
much ado for nothing... It seems when I yanked the data cable, it
wasn't the disk that got corrupted.
It was the  UEFI loader on sdcard that had become corrupted. Not sure
when that had happened. This issue is documented
here (https://github.com/pftf/RPi4/issues/97). I had ended up
formatting the disk unnecessarily. Thanks a ton for pitching in
suggestions.

On Wed, Dec 1, 2021 at 7:30 PM Ian Darwin  wrote:
>
> On Wed, Dec 01, 2021 at 01:39:39PM +0530, Sandeep Gupta wrote:
> > Hello,
> >  All partitions except for /dev/rsd1c and /dev/rsd1i are clean.
> >  For /dev/rsd1c , I get  "BAD SUPER BLOCK: MAGIC NUMBER WRONG".
> >  For /dev/rsd1i, I get "UNEXPECTED INCONSISTENCY".
>
> If that's the case, you are probably done! You could mount
> your 'a' partition manually on /mnt, look in /mnt/etc/fstab, and
> see which letter partitions belong where; use that info to make
> sure you have "found" all your partitions.
>
> BTW, in addition to scan_ffs in base, there is testdisk in ports,
> which I think does a better job ATM of finding FFS2 filesystems.
>
> As mentioned, DO NOT do anything with 'c' partition (be glad,
> be very glad, that it didn't find anything resembling a superblock
> when fsck'ing 'c'!). It's not a mountable partition but a 'wrapper'
> for the whole disk.



Re: how to recover a corrupted disk

2021-12-01 Thread Ian Darwin
On Wed, Dec 01, 2021 at 01:39:39PM +0530, Sandeep Gupta wrote:
> Hello,
>  All partitions except for /dev/rsd1c and /dev/rsd1i are clean.
>  For /dev/rsd1c , I get  "BAD SUPER BLOCK: MAGIC NUMBER WRONG".
>  For /dev/rsd1i, I get "UNEXPECTED INCONSISTENCY".

If that's the case, you are probably done! You could mount
your 'a' partition manually on /mnt, look in /mnt/etc/fstab, and
see which letter partitions belong where; use that info to make
sure you have "found" all your partitions.

BTW, in addition to scan_ffs in base, there is testdisk in ports,
which I think does a better job ATM of finding FFS2 filesystems.

As mentioned, DO NOT do anything with 'c' partition (be glad,
be very glad, that it didn't find anything resembling a superblock
when fsck'ing 'c'!). It's not a mountable partition but a 'wrapper'
for the whole disk.



Re: how to recover a corrupted disk

2021-12-01 Thread Peter J. Philipp
Sandeep, go ahead reformat your disk.  Do keep in mind the structure of 
a BSD disk though


a partition - is usually /

b partition - is usually swap

c partition - is always the entire disk including a, and b,

and it goes on.../var, /usr, /usr/local, /home etc etc

Best Regards,

-peter

On 12/1/21 13:19, Sandeep Gupta wrote:

Not sure why not. It seems the rsd1c is where the superblock is. Also
there is no other
mechanism to refer to the whole disk. I guess it's time to format the disk.

On Wed, Dec 1, 2021 at 4:20 PM Janne Johansson  wrote:

Den ons 1 dec. 2021 kl 11:09 skrev Sandeep Gupta :

@Peter, @Janne: Thanks for the infos. Newfs seemed promising but it
seems like the disk is beyond repair :(.
I did newfs -N and got quite a few location of superblocks:
Then I tried
fsck_ffs -b #blockid /dev/rsd1c

You should *NOT* newfs or fsck against the "C" partition.


--
May the most significant bit of your life be positive.




Re: how to recover a corrupted disk

2021-12-01 Thread Otto Moerbeek
On Wed, Dec 01, 2021 at 05:49:06PM +0530, Sandeep Gupta wrote:

> Not sure why not. It seems the rsd1c is where the superblock is. Also

Each filesystem has it's own superblock, residing at the start of
its partition.

c partitions are a way to refer to the whole disk and do not have a
filesystems. Writing anything to it will destroy partitions.

ATM you likely have a fixable system. After writing to the c partition
you will *have* to reinstall.

-Otto

> there is no other
> mechanism to refer to the whole disk. I guess it's time to format the disk.
> 
> On Wed, Dec 1, 2021 at 4:20 PM Janne Johansson  wrote:
> >
> > Den ons 1 dec. 2021 kl 11:09 skrev Sandeep Gupta :
> > > @Peter, @Janne: Thanks for the infos. Newfs seemed promising but it
> > > seems like the disk is beyond repair :(.
> > > I did newfs -N and got quite a few location of superblocks:
> > > Then I tried
> > > fsck_ffs -b #blockid /dev/rsd1c
> >
> > You should *NOT* newfs or fsck against the "C" partition.
> >
> >
> > --
> > May the most significant bit of your life be positive.
> 



Re: how to recover a corrupted disk

2021-12-01 Thread Sandeep Gupta
Not sure why not. It seems the rsd1c is where the superblock is. Also
there is no other
mechanism to refer to the whole disk. I guess it's time to format the disk.

On Wed, Dec 1, 2021 at 4:20 PM Janne Johansson  wrote:
>
> Den ons 1 dec. 2021 kl 11:09 skrev Sandeep Gupta :
> > @Peter, @Janne: Thanks for the infos. Newfs seemed promising but it
> > seems like the disk is beyond repair :(.
> > I did newfs -N and got quite a few location of superblocks:
> > Then I tried
> > fsck_ffs -b #blockid /dev/rsd1c
>
> You should *NOT* newfs or fsck against the "C" partition.
>
>
> --
> May the most significant bit of your life be positive.



Re: how to recover a corrupted disk

2021-12-01 Thread Janne Johansson
Den ons 1 dec. 2021 kl 11:09 skrev Sandeep Gupta :
> @Peter, @Janne: Thanks for the infos. Newfs seemed promising but it
> seems like the disk is beyond repair :(.
> I did newfs -N and got quite a few location of superblocks:
> Then I tried
> fsck_ffs -b #blockid /dev/rsd1c

You should *NOT* newfs or fsck against the "C" partition.


-- 
May the most significant bit of your life be positive.



Re: how to recover a corrupted disk

2021-12-01 Thread Sandeep Gupta
@Peter, @Janne: Thanks for the infos. Newfs seemed promising but it
seems like the disk is beyond repair :(.
I did newfs -N and got quite a few location of superblocks:
Then I tried
fsck_ffs -b #blockid /dev/rsd1c

No matter which blockid i tried, it always gave the same BAD SUPER
BLOCK: MAGIC NUMBER WRONG.
I guess I would have to wipe it clean from here.

On Wed, Dec 1, 2021 at 2:06 PM Janne Johansson  wrote:
>
> Den ons 1 dec. 2021 kl 09:12 skrev Sandeep Gupta :
> >  I am running OpenBSD 7.0 on RPi4. I accidentally removed the usb
> > cable connecting the sata ssd to the RPi4.
> >  Well OpenBSD froze and upon reboot I got the very comforting
> > Synchronous Exception  message.
> >  Thankfully, I have another RPi4 running OpenBSD. I can mount the
> > corrupted disk ( did the  necessary backups). I did fsck on all the
> > partitions.
> >  All partitions except for /dev/rsd1c and /dev/rsd1i are clean.
> >  For /dev/rsd1c , I get  "BAD SUPER BLOCK: MAGIC NUMBER WRONG".
>
> The "c" partition is not meant to hold filesystems, it is the device
> used to talk to "the whole disk" for fdisk and such tools.
>
> >  For /dev/rsd1i, I get "UNEXPECTED INCONSISTENCY".
>
> If you had any non-bsd filesystems (like a small MSDOS/FAT partition
> for booting/firmware/arm blob stuff), it will end up as sdXi (and
> j,k,l, and so on if you have more than one foreign fs), so if that is
> the case, then it is not unexpected to see FFS' fsck have issues with
> FAT filesystems.
>
> --
> May the most significant bit of your life be positive.



Re: how to recover a corrupted disk

2021-12-01 Thread Janne Johansson
Den ons 1 dec. 2021 kl 09:12 skrev Sandeep Gupta :
>  I am running OpenBSD 7.0 on RPi4. I accidentally removed the usb
> cable connecting the sata ssd to the RPi4.
>  Well OpenBSD froze and upon reboot I got the very comforting
> Synchronous Exception  message.
>  Thankfully, I have another RPi4 running OpenBSD. I can mount the
> corrupted disk ( did the  necessary backups). I did fsck on all the
> partitions.
>  All partitions except for /dev/rsd1c and /dev/rsd1i are clean.
>  For /dev/rsd1c , I get  "BAD SUPER BLOCK: MAGIC NUMBER WRONG".

The "c" partition is not meant to hold filesystems, it is the device
used to talk to "the whole disk" for fdisk and such tools.

>  For /dev/rsd1i, I get "UNEXPECTED INCONSISTENCY".

If you had any non-bsd filesystems (like a small MSDOS/FAT partition
for booting/firmware/arm blob stuff), it will end up as sdXi (and
j,k,l, and so on if you have more than one foreign fs), so if that is
the case, then it is not unexpected to see FFS' fsck have issues with
FAT filesystems.

-- 
May the most significant bit of your life be positive.



how to recover a corrupted disk

2021-12-01 Thread Sandeep Gupta
Hello,

 I am running OpenBSD 7.0 on RPi4. I accidentally removed the usb
cable connecting the sata ssd to the RPi4.
 Well OpenBSD froze and upon reboot I got the very comforting
Synchronous Exception  message.
 Thankfully, I have another RPi4 running OpenBSD. I can mount the
corrupted disk ( did the  necessary backups). I did fsck on all the
partitions.
 All partitions except for /dev/rsd1c and /dev/rsd1i are clean.
 For /dev/rsd1c , I get  "BAD SUPER BLOCK: MAGIC NUMBER WRONG".
 For /dev/rsd1i, I get "UNEXPECTED INCONSISTENCY".

I tried scan_ffs -l sd1 but it didn't report the full disklabel for sd1.
 What's the least disruptive way out of  this quagmire? Or, things are
beyond repair
and should I wipe clean and start over?

Thanks.
Sandeep