udftools icon indicating copy to clipboard operation
udftools copied to clipboard

Instructions for write-once media

Open callegar opened this issue 4 years ago • 14 comments

Howto mentions the possibility of using packet writing on write once media (CD/DVD +R or -R). However, it is unclear how this should be done:

  • is the dvd+rw-format command used? How? The --force option seems incorrect being meant to wipe, which does not seem to make sense on this media. Furthermore, the tool webpage states that only "RW" media needs to be formatted.

  • is the growisofs -Z /dev/hdc=/dev/zero needed? Seems strange, as pre-writing an image on a write-once media would make it unusable for any further recording.

Without these two commands, mkudffs --media-type dvdr /dev/pktcdvd0 returns mkudffs: Error: Cannot create new image file '/dev/pktcdvd0': block-count was not specified

callegar avatar Dec 13 '19 11:12 callegar

Without these two commands, mkudffs --media-type dvdr /dev/pktcdvd0 returns mkudffs: Error: Cannot create new image file '/dev/pktcdvd0': block-count was not specified

This looks like /dev/pktcdvd0 does not exist...

pali avatar Dec 13 '19 11:12 pali

Also, you cannot write to (or modify) read-only media by their definition.

pali avatar Dec 13 '19 11:12 pali

Also note that CD-R, DVD+R, DVD-R and BD-R are write-once media (R means recordable). CD-ROM, DVD-ROM and BD-ROM are read-only media which are not possible to modify in any way.

pali avatar Dec 13 '19 11:12 pali

Indeed, I was mentioning write-once (DVD+R in my case). Also, I have just noticed that I had a (probably stale) /dev/pktcdvd0 file, while the real entry is /dev/pktcdvd/pktcdvd0. With this, and mkudffs --media-type dvdr /dev/pktcdvd/pktcdvd0 the disk spins but I get mkudffs: Error: Cannot open device '/dev/pktcdvd/pktcdvd0': Input/output error

callegar avatar Dec 13 '19 12:12 callegar

Looking into pktcdvd.ko source code and it looks like that packet writing it possible only for CD-RW, DVD+RW, DVD-RW and DVD-RAM medias, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/block/pktcdvd.c?h=v5.4#n1768

So I think you cannot use standard write() syscall on DVD+R media via pktcdvd.

Last time I tested scenario: created cdr and dvdr images by mkudffs and then burned them to real cdr and dvdr discs via wodim and it worked. Burning process does not use write() syscall but rather ioctl(), so pktcdvd layer does not used.

pali avatar Dec 13 '19 13:12 pali

I guess that this was expected to work at some time (possibly long ago) because the udftools howto explicitly says: Packet writing is possible both with write-once media (CD-R, DVD+R, DVD-R) and rewritable media (CD-RW, DVD+RW, DVD-RW). Obviously, with write-once media the free space on the filesystem will not increase if you delete files.

callegar avatar Dec 13 '19 16:12 callegar

I looked at code and there was no support for CD-R directly in kernel/VFS. You always had to use some burner/packetwriting SW in userspace to write new data to CD-R disc. udftools has wrudf utility which has some limited support for packet writing also for CD-R (and maybe also for DVD+-R). So that howto probably refers to wrudf, not in-kernel support. Kernel had and has only support for -RW and -RAM media.

pali avatar Jan 20 '20 13:01 pali

Thanks. I had a look at wrudf. My question is how to "prepare" the initial udf filesystem for the medium, since it does not seem to have a command for that.

callegar avatar Jan 21 '20 08:01 callegar

wrudf is mostly in unmaintained state, so expect problems. You would have to figure out if it works and how. If you need empty CD-R UDF image, you can create it by mkudffs (it has option -m cdr) and then burn via some burning application (use packet writing and do close media).

pali avatar Jan 21 '20 09:01 pali

Another option for preparing initial filesystem is via genisoimage, but IIRC it supports only UDF 1.02.

pali avatar Oct 22 '20 14:10 pali

what about VAT suport

Cuteistfox avatar Jun 17 '23 15:06 Cuteistfox

VAT is what is used for UDF write-once media.

pali avatar Jun 17 '23 20:06 pali

well it is udftools

Cuteistfox avatar Jun 17 '23 20:06 Cuteistfox

I do not understand for what you are asking. VAT is used for UDF write-once media. So if you create image for CD-R, DVD-R or BD-R media via mkudffs then mkudffs automatically create VAT in these images.

pali avatar Jun 17 '23 20:06 pali