Subject: Re: Create a virtualdisk.
To: Micke A <knorpen@gmail.com>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: port-xen
Date: 01/21/2007 12:29:22
On Sun, 21 Jan 2007 11:35:22 +0000
"Micke A" <knorpen@gmail.com> wrote:

> Hi
> 
> I'm try to install NetBSD in a NetBSD domain0, I have problems with
> the "virutal disk". I have create the virutal file with dd. But I'cant
> formate it.
> 
> Any one here who have ha tutorial/howto how to make virtualdisks under
> NetBSD. I have tried in FreeBSD 6.0 with no problem, I can formate it
> ( newfs diskFile.img ) and mount it ( mdconfig -a -f diskFile.img ;
> mount /dev/md0 /mnt ).
> 
> But I cant make this work in NetBSD, I'm using NetBSD 3.1, with xen
> 2.0 (I'm using Xen 2.0 because I haved problems with the 3.0.3
> release, int hangs then i boots)..
> 
Here's a transcript of me creating and destroying a fake disk:

# dd if=/dev/zero of=fakedisk.vnd bs=65536 count=1024
1024+0 records in
1024+0 records out
67108864 bytes transferred in 1.299 secs (51661943 bytes/sec)
# vnconfig -c vnd0 fakedisk.vnd
# newfs vnd0a
/dev/rvnd0a: 64.0MB (131072 sectors) block size 8192, fragment size 1024
        using 4 cylinder groups of 16.00MB, 2048 blks, 3968 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 32800, 65568, 98336,
# mount /dev/vnd0a /mnt
# ls /mnt
# df
Filesystem  1024-blocks      Used     Avail Capacity  Mounted on
/dev/wd0a      73968080  33857598  36412078    48%    /
ptyfs                 1         1         0   100%    /dev/pts
tmpfs             65536      1936     63600     2%    /tmp
kernfs                1         1         0   100%    /kern
procfs                4         4         0   100%    /proc
procfs                4         4         0
100%    /usr/pkg/emul/linux/proc /dev/vnd0a        63471         1
60297     0%    /mnt # umount /mnt
# vnconfig -u vnd0
# rm fakedisk.vnd 

I did this on -current, but as far as I know it works on any
supported version of NetBSD.  I've used such vnd disks with
Xen, too.