Subject: Re: Create a swap drive
To: None <port-i386@NetBSD.org>
From: Daniel Carosone <dan@geek.com.au>
List: port-i386
Date: 06/26/2006 16:59:50
--S7pq8suDAU0LBjBQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 26, 2006 at 03:27:50PM +0900, Henry Nelson wrote:
> I thought installboot made a disk bootable, but after switching disks, I
> found out that the disk was not bootable.  Somehow I got it bootable with
> three interactive sessions of fdisk, using the install disk:
>   fdisk -i wd0
>   fdisk -0 -c /usr/mdec/mbr -u wd0
>   fdisk -a wd0
>=20
> My questions are, what is the correct order of invoking these commands to
> get a bootable, partitioned hard disk that has been zeroed?  Should it be
> the opposite of what I did, i.e., fdisk first, installboot second, and
> finally disklabel?=20

Assuming you're starting with a new, blank disk (say, to restore your
backup onto), and also assuming i386 for this list:

fdisk deals with BIOS/MBR partitions and boot sectors.  Do this first,
including the "fdisk -i" that installs the MBR bootcode or
bootselector (first stage boot), usually at the start of the disk, and
the -a that marks the correct partition active.=20

disklabel deals with NetBSD partitions (sometimes aka slices).  Do
this next, from a backup if you have one and if the disk is the same
size, otherwise adjust sizes as desired.

NetBSD partitions are for filesystems, do those next, including newfs
and mounting and restoring data into them.

installboot is for the NetBSD bootloader (the one that gives you the 5
second countdown and > prompt that you use for eg "boot -s").  This is
in two parts, and needs a filesystem to install into and to load /boot
(the second stage) and kernels and so forth from.  Do this last, after
you have restored your data.  You don't want to overwrite a
freshly-installed /boot with the restore, nor to create inodes in the
filesystem before running restore -x.  Also, sometimes you might want
to install the bootloader that was previously on the machine's
/usr/mdec as backed up, rather than the one which happened to be on
whatever media/system you booted to do the restore with.

--
Dan.

--S7pq8suDAU0LBjBQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)

iD8DBQFEn4XmEAVxvV4N66cRAgqrAKCGKvOJUXnV/KH+KHQtkxxnSt2tcACgisJH
PMpOJOiBISdReNIyhaKepVM=
=zAE5
-----END PGP SIGNATURE-----

--S7pq8suDAU0LBjBQ--