Subject: Re: File system image
To: Brian Rose <saider@gate.net>
From: Michael Kukat <michael@bsdfans.org>
List: netbsd-users
Date: 02/07/2003 19:13:38
Hello,

On Fri, 7 Feb 2003, Brian Rose wrote:
> I tried using virtual devices, but you cannot disklabel a virtual
> device. And without a disklabel, you can't put a filesystem on an image
> using newfs. So how do I create a memdrive with a proper disklabel so
> that I can put a filesystem on it and boot from it? I've been looking
> all over trying various combinations of mdconfig, vnconfig, disklabel,
> fdisk, and other commands to try and force a disk label onto a memdrive
> or a virtual device.

It works with virtualk devices. Try this:

(assuming a virtual disk with 512 bytes blocksize, 64 sectors, 32 heads, 16
tracks = 16 MB)

[root@calchas tmp]# dd if=/dev/zero bs=512 count=$((64*32*16)) of=vdisk.img
[root@calchas tmp]# vnconfig vnd0 `pwd`/vdisk.img 512/64/32/16
[root@calchas tmp]# disklabel -eI vnd0
(edit your disklabel like you want it)
[root@calchas tmp]# newfs vnd0a
[root@calchas tmp]# mount /dev/vnd0a /mnt
(copy your files)
[root@calchas tmp]# umount /mnt
[root@calchas tmp]# vnconfig -u vnd0

Now, mdsetimage should work. Never tried this last step, but above, you just
have the directions how to make the filesystem in an any-sized virtual disk.
Looking at the values, just change the "16" in dd and in vnconfig to the value
in megs you want to use.

For more information, look at vnd(4) and vnconfig(8).

...Michael

-- 
http://www.unixiron.org/    Home Powered by: (Net|Open|Free)BSD IRIX NonStop-UX
Solaris AIX HP-UX Tru64 MUNIX Ultrix VMS SINIX Dolphin_Unix OpenStep MacOS A/UX