# Invalid Partition



## konadave (Jan 31, 2012)

FreeBSD 8.1-RELEASE

After updating three ports (libtool-2.4_1, libltdl-2.4_1, bison-2.4.3,1) this morning, I rebooted and was greeted with 'Invalid Partition' and the 'boot:' prompt. I wasn't able to do anything here at all, even ? didn't do anything.

Booted the livefs and got into fixit mode. A listing of /dev shows the drive and all its partitions. I'm able to mount and use all of the partitions. There does not appear to be any sort of data loss, it just won't boot anymore.

*fdisk* shows:

```
Fixit# fdisk ad0
******* Working on device /dev/ad0 *******
parameters extracted from in-core disklabel are:
cylinders=124091 heads=15 sectors/track=63 (945 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=124091 heads=15 sectors/track=63 (945 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 165 (0xa5),(FreeBSD,NetBSD,386BSD)
    start 63, size 117265932 (57258 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 14/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```

*bsdlabel* shows:

```
Fixit# bsdlabel ad0s1
# /dev/ad0s1:
8 partitions:
#        size   offset  fstype  [fsize bsize bps/cpg]
  a:  1048576        0  4.2BSD      0     0      0
  b:  2097152  1048576    swap
  c: 117266932       0  unused      0     0
  d:  4194304  3145728  4.2BSD      0     0      0
  e:  1048576  7340032  4.2BSD      0     0      0
  f: 108877324 8388608  4.2BSD      0     0      0
```

I tried an *fdisk -B ad0* but that didn't fix anything. Is the fsize/bsize all showing up as zero the problem? If so, what should these values be, and if not, what is the problem and how do I go about fixing it?

I would rather find a way to fix it rather than reinstalling the OS and ports. I did *tar* each partition to an external drive; would recreating the slice/partitions/file systems and then extracting the tars work?

Thanks your help.

Dave


----------



## kpa (Feb 1, 2012)

Try if recreating the bootblock on ad0s1 with bsdlabel(8) does anything:

`# bsdlabel -B ad0s1`

It's curious that the offset of the first partition ad0s1a is zero when it should be 16 to make room for the boot code, that's what the first 16 blocks are used for as far as I know.

The other zeros in the rightmost columns are normal. The settings themselves are a leftover from days when you could figure out the real geometry of a disk drive and you actually had to pay attention to it. Now they are unused and just set to zero.


----------



## konadave (Feb 1, 2012)

I tried *bsdlabel -B /dev/ad0s1* as suggested but that didn't fix the problem.

I have a spare external drive lying around that I was going to experiment with; fdisk/bsdlabel/newfs then extract the tarballs to see if that woud work. Before going through the trouble I went into the BIOS to make sure I could boot from an external drive. Turns out that it was trying to boot from a data drive instead of the system drive. I can't remember the last time I had a reason to go into the BIOS, and I know the box has been rebooted several times since then. I don't know what would have caused the boot drive to change. Anyway, selecting the correct drive has fixed the problem.


----------



## wblock@ (Feb 1, 2012)

konadave said:
			
		

> Before going through the trouble I went into the BIOS to make sure I could boot from an external drive. Turns out that it was trying to boot from a data drive instead of the system drive. I can't remember the last time I had a reason to go into the BIOS, and I know the box has been rebooted several times since then. I don't know what would have caused the boot drive to change. Anyway, selecting the correct drive has fixed the problem.



Good!  Now would be a good time for a full backup.  Backup Options For FreeBSD shows some ways to do that.

tar(1) is fine for making archives of files and directories, but dump(8) is much better for backing up a filesystem.


----------



## von_Gaden (Feb 1, 2012)

Thanks for the short but complete article on Backup Options, wblock!


----------

