Date: Tue, 1 Mar 2016 13:41:21 +0100 From: Bernt Hansson <bah@bananmonarki.se> To: Polytropon <freebsd@edvax.de> Cc: questions FreeBSD <FreeBSD-questions@freebsd.org> Subject: Re: boot code Message-ID: <56D58DF1.4060307@bananmonarki.se> In-Reply-To: <20160229194502.eebeabd6.freebsd@edvax.de> References: <56D376F9.10207@bananmonarki.se> <20160228235850.5051e942.freebsd@edvax.de> <56D48D29.4060608@bananmonarki.se> <20160229194502.eebeabd6.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-02-29 19:45, Polytropon wrote: > On Mon, 29 Feb 2016 19:25:45 +0100, Bernt Hansson wrote: >> On 2016-02-28 23:58, Polytropon wrote: >>> 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' >>> save >>> # 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: >>> >>> http://www.wonkity.com/~wblock/docs/html/disksetup.html >>> >>> https://www.freebsd.org/doc/handbook/disks-adding.html >>> >>> http://www.freebsd.org/doc/handbook/geom-glabel.html >>> >>> Avoid MBR partitioning if possible - it's considered obsolete, >>> outdated, old-fashioned, stupid and lame. ;-) >>> >> Thank you but no cigar. >> >> The machine is amd64 10.2-R so my guess its gpt. > > 10.2 and amd64 doesn't exclude the use of MBR or dedicated. :-) > When using GPT, both fdisk and bsdlabel are quite useless. > (They are also obsolete as gpart can do MBR partitioning, too.) > > So in your case, the following approach should work: > > # gpart create -s gpt ada1 > # gpart add -t freebsd-boot -l gpboot -b 40 -s 512K ada1 > # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1 > > After installing the boot code, add data partions as desired: > > # gpart add -t freebsd-ufs -l gprootfs -b 1M -s <size> ada1 > > Refer to: > > http://www.wonkity.com/~wblock/docs/html/disksetup.html#_the_new_standard_gpt > Tried GPT and it ask for bootcode and not booting, so MBR it is.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56D58DF1.4060307>