pali / udftools

Linux tools for UDF filesystems and DVD/CD-R(W) drives
GNU General Public License v2.0
108 stars 30 forks source link

Instructions for write-once media #37

Open callegar opened 4 years ago

callegar commented 4 years ago

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:

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

pali commented 4 years ago

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 commented 4 years ago

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

pali commented 4 years ago

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.

callegar commented 4 years ago

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

pali commented 4 years ago

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.

callegar commented 4 years ago

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.

pali commented 4 years ago

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.

callegar commented 4 years ago

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.

pali commented 4 years ago

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 commented 4 years ago

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

Cuteistfox commented 1 year ago

what about VAT suport

pali commented 1 year ago

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

Cuteistfox commented 1 year ago

well it is udftools

pali commented 1 year ago

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.