Bug 119386

Summary: bsdlabel and newfs on DVD-RAM (handbook ch. 18.7.9)
Product: Documentation Reporter: Martin Laabs <martin.laabs>
Component: Books & ArticlesAssignee: Marc Fonvieille <blackend>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Martin Laabs 2008-01-06 15:40:01 UTC
In chapter 18.7.9 of the handbook (Using a DVD-RAM) is a description how to use/prepare a DVD-RAM so that it can be used with freebsd. Therefore you have to use bsdlabel and newfs.
Since the blocksize of an DVD-RAM ist 2048 byte and bsdlabel and newfs (also with the -s 2048 option) do at least one write with blocksize smaller than 2048 byte both commands fails.

How-To-Repeat: For example the first command, which is "dd if=/dev/zero of=/dev/acd0 count=2", produces the following output on my system (Optiarc DVD RW AD-7170A/1.02 device)

su:~$ dd if=/dev/zero of=/dev/acd0 count=2
dd: /dev/acd0: Invalid argument
1+0 records in
0+0 records out
0 bytes transferred in 0.000138 secs (0 bytes/sec)

If I add the bs=2k option it works fine:

su:~$ dd if=/dev/zero of=/dev/acd0 count=1 bs=2k
1+0 records in
1+0 records out
2048 bytes transferred in 0.001740 secs (1177026 bytes/sec)
Comment 1 Marc Fonvieille freebsd_committer freebsd_triage 2008-01-06 19:17:55 UTC
On Sun, Jan 06, 2008 at 03:36:45PM +0000, Martin Laabs wrote:
> 
> >Description:
> In chapter 18.7.9 of the handbook (Using a DVD-RAM) is a description how to use/prepare a DVD-RAM so that it can be used with freebsd. Therefore you have to use bsdlabel and newfs.
> Since the blocksize of an DVD-RAM ist 2048 byte and bsdlabel and newfs (also with the -s 2048 option) do at least one write with blocksize smaller than 2048 byte both commands fails.
> 
> >How-To-Repeat:
> For example the first command, which is "dd if=/dev/zero of=/dev/acd0 count=2", produces the following output on my system (Optiarc DVD RW AD-7170A/1.02 device)
> 
> su:~$ dd if=/dev/zero of=/dev/acd0 count=2
> dd: /dev/acd0: Invalid argument
> 1+0 records in
> 0+0 records out
> 0 bytes transferred in 0.000138 secs (0 bytes/sec)
> 
> If I add the bs=2k option it works fine:
> 
> su:~$ dd if=/dev/zero of=/dev/acd0 count=1 bs=2k
> 1+0 records in
> 1+0 records out
> 2048 bytes transferred in 0.001740 secs (1177026 bytes/sec)

So:

# dd if=/dev/zero of=/dev/acd0 bs=2k count=1
# bsdlabel -Bw acd0
# newfs /dev/acd0

is enough? (I can't test, I don't have any DVD-RAM writer under the
hand)

-- 
Marc
Comment 2 Marc Fonvieille freebsd_committer freebsd_triage 2008-01-06 19:55:12 UTC
Responsible Changed
From-To: freebsd-doc->blackend

I'll handle it.
Comment 3 Marc Fonvieille freebsd_committer freebsd_triage 2008-01-06 20:36:09 UTC
On Sun, Jan 06, 2008 at 09:01:10PM +0100, Martin Laabs wrote:
> Hi,
> 
>> So:
>> 
>> # dd if=/dev/zero of=/dev/acd0 bs=2k count=1
>> # bsdlabel -Bw acd0
>> # newfs /dev/acd0
>> 
>> is enough? (I can't test, I don't have any DVD-RAM writer under the
>> hand)
> 
> No. Unfortunately all the instruction work with blocksizes of 512 byte.
> But access with that blocksize create an input/output error of the DVD
> devices. (In general this isn't  conspicuous because you use burncd or
> cdrecord to write to all dvd recorable disks expect the DVD-RAM ...)
> 
> I found a way to create disklabels with a protofile the following way:
> 
> # bsdlabel -R /dev/acd0 disklabels
> 
> while the file "disklabels" contains:
> 
> ----------:<----------
> 3 partitions:
> #        size   offset  fstype  [fsize bsize bps/cpg]
> a:      4360M   16      4.2BSD  2048 16384 8
> b:      16      *       unused  0    0
> c:      *       *       unused  0    0         # "raw" part, don't edit
> ----------:<----------
> 
> The newfs util seems to have a bug because it does not pay
> attention to the -S parameter in respect to the minimum blocksize
> while writing the superblocks:
> 
> # newfs -S2048 /dev/acd0a
> /dev/acd0a: 4.0MB (8192 sectors) block size 16384, fragment size 2048
>         using 4 cylinder groups of 1.02MB, 65 blks, 192 inodes.
> super-block backups (for fsck -b #) at:
> newfs: wtfs: 65536 bytes at sector 160: Input/output error
> 
> 
> I don't know who to bother with that problem. I don't have
> the time to search and repair the bug (although I think I
> found the line in mkfs.c). But because I'm not
> absolute sure that this is a bug I don't want to write another
> bug report now.
>

Well, I have no clue regarding this issue.  The current instruction set
has been submitted by a DVD-RAM user, so it works at least for him,
could you try, if possible, with another DVD-RAM writer?

-- 
Marc
Comment 4 Marc Fonvieille freebsd_committer freebsd_triage 2010-08-10 08:57:15 UTC
State Changed
From-To: open->feedback

Any news about this problem?
Comment 5 Marc Fonvieille freebsd_committer freebsd_triage 2010-08-12 08:46:16 UTC
State Changed
From-To: feedback->closed

The author reported that under 8.X the Handbook instructions work as 
expected, so let's close the PR.