Thank you!  I gave it one more shot before attempting the script and I'm
back in.  I figured I'd try 0 for the beginning of the partition.

grits# disklabel sd1
# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: Ext SSD
duid: 2eeb6058175bf1f7
flags:
bytes/sector: 512
sectors/track: 20
tracks/cylinder: 22
sectors/cylinder: 440
cylinders: 2131143
total sectors: 937703088
boundstart: 0
boundend: 937703088

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  a:        937703040                0  4.2BSD   4096 32768     1
  c:        937703088                0  unused

On Thu, Apr 13, 2023 at 2:51 AM <cho...@jtan.com> wrote:

> Greg Thomas writes:
> > I just ran through a fresh 7.3 install onto sd0 on an old 6.8 laptop and
> I
> > have no idea what happened to the disklabel on sd1 (during the install I
> > only did an automatic disklabel on sd0).  This is just a backup of my
> > current laptop so not the end of the world (unless my current laptop dies
> > before I have a chance to back it up again).
>
> Part of the solution I used previously to recover my trashed disklabel
> was a script to create a partition on the disklabel with every
> starting value (a simple brute force approach). This proved to be
> far too slow so I resorted to hacking scan_ffs but that's because
> I had other partitions and swap of unknown size to skip over first
> to find the /var/backup partition that I needed.
>
> Since your lost partition is at the beginning of the disc somewhere
> this shouldn't be much of a problem. The end sector doesn't really
> matter if you'll mount the partition read-only provided it's large
> enough; just don't run fsck on it.
>
> Something along the lines of:
>
>         for k in `jot 2048`; do echo <blah> | disklabel -e sd0; mount -r
> /dev/sd1a /mnt && echo $k; umount /mnt; done
>
> Where <blah> is multi-line input to disklabel to delete and create
> partition a. Alternatively investigate disklabel's -R option.
>
> Then locate your disklabel backup, investigate -R if you didn't
> already, and restore it exactly.
>
> Matthew
>
>

Reply via email to