Use awk to correctly calculate partioning, round things off to cylinders

and reserve first track etc.
This commit is contained in:
Poul-Henning Kamp 2005-01-30 13:12:13 +00:00
parent 41ee6cfca0
commit 9d736020c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=141053

View File

@ -56,14 +56,19 @@ CFGLABEL=`get_label ${CFGSLICE}`
dd if=/dev/zero of=${TMPFILE0} count=${SECTS}
MD=`mdconfig -a -t vnode -f ${TMPFILE0} -x ${SC} -y ${HD}`
rm -f ${TMPFILE0}
(
sl=`expr "(" ${SECTS} - ${SC} - ${DATASIZE} ")" / 2`
cyl=`expr ${SECTS} / ${SC} / ${HD}`
echo g c${cyl} h${HD} s${SC}
echo p 1 165 ${SC} $sl
echo p 2 165 `expr ${SC} + $sl` $sl
echo p 3 165 `expr ${SC} + $sl + $sl` ${DATASIZE}
) > ${TMPFILE1}
echo ${SECTS} ${SC} ${HD} ${DATASIZE} | awk '
{
cs = $2 * $3
cyl = $1 / cs
print "g c" cyl " h" $3 " s" $2
dsl = int (($4 + cs - 1) / cs)
csl = int ((cyl - dsl) / 2)
dsl = cyl - csl * 2
print "p 1 165 " $2, csl * cs - $2
print "p 2 165 " $2 + csl * cs, csl * cs - $2
print "p 3 165 " 2 * csl * cs, dsl * cs
}
' > ${TMPFILE1}
cat ${TMPFILE1}
fdisk -i -f ${TMPFILE1} ${MD}
fdisk ${MD}