Ticket #13 (assigned enhancement)

Opened 2 years ago

Last modified 10 months ago

Writing to DVD media

Reported by: scdbackup@… Owned by: scdbackup
Priority: major Milestone: 0.3.2
Component: libburn Version: TRUNK
Keywords: Cc:

Description

CD are at the edge of obsolescence. At least for backup. Most of mine go to DVD meanwhile (using growisofs).

Currently i am not aware of a library that allows to write DVD+R, DVD-R or DVD-RW.

DVD-RAM is usable as block device since kernel 2.2

DVD+RW seems to work fine as block device with kernel 2.6

DVD-RW might work too, but for me and my burner the write experiments did not yield a verificable result.

At the horizon there is BD-RE: 25 GB or 50 GB Blu-Ray media.

Change History

  Changed 2 years ago by pygi

  • version set to BRANCH

  Changed 2 years ago by lorenzo

Partial DVD writing support seems to be implemented in libburn by accident. After using growisofs to zero out a DVD+RW, I used cdrskin to burn an image onto the DVD. The md5sum of /dev/hdc does not match the image, but the image is actually there and all files are readable and contain the correct data.

I first tried to burn the image before blanking the dvd and found that the data was unusable.

So cdrskin and libburn may be able to burn an image onto a blank DVD, but it will not correctly correctly overwrite a DVD+RW. I found my level of success at this point to be very surprising, since I didn't think that libburn could write DVD's in any way. I will post any further findings here, and encourage other people, especially those using 2.4 kernels to test this functionality.

  Changed 2 years ago by scdbackup

  • owner changed from somebody to scdbackup
  • version changed from BRANCH to TRUNK
  • milestone set to 0.2.8

Lorenzo's summerly DVD+RW adventure is indeed surprising as it seems that 32 kB output blocking is mandatory. libburn on Linux used to send 31 sectors with each MMC WRITE command.

On the other hand DVD+RW burning seems to be designed to be as easy as possible. More easy even than CD TAO. Most problems i have with my newest developments are with libburn entrails and not with the couple of burner and DVD+RW media.

That's why i now accept this ticket. I began to study dvd+rw-tools-7.0 in conjunction with mmc5r03c.pdf to learn about DVD writing. The DVD+RW profile is the trailblazer for others to come. But expect a while of +RW only until i deem libburn and cdrskin ready for DVD at all. (Collect donations for some spindles of write-once media when the time has come.)

To enable DVD+RW as something like a blank supersized CD-RW you need to edit file libburn/mmc.c and uncomment

/*
#define Libburn_support_dvd_plus_rW 1
*/

then run "make" again. DVD+RW in any formatting state should get accepted and take ~ 4.7e9 bytes of data. I ran backups and the media did verify by output MD5 matching input MD5.

  Changed 2 years ago by scdbackup

  • status changed from new to assigned

The #define described in the last message is not needed any more. DVD+RW are now enabled in vanilla libburn-0.2.7 (revision 538).

I explored multi-session possibilities. Now i understand why growisofs is so much tangled with mkisofs and the ISO-9660 format.

DVD+RW is unsuitable for multi-session because mount has few chance to find the superblock of the most recent mkisofs output. With CD this superblock is found by looking up in TOC the start address of the most recent session. No TOC on DVD+RW. It is just a byte string (with block alignment needs).

growisofs can nevertheless do the trick by changing the beginning of the first session to point to the most recent mkisofs output (which then points back into the merged older mkisofs output areas). The necessary parameters for mkisofs -C are possibly gained from the content of the superblock and/or the most recent mkisofs session (i guess).

All in all this is outside the scope of libburn but rather looks like a job for the application or for libisofs (i.e. to find out a suitable target address in the random access byte string of the storage and to issue a patch for the superblock and/or the filesystem start at the beginning of the byte string).

libburn can only support "multi-session" on DVD+RW by offering an API call to position the start of writing to a particular address on media. This can be used to append mkisofs sessions and to overwrite the start of the byte string with a new superblock and filesystem start. Without new start content one has to help command mount(8) to find the most recent mkisofs session:

