Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Oct 1996 18:12:06 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, jkh@time.cdrom.com
Cc:        FreeBSD-hackers@FreeBSD.org, guido@gvr.win.tue.nl, phk@critter.tfs.com
Subject:   Re: disklabeling a vn device
Message-ID:  <199610010812.SAA19057@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> See /usr/src/release/doFS.sh for how to do it.  Gak!  NOT.  It edits
>
>Nobody will be offended if you feel compelled to change any of that

I'm trying to teach how simple it is so that I don't have to do the
work :-).

>script for the better.  However, the picture is still not quite so
>rosy as you paint it:
>
>> 	dd if=/dev/zero of=vnfile bs=1024k count=4
>> 	vnconfig -c -s labels /dev/rvn0 vnfile
>
>This spews:
>
>	vn0: invalid primary partition table: no magic
>
>Rather annoyingly on the console and can be fixed as Poul-Henning has
>done in doFS.sh by doing instead:
>
> 	dd if=/dev/zero of=vnfile bs=1024k count=4
>	awk 'BEGIN {printf "%c%c", 85, 170}' | \
>		dd of=vnfile obs=1 seek=510 conv=notrunc 2>/dev/null

A warning only.  Look the other way (don't look at /dev/console or
the logs and don't login as root, use su :-).

> 	vnconfig -c -s labels /dev/rvn0 vnfile
>
>And:
>	
>> 	disklabel /dev/rvn0 | disklabel -R -r vn0 /dev/stdin
>
>Produces:
>	disklabel: /dev/rvn0c: Undefined error: 0

This happens because read() on the empty file /dev/rvn0c returns 0
and disklabel handles this non-error bogusly.

I'm not sure exactly why /dev/rvn0c is empty.  Writing the magic number
without changing the slice table gives 4 empty slices /dev/rvn0s[1-4]c.
One of them apparently became the compatibility slice although it doesn't
have type 0xa5.

To avoid this problem, you have to create a valid BSD slice of the
correct size or the special invalid slice table that says that the
disk is "dedicated".  Copies of the special table are kept in
bootstraps.  The simplest way to put one on `vnfile' is:

	dd if=/usr/mdec/boot1 of=vnfile conv=notrunc

It should also be possible to use `fdisk -i vnfile', but device
independence of fdisk is currently broken - it mungs the pathname.

Bruce



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