UFS mount and fsck can't open /dev/da1p1

I have a usb stick, which contains the root and boot filesystem for a server.
I think a power outage occurred (another colocated server with a similar usb stick also crashed, but fsck was able to repair the partitions there).
For the usb stick in question:
fdisk and gpart can read it and show the partitions correctly. Mounting is not possible of any partition. booting from it also fails. ddrescue copied the whole stick without any errors.
On the image again, fdisk and gpart work flawlessly, only interacting with the partitions doesn't work.

Bash:
root@matzenas:/dev # uname -a
FreeBSD matzenas 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 GENERIC  amd64

What I've done so far:
This is the physical device, camcontrol and usbconfig see it:
Code:
root@matzenas:/dev # dmesg | grep ^da1
da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
da1: <SanDisk Ultra 1.00> Removable Direct Access SPC-4 SCSI device
da1: Serial Number 4C530001091102122154
da1: 40.000MB/s transfers
da1: 29328MB (60063744 512 byte sectors)
da1: quirks=0x2<NO_6_BYTE>
root@matzenas:/dev # camcontrol devlist | grep ,da1
<SanDisk Ultra 1.00>               at scbus7 target 0 lun 0 (pass5,da1)
root@matzenas:/dev # usbconfig | grep ugen0.4
ugen0.4: <SanDisk Ultra> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (224mA)

Also the partition table seems to be intact and the special files in /dev are also there:
Code:
root@matzenas:/dev # fdisk /dev/da1
******* Working on device /dev/da1 *******
parameters extracted from in-core disklabel are:
cylinders=3738 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3738 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 238 (0xee),(EFI GPT)
    start 1, size 60063743 (29327 Meg), flag 0
    beg: cyl 0/ head 0/ sector 2;
    end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

root@matzenas:/dev # gpart show /dev/da1
=>      40  60063664  da1  GPT  (29G)
        40      1024    1  freebsd-boot  (512K)
      1064  56622080    2  freebsd-ufs  (27G)
  56623144   3002368    3  freebsd-swap  (1.4G)
  59625512    438192       - free -  (214M)
root@matzenas:/dev # ls -l da1*
crw-r-----  1 root  operator  0x70  1 März 12:21 da1
crw-r-----  1 root  operator  0x72  1 März 12:21 da1p1
crw-r-----  1 root  operator  0x73  1 März 12:21 da1p2
crw-r-----  1 root  operator  0x75  1 März 12:21 da1p3

Mounting however fails:
Code:
root@matzenas:/dev # mount /dev/da1p1 /mnt/
mount: /dev/da1p1: No such file or directory
root@matzenas:/dev # mount /dev/da1p2 /mnt/
mount: /dev/da1p2: No such file or directory
root@matzenas:/dev # mount /dev/da1p3 /mnt/
mount: /dev/da1p3: No such file or directory


I've created an image of it with ddrescue and created a memory disk on it. For that the information shown above is completely the same. And also the error at mounting.
Code:
root@matzenas:~ # ddrescue /dev/da1 da1_rescue.img da1_rescue.log
root@matzenas:~ # mdconfig -a -t vnode -u 0 -f da1_rescue.img

I've also tried to create a NOP GEOM, but that also didn't help (but i'm unsure if I calculated the offset correctly, Hints in that direction are also very welcome)
Code:
root@matzenas:/dev # gnop create -o 512K md0

dumpfs and fsck_ufs also fails:
Code:
root@matzenas:/dev # dumpfs /dev/md0p1
dumpfs: /dev/md0p1: No such file or directory
root@matzenas:/var # fsck_ufs /dev/md0p1
Can't open /dev/md0p1: No such file or directory
root@matzenas:/var # fsck_ufs /dev/md0p2
Can't open /dev/md0p2: No such file or directory
root@matzenas:/var # fsck_ufs /dev/md0p3
Can't open /dev/md0p3: No such file or directory

How do I continue?
 
Are you sure you have mountable file systems on these partitions?
Can you double check with, like glabel status, or even fsck on the partition you want to mount.

I don't think you can mount a swap partition. Use swapon command.

freebsd-boot is more of a raw partition. You write bootcode to it with "gpart bootcode .." (But correct me if I am wrong. xD). I don't think you can use mount here.
 
Okay so only da1p2 should be mountable.
Code:
root@matzenas:~ # glabel status | grep " da1"
gptid/58651486-bc67-11e9-ae36-001a4d71dedb     N/A  da1p1
gptid/586c8ca0-bc67-11e9-ae36-001a4d71dedb     N/A  da1p3
          diskid/DISK-4C530001091102122154     N/A  da1
gptid/5868745f-bc67-11e9-ae36-001a4d71dedb     N/A  da1p2
root@matzenas:~ # fstyp da1p2
fstyp: da1p2: filesystem not recognized
# same for the other da1p*

Should I just give up and reformat and start from scratch? I know this stick to have been working and containing a running system.
Is there some documentation what a partition start and ufs filesystem start would look like in hex, so I can dig a little with dd and hexeditors? my google-fu skills weren't enough to find it.
 
Back up the whole stick to another stick then run fsck_ffs/fsck_ufs on the second partition. If the superblock is damaged then you may be able to pass the offset of an alternate superblock (-b 160 for UFS2 or -b 32 for UFS1) to fsck_ufs. Also passing the -u flag to fstyp will widen its net in terms of things it detects beyond just mountable filesystems.
 
Back
Top