boot code

Polytropon freebsd at
Sun Feb 28 22:58:57 UTC 2016

On Sun, 28 Feb 2016 23:38:49 +0100, Bernt Hansson wrote:
> Hello list!
> I need to get the boot code on a hdd.
> Tried boot0cfg and fdisk -B /dev/ada1
> But upon a reboot choosing the hdd it just don´t boot.

The disk needs to have at least one partition that's marked
as active, if I remember correctly. This is the "old way"
of initializing it:

	# fdisk -BI /dev/ada1
	# bsdlabel -B -w ada0s1

Add "-b /boot/boot0" for the fdisk command if you need to
specify the boot code (normal boot or boot manager).

If you want to use the whole disk as a "dedicated partition",
you can do this:

	# bsdlabel -w ada1
	# bsdlabel -e ada1
		set type "4.2BSD" for 'a' partition
		make 'a' same size as 'c'
	# newfs -m 0 -i 16384 -b 16384 -f 2048 -U -t enable -n disable -L ssdroot /dev/ada1a
	# bsdlabel -B ada1

Adjust -i, -b and -f according to the expected usage.
But that's not a very kind way to deal with disks. :-)

You should use gpart today. There is good documentation
in "man gpart", as well as those resources:

Avoid MBR partitioning if possible - it's considered obsolete,
outdated, old-fashioned, stupid and lame. ;-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list