x=100000
mkisofs -C 0,"$x" ... | \
cdrskin dev=/dev/sr0 -v fs=32m -eject speed=4 write_start_address="$x"s -

mount -t iso9660 -o ro,sbsector="$x" /dev/sr0 /mnt

Due to the provident solicitude of my kernel, i can only use this trick up to 660 MB. Let me hope you all have more luck with your shiny new 2.6 kernels:

/usr/src/linux-2.4.21-215/fs/isofs/inode.c:

else if (!strcmp(this_char,"sbsector") && value) {
[...]
         if(ivalue < 0 || ivalue >660*512) return 0;

(It lasted several hours before i found out why x=100000 works and x=524288 did not. Riddle. Idea. Experiments. Google. view /usr/src/... )

  Changed 2 years ago by scdbackup

By revision 573 there is +RW-like support for DVD-RW.

They need to get formatted to "Restricted Overwrite" first. E.g by

cdrskin -v dev=/dev/sr0 blank=format_overwrite

or

dvd+rw-format -force /dev/sr0

From then on they should be usable until they get blanked them by cdrecord or dvd+rw-format -blank (thus entering state "Sequential Recording").

  Changed 2 years ago by scdbackup

Revision 609 brought write support for DVD-RAM. Just for completeness and for a unified programming interface. DVD-RAM is not really desirable.

My drives show miserable performance. With dd, with growisofs, with cdrskin. About half the throughput as stated on the media labels (2x and 3x).

  Changed 2 years ago by pygi

  • milestone changed from 0.2.8 to 0.3

Milestone 0.2.8 deleted

  Changed 2 years ago by scdbackup

It turned out that DVD-R and sequential DVD-RW are capable of multi-session like CD-R and CD-RW. Only restriction is that no -audio tracks are allowed.

This is now implemented as pseudo TAO writing for these types. Available if the according feature 21h "Incremental Streaming Writeable" is announced by the drive. (dvd+rw-format -blank on my drives produces DVD-RW without 21h)

The other applicable MMC feature 2Fh "DVD-R/-RW Write" is not implemented yet. It is less attractive than 21h except that growisofs uses it with its option -dvd-compat. So libburn will strive for supporting it as pseudo SAO resp. in case feature 21h is not available. Different from CD SAO, only one track will be allowed.

Testers are needed who burn multi-session DVD-R. I could not get myself yet to wasting the blank media which i have for drive test purposes. So all my burn tests are done with DVD-RW.

  Changed 2 years ago by scdbackup

Since this ticket becomes quite technical about MMC, i post this link to our cookbook where the currently implemented burn strategies are sketched together with pointers to the details in MMC-5 specs :

http://libburnia.pykix.org/browser/libburn/trunk/doc/cookbook.txt?format=txt

follow-up: ↓ 11   Changed 2 years ago by scdbackup

DVD+R have been enabled and halfways tested.

DVD+R/DL or DVD-R/DL might work via the code for DVD+-R. They are yet considered unsuitable unless burn_allow_untested_profiles() is called with yes==1.

in reply to: ↑ 10   Changed 11 months ago by nightmorph

Replying to scdbackup:

DVD+R have been enabled and halfways tested. DVD+R/DL or DVD-R/DL might work via the code for DVD+-R. They are yet considered unsuitable unless burn_allow_untested_profiles() is called with yes==1.

I actually tried this the other day. As I reported to Mario, dual-layer DVDs work just fine, once you disable the unsupported media code (or just use the cdrskin CLI option). I used a DVD+R DL disc, 7.6GB iso, and it worked perfectly. Wrote at the full speed of the media, too (2.4x). :)

follow-up: ↓ 13   Changed 10 months ago by scdbackup

That's great news.

If possible please do a thorough read of the resulting media and check for any read or addressing errors.

E.g.:

tar cf - /media/dvd | wc

If this runs without error complaints then i can officially enable DVD+R DL. (DVD-R DL is a completely different game. They would need an extra testing.)

Thanks a lot for the courage and generosity of testing.

(My USB burner is not very capable and my wallet is not filled well enough. So i left all risk and cost to the users. Seems to be a good strategy :))

in reply to: ↑ 12   Changed 10 months ago by nightmorph

Replying to scdbackup:

