Solved Problem with recovering BSD install after messing with Windows install and MBR

Hello people. I have a legacy dual boot BSD+Windows setup. Recently I did some Windows-y stuff and messed with the boot loader. Anyhow; In an attempt to recover my FreeBSD install I wrote a bootonly iso to a thumb drive, booted BSD and ran
boot0cfg -B /dev/ada0
boot0cfg -m 0x5 -s 1 -t 90 /dev/ada0

like I did when I installed BSD. Now I'm writing this post on Windows, loaded by boot0, but boot0 is unable to boot my BSD install. It just prints out a hashmark every 90 ticks or everytime I press F3 or everytime I press Enter when 3rd partition is already selected.
 
Hello people. I have a legacy dual boot BSD+Windows setup.

I have one of those; win10pro (2 ntfs slices incl 'recovery'), a 32G FAT32 shared partition and 48G FreeBSD 12.3R, also boot0cfg, here slice 4.

Recently I did some Windows-y stuff and messed with the boot loader.

'Messed with' how? Did you remove, add or resize slices?

Anyhow; In an attempt to recover my FreeBSD install I wrote a bootonly iso to a thumb drive, booted BSD and ran
boot0cfg -B /dev/ada0
boot0cfg -m 0x5 -s 1 -t 90 /dev/ada0

like I did when I installed BSD.

Do you have a backup copy of your old MBR? If so, great, you can restore that, unless you resized slices. If not, make one first thing:

dd if=/dev/ada0 of=filename count=1

You may need to mount another stick to save the file. Use hd(1) to view. Worst case, you may need to hex edit the MBR and restore.

Alternatively, run old-school fdisk ada0 and write down exact start sector and no. of sectors for each slice. These should agree with the gpart show data.

Now I'm writing this post on Windows, loaded by boot0, but boot0 is unable to boot my BSD install. It just prints out a hashmark every 90 ticks or everytime I press F3 or everytime I press Enter when 3rd partition is already selected.

Rerun boot0cfg with -m 0xf in case windows has messed with the slice numbering?

In windows (10?), control panel / system & security / administrative tools / create & format hard disk partitions (aka Disk Management - PHEW!) - to check .. your FreeBSD slice space should appear as 'Healthy (Primary Partition)' but 'doze doesn't protect or recognise the space at all. Bad 'doze!

Good luck ...
 
Can you boot on your thumb drive and provide us the output of gpart show ada0?
Code:
63            250069617        ada0 MBR            (119G)
63            1985            - free -             (993K)
2048          204800       1    ntfs  [active]     (100M)
206848        182749184    2    ntfs               (87G)
182956032     67108864     3    freebsd            (32G)
250064896     4784            - free -             (2.3M)
smithi said:
'Messed with' how? Did you remove, add or resize slices?
I did remove my Windows (7) partitions, installed Windows 10 LTSC, wiped Windows again (driver issues) and restored my old Windows partitions from backup. My BSD slice seems to be ok; I can mount it in the live environment.
smithi said:
Do you have a backup copy of your old MBR? If so, great, you can restore that, unless you resized slices. If not, make one first thing:
I do not. I kinda hoped I can just install boot0 using boot0cfg(8) and it'd just run. As for backing this one up; I don't see the point of backing up something that doesn't work properly yet.
smithi said:
These should agree with the gpart show data.
It does. See attachment if you'd like.
smithi said:
Rerun boot0cfg with -m 0xf
Didn't help as the parti- slices are just like they were before all that.
smithi said:
your FreeBSD slice space should appear as 'Healthy (Primary Partition)'
It does.

Unrelated Post scriptum
I get that things are upside down down there mate but no need for a deep dive into control panel for disk management. Just search for fdisk in the Start menu (Windows 7's start works. Don't know about 10's Bing-infested start) or run diskmgmt.msc
 

Attachments

  • fdisk.txt
    1.1 KB · Views: 96
The printing of # by boot0 can mean it didn't find an executable boot program on your slice ada0s3. I don't know why it would have disappeared but it is a possibility.

You might try: # bsdlabel -B ada0s3
bsdlabel(8)
 
The printing of # by boot0 can mean it didn't find an executable boot program on your slice ada0s3. I don't know why it would have disappeared but it is a possibility.

You might try: # bsdlabel -B ada0s3
bsdlabel(8)
Thank you. It worked!
 
Code:
63            250069617        ada0 MBR            (119G)
63            1985            - free -             (993K)
2048          204800       1    ntfs  [active]     (100M)
206848        182749184    2    ntfs               (87G)
182956032     67108864     3    freebsd            (32G)
250064896     4784            - free -             (2.3M)

Same size exactly as my T430s' SSD. I'd used the surprisingly good win10 tools to shrink the main ntfs partition to 38G and add a 32G fat32lba one, leaving 48G for FreeBSD, though I'm finding that too small. I wouldn't get away with a W10 reinstall without clobbering FreeBSD.

I did remove my Windows (7) partitions, installed Windows 10 LTSC, wiped Windows again (driver issues) and restored my old Windows partitions from backup. My BSD slice seems to be ok; I can mount it in the live environment.

I could say you were lucky, but acknowledge skillful :)

I do not. I kinda hoped I can just install boot0 using boot0cfg(8) and it'd just run. As for backing this one up; I don't see the point of backing up something that doesn't work properly yet.

So now that it does? I'd also forgotten about saving good ol' bsdlabel data, esp. with multiple partitions in a slice.

Unrelated Post scriptum
I get that things are upside down down there mate but no need for a deep dive into control panel for disk management. Just search for fdisk in the Start menu (Windows 7's start works. Don't know about 10's Bing-infested start) or run diskmgmt.msc

Ta. Fine once you know, but it took me some deep diving to find that stuff, so mentioning it pour les autres. We all live on top of the world ...

Last M$ product I bought was DOS 5.0 c. 1990, though I'd had to sort out workmates' issues with w3.1, w95, vista (ugh), 7 (better) and 8 (worse). This laptop I'm leaving to the kids, hence W10 and FAT32 shared partitions for sound and graphic files made on FreeBSD. Not that you needed to know ...

Glad it worked out for you.
 
Back
Top