Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Aug 1999 10:28:50 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        "Mark J. Taylor" <mtaylor@cybernet.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: newfs of a ccd failing?
Message-ID:  <199908251728.KAA11414@apollo.backplane.com>
References:   <XFMail.990825130114.mtaylor@cybernet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
:I've had this problem since at least FreeBSD 3.1-RELEASE (it works in
:2.2.7/2.2.8).  Same problem in 3.2-RELEASE and -current (as of last night).
:
:Can someone reproduce this error?  I can't believe that you can't newfs
:a ccd...  did I miss something?


:[snip]
:newfs /dev/rccd0c
:Warning: 16 sector(s) in last cylinder unallocated
:/dev/rccd0c:    204784 sectors in 50 cylinders of 1 tracks, 4096 sectors
:        100.0MB in 4 cyl groups (16 c/g, 32.00MB/g, 6272 i/g)
:super-block backups (for fsck -b #) at:
: 32, 65568, 131104, 196640
:newfs: ioctl (WDINFO): No such process
:newfs: /dev/rccd0c: can't rewrite disk label

    You have two problems.

    First, you are using a VN device for which you have enabled 
    labels.  The label is stored in the first few sectors of the
    VN's device.

    You have then created a CCD on top of the VN device and
    tried to create a label in it as well, using 'c' which
    starts at offset 0.

    The two label areas overlap.  Creating a real label under
    the ccd device will destroy the VN device's label.


    Problem #2:  the ccd device creates a 'garbage' label.  It
    does not create a real label.

    newfs tries to rewrite the real label, but since no label
    exists it gets an error.

    You can create a real label like this:

	disklabel ccd0 > /tmp/ccd0.label
	disklabel -R -r ccd0 /tmp/ccd0.label

    And then your newfs will not generate any errors.

    BUT, you've just destroyed the VN label by doing this.

    Ok, so how to fix?

    * Create a 'd' partition in the VN device which is offset
      by 16 sectors.  'disklabel -e vn0'

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  c:   204800        0    unused        0     0         # (Cyl.    0 - 99)
  d:   204784       16    4.2BSD        0     0     0   # (Cyl.    0*- 99*)

    * Configure the ccd on top of the vn device's 'd' partition.
    * Create a real label for the ccd
    * newfs your filesystem.

:
:I believe that there is a problem in/near ufs/ufs/ufs_disksubr.c where it
:says that it requires an existing disklabel before it writes a new one.
:If I change the "#if 1" to an "#if 0" in it, then I don't get this failure.

    It's probably safer for the system to generate an error if no
    preexisting label exists.  It is fairly easy to create a label.

    The CCD device is rather archaic and needs to be babied a bit when
    you use it on top of artificially constructed devices.  The real
    problem is that the CCD device requires a block device with an
    fstype of '4.2BSD'.  If we got rid of that requirement then you
    could run it on top of a 'raw' VN device (without -s labels).  If
    the ccd device didn't try to fake up its label then newfs would
    not attempt to rewrite it and thus would not complain.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908251728.KAA11414>