Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Aug 1999 16:19:52 +0200
From:      Poul-Henning Kamp <phk@freebsd.org>
To:        current@freebsd.org
Subject:   junior-hacker task:  "prepdisk"
Message-ID:  <19808.933517192@critter.freebsd.dk>

next in thread | raw e-mail | index | archive | help

It seems that our new boot blocks doesn't like the taste of disks
prepared according to the meagre information we have in the handbook.

The following script seems to DTRT for me, and should really be
either integrated into a "fdisk -A" flag or maybe as a stand alone
script.  Either way: manpage & handbook needs updated too.

It will not make it to the top of my todo list in this geological
period, so if somebody wants to pick up here I think a lot of people
will come to appreciate it...

Poul-Henning


#!/bin/sh

dev=fla0

grep "$dev.*sectors" /var/run/dmesg | tr -d '(:)' | awk '
	{
	v = $3
	c = $5
	h = $7
	s = $9
	ss = c * h * s - s

	print "#",$0 > "_"
	print "g c"c" h"h" s"s > "_"
	print "p 1 165",s,ss > "_"
	print "a 1" > "_"

	print "#",$0  > "__"
	print "type: ESDI" > "__"
	print "disk:", $1 > "__"
	print "label:" > "__"
	print "flags:" > "__"
	print "bytes/sector: 512" > "__"
	print "sectors/track:", s > "__"
	print "tracks/cylinder:", h > "__"
	print "sectors/cylinder:", s * h > "__"
	print "cylinders:", c > "__"
	print "sectors/unit:", ss > "__"
	print "rpm: 3600" > "__"
	print "interleave: 1" > "__"
	print "trackskew: 0" > "__"
	print "cylinderskew: 0" > "__"
	print "headswitch: 0           # milliseconds" > "__"
	print "track-to-track seek: 0  # milliseconds" > "__"
	print "drivedata: 0 " > "__"
	print "8 partitions:" > "__"
	print "#        size   offset    fstype   [fsize bsize bps/cpg]" > "__"
	print "a:",ss,"0 4.2BSD 512 4096 " > "__"
	print "c:",ss,"0 unused 0 0" > "__"
	}
' 
fdisk -f _ -i -v $dev
disklabel -BrR ${dev} __
newfs /dev/r${dev}a

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19808.933517192>