Subject: vnd filesystem on MSDOS drive
To: None <netbsd-help@NetBSD.ORG>
From: Brian C. Grayson <bgrayson@ece.utexas.edu>
List: netbsd-help
Date: 07/17/1997 09:49:03
  Background:  i386 1.2D kernel, late-March userland.

  I have 100MB free on an MSDOS IDE drive, and wanted to create
an FFS filesystem using that space without repartitioning
the hard drive.  I figured vnd's were the way to go.  IF I create
a test 4mb file on an FFS filesystem, and use vnconfig and newfs to
populate the file with an FFS filesystem, I can mount it:


9:31am 71# dd if=/dev/zero of=4mb bs=1048576 count=4
4+0 records in
4+0 records out
4194304 bytes transferred in 3 secs (1398101 bytes/sec)
9:31am 72# vnconfig /dev/rvnd0c 4mb
9:31am 73# newfs /dev/rvnd0c 4mbvnd
/dev/rvnd0c:    8192 sectors in 16 cylinders of 2 tracks, 256 sectors
        4.0MB in 1 cyl groups (16 c/g, 4.00MB/g, 1920 i/g)
super-block backups (for fsck -b #) at:
 32,
9:31am 74# mount /dev/vnd0c /mnt2
9:31am 75# touch /mnt2/foo
9:31am 76# ls /mnt2
foo
9:31am 77# df /mnt2
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/vnd0c       3827        0     3635     0%    /mnt2


  I then unmount and unvnconfig the vnd and move the 4mb
filesystem file to an MSDOS disk mounted via mount_msdos on /mnt:


9:31am 78# umount /mnt2
9:31am 79# vnconfig -u /dev/vnd0c
9:31am 80# cp 4mb /mnt
9:32am 81# vnconfig /dev/vnd0c /mnt/4mb
9:32am 82# mount /dev/vnd0c /mnt2
ffs: /dev/vnd0c on /mnt2: incorrect super block
9:37am 84# cksum 4mb /mnt/4mb
821252711 4194304 4mb
821252711 4194304 /mnt/4mb


  Why does mount complain about an incorrect superblock when
the file ``4mb'' hasn't been changed?  Does the underlying filesystem
have to be of type 4.2BSD to support a vnd filesystem of 4.2BSD
within a file on such a filesystem?  Or am I just doing
something stupid?  :)  Or do I need to upgrade to -current?

  I don't know if this helps, but I noticed that a cksum on the
4mb /dev/rvnd0c returns a different value than a cksum on the
/mnt/4mb /dev/rvnd0c:


9:45am 100# vnconfig /dev/vnd0c 4mb
9:45am 101# cksum /dev/rvnd0c
821252711 4194304 /dev/rvnd0c
9:45am 102# vnconfig -u /dev/vnd0c
9:45am 103# vnconfig /dev/vnd0c /mnt/4mb
9:45am 104# cksum /dev/rvnd0c
3321421245 4194304 /dev/rvnd0c


  My /etc/disktab entry for 4mbvnd is:
4mbvnd:\
        :ty=foobar:se#512:nt#2:ns#256:nc#16:\
        :pa#8192:oa#0:ba:4096:fa#512:ta=4.2BSD\
        :pb#8192:ob#0:bb:4096:fb#512:\
        :pc#8192:oc#0:bc:4096:fc#512:tc=4.2BSD\
        :pd#8192:od#0:bd:4096:fd#512:

  Thanks for any help!

  Brian
-- 
Brian Grayson (bgrayson@ece.utexas.edu)
Graduate Student, Electrical and Computer Engineering
The University of Texas at Austin
Office:  ENS 406       (512) 471-8011
Finger bgrayson@orac.ece.utexas.edu for PGP key.