Subject: kern/29838: Cannot newfs vnd(4) sparse files
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <juan@xtraeme.nopcode.org>
List: netbsd-bugs
Date: 03/30/2005 16:41:00
>Number:         29838
>Category:       kern
>Synopsis:       Cannot newfs vnd(4) sparse files
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 30 16:41:00 +0000 2005
>Originator:     Juan RP
>Release:        NetBSD 3.99.1
>Organization:
>Environment:
System: NetBSD Mandylion 3.99.1 NetBSD 3.99.1 (GATEWAY_) #1: Wed Mar 23 06:34:57 CET 2005 juan@Nocturno:/home/juan/src-yamt-km/sys/arch/i386/compile/GATEWAY_ i386
Architecture: i386
Machine: i386
>Description:

	When trying to use NetBSD/Xen with vnd(4) files,
	cannot use newfs(8) on sparse files created with dd(1):

[juan@Nocturno][~]> dd if=/dev/zero of=sparse.img count=1 seek=2097152
1+0 records in
1+0 records out
512 bytes transferred in 0.001 secs (512000 bytes/sec)
[juan@Nocturno][~]> sudo vnconfig vnd0 sparse.img                     
[juan@Nocturno][~]> sudo newfs /dev/vnd0a                             
/dev/vnd0a: 1024.0MB (2097152 sectors) block size 16384, fragment size 2048
        using 6 cylinder groups of 170.67MB, 10923 blks, 21504 inodes.
wtfs: write error for sector 160: Input/output error
[juan@Nocturno][~]>

	When not using seek, it works:

[juan@Nocturno][~]> dd if=/dev/zero of=mydisk.img count=1m bs=1024
1048576+0 records in
1048576+0 records out
1073741824 bytes transferred in 24.852 secs (43205449 bytes/sec)
[juan@Nocturno][~]> sudo vnconfig vnd0 mydisk.img 
[juan@Nocturno][~]> sudo newfs /dev/vnd0a
/dev/vnd0a: 1024.0MB (2097152 sectors) block size 16384, fragment size 2048
        using 6 cylinder groups of 170.67MB, 10923 blks, 21504 inodes.
super-block backups (for fsck -b #) at:
      32,  349568,  699104, 1048640, 1398176, 1747712,
[juan@Nocturno][~]>

>How-To-Repeat:
>Fix: