From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 13 22:11:55 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BC1EEBE for ; Thu, 13 Dec 2012 22:11:55 +0000 (UTC) (envelope-from dieterbsd@engineer.com) Received: from mailout-us.gmx.com (mailout-us.gmx.com [74.208.5.67]) by mx1.freebsd.org (Postfix) with SMTP id 179E38FC14 for ; Thu, 13 Dec 2012 22:11:55 +0000 (UTC) Received: (qmail 31818 invoked by uid 0); 13 Dec 2012 22:11:48 -0000 Received: from 67.206.186.87 by rms-us006 with HTTP Content-Type: text/plain; charset="utf-8" Date: Thu, 13 Dec 2012 17:11:44 -0500 From: "Dieter BSD" Message-ID: <20121213221145.310760@gmx.com> MIME-Version: 1.0 Subject: NetBSD's boot select MBR To: freebsd-hackers@freebsd.org X-Authenticated: #74169980 X-Flags: 0001 X-Mailer: GMX.com Web Mailer x-registered: 0 Content-Transfer-Encoding: 8bit X-GMX-UID: 9je4cAAY3zOlNR3dAHAhKHR+IGRvb8A7 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 22:11:55 -0000 [ from the FreeBSD for serious performance? thread ] > > So I use NetBSD's MBR for disks I want > > to boot from. > > Can I have a CMD sequence? > > First would be ... > # fetch ... Read NetBSD's fdisk(8) and mbr(8). The MBR is only 512 bytes, and must contain the code and data. This is very limiting, so there are multiple versions depending on which features you need. IIRC, /usr/mdec/mbr_bootsel is the one I use. You can specify a label (up to 7 characters) for each bootable partition ("slice" in FreeBSD-speak). When the system executes the MBR code, it presents a menu with these labels. You can type '1' for the first partition/slice, '2' for the second, and so on. You can also type a function key to run the MBR of a different disk. The disk numbering can be rather insane, so it must be using the bios disk numbering. If you don't type anything it times out and boots the active partition/slice. Sadly, the FreeBSD bootstrap insists on booting the partition/slice marked active in the MBR. (The MBR code should look at the active bit, the later bootstraps should not.) So if you want to have multiple FreeBSD versions, it works best to put each on its own disk. The last time I used fdisk, large disks triggered a bug where some variable overflowed, giving negative numbers. Hopefully this is fixed by now. FreeBSD's fdisk also had some bug, so I had great fun handcrafting a MBR. It's been a long time since I installed NetBSD from scratch, (I usually just unpack the tar files, run installboot, and edit some config files.) I assume you can just boot a CD and get a shell, and experiment with fdisk on a scratch disk without actually installing NetBSD. To avoid a disaster, do something like dd if=$DISK of=/boot/MBR_backup bs=512 count=1 ; sync beforehand, in case you accidently mess up your boot drive. man pages: http://netbsd.gw.com/cgi-bin/man-cgi?++NetBSD-current isos: http://www.netbsd.org/mirrors/ for example: ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/amd64cd-5.2.iso or ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/i386cd-5.2.iso