From owner-freebsd-hackers Tue Oct 1 01:14:36 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id BAA05636 for hackers-outgoing; Tue, 1 Oct 1996 01:14:36 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id BAA05629 for ; Tue, 1 Oct 1996 01:14:29 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.7.6/8.6.9) id SAA19057; Tue, 1 Oct 1996 18:12:06 +1000 Date: Tue, 1 Oct 1996 18:12:06 +1000 From: Bruce Evans Message-Id: <199610010812.SAA19057@godzilla.zeta.org.au> To: bde@zeta.org.au, jkh@time.cdrom.com Subject: Re: disklabeling a vn device Cc: FreeBSD-hackers@FreeBSD.org, guido@gvr.win.tue.nl, phk@critter.tfs.com Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >> 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