If possible please do a thorough read of the resulting media and check for any read or addressing errors. E.g.: {{{ tar cf - /media/dvd | wc }}} If this runs without error complaints then i can officially enable DVD+R DL. (DVD-R DL is a completely different game. They would need an extra testing.)

Output is as follows:

$ tar cf - /media/dvdrw | wc
tar: Removing leading `/' from member names
      0       3   10240

This what you wanted? I should mention that the disc is readable & playable by all four of my DVD players, both standalone and my laptop/workstation's drives. Every chapter & feature plays correctly too; no errors or freezes.

follow-up: ↓ 15   Changed 10 months ago by scdbackup

This looks like /media/dvdrw is a softlink and not the real mountpoint

     0       3   10240

It only produced a minimum size tar archive stream.

Try

tar cf - /media/dvdrw/* | wc

which should yield several GB of data after a due time of busy silent reading. Any message before the final count numbers would be suspicious.

in reply to: ↑ 14   Changed 10 months ago by nightmorph

Replying to scdbackup:

Try {{{ tar cf - /media/dvdrw/* | wc }}} which should yield several GB of data after a due time of busy silent reading. Any message before the final count numbers would be suspicious.

Well, once I mounted the disc and re-ran the command, I get a lot of this in the output. I finally killed the command after several seconds, but here's a sample of what was filling up the terminal buffer:

wc: standard input:5316: Invalid or incomplete multibyte or wide character
wc: standard input:5317: Invalid or incomplete multibyte or wide character
wc: standard input:5318: Invalid or incomplete multibyte or wide character
wc: standard input:5319: Invalid or incomplete multibyte or wide character
wc: standard input:5320: Invalid or incomplete multibyte or wide character
wc: standard input:5322: Invalid or incomplete multibyte or wide character
wc: standard input:5323: Invalid or incomplete multibyte or wide character
wc: standard input:5324: Invalid or incomplete multibyte or wide character
wc: standard input:5325: Invalid or incomplete multibyte or wide character
wc: standard input:5326: Invalid or incomplete multibyte or wide character
wc: standard input:5327: Invalid or incomplete multibyte or wide character
wc: standard input:5328: Invalid or incomplete multibyte or wide character
wc: standard input:5329: Invalid or incomplete multibyte or wide character
wc: standard input:5330: Invalid or incomplete multibyte or wide character

. . . . still not what you're looking for? :)

follow-up: ↓ 17   Changed 10 months ago by scdbackup

Curses on i18n and l10n !

At least it confesses that it is a problem with wc and not with the media. And at least we get some data from the mount point now.

Read errors would look like this.

tar: /media/dvdrw/blocklist_dir/cd_1_2_A71208.095511_668925952: Read error at byte 0, reading 2048 bytes: Input/output error

This message was provoked by writing to a DVD+RW and not ejecting it before mount. That way my SuSE 10.2 can simulate faulty media at my will.

The following message is ok

tar: Removing leading `/' from member names

My SuSE wc does not complain about multi-byte-characters. Maybe this is a consequence that my computer believes to be an american computer.

$ echo $LANG
en_US

If you can afford to copy the whole DVD to /tmp on hard disk then try this

tar cf - /media/dvdrw/* >/tmp/dvd_plus_rw_copy

and watch that file growing.

Else try dd instead of wc

$ tar cf - /media/dvdrw/* | dd bs=10240 of=/dev/null
tar: Removing leading `/' from member names
89380+0 records in
89380+0 records out
915251200 bytes (915 MB) copied, 596.879 s, 1.5 MB/s

This is the same DVD+RW media with about 40,000 files. Thus the poor reading performance.

in reply to: ↑ 16   Changed 10 months ago by nightmorph

Replying to scdbackup: Yeah, I run an en_US.utf-8 Unicode system by necessity. SuSE must be broken. :p

Anyway, the tar command completed perfectly. Got a nice clean 7.5GB tar archive in /tmp with no errors during the creation. I'd say DVD+r DL works. :)

  Changed 10 months ago by scdbackup

Ok. I will enable DVD+R DL for general use.

Thanks again for testing.

Note: See TracTickets for help on using tickets.