0

So, it's that time of year when I need to make a backup disk of some files on a Windows machine, and I want to use UDF so that I can add to it later. It's refusing to let me create any CDs or DVDs since it says the disk is empty and needs formatting, and then won't let me format them... And yes, the disks have never been used (yet) and are un-scratched and so on. It also won't let me edit some disks that I know were made with Windows' own utility for this (Live Filesystem, which is basically UDF as well), so I'm just going to squint at that and move on. (Interestingly, I can open & modify those in Linux...)

So, I went over to my Linux (Ubuntu 18.04) machine and tried to make a UDF-formatted disk with mkudffs (since multisession disks work correctly with absolutely NOTHING, apparently, at least not anymore [I made one once around the Ubuntu 14.04 days, but they haven't actually been editable since, and it's expensive to test]) and it's superior anyway.

I ran the command

mkudffs --media-type=dvd /dev/sr0

and it dumps an error message "Device is read-only" (I don't have the exact wording, but that was all it said). Running the command as root didn't help, and I know for a fact that this has worked before.

Interestingly, the "copy files to disk and burn" thing built into Nautilus worked just fine. Of course, checking the "Leave disk open for future additions" option didn't actually do anything (no surprise there), but it DID burn the files I had on hand.

Now, for next time, what exactly is wrong that it won't let me UDF-format my darn CDs or DVDs?!

[I have not tested with one of my DVD-RWs, but I have tried both CD and DVD just now (with the appropriate media-type flags) and got the same error. They are a bit old, but they are apparently still writable, it's just that for some reason mkudffs in particular is having issues with them.]

0

Via mkudffs you can format only block device with r/w access. So only DVD-RW, DVD-RAM, BD-RE. With support of packet writing pktcdvd.ko kernel module and pktsetup utility you can map CD-RW media to compatible r/w block device too. But prior usage of CD-RW media you need to first format it via cdrwtool utility. cdrwtool is also responsible for formatting CD-RW media to UDF, so use it instead of mkudffs.

Recordable discs (CD-R, DVD-R, BD-R) are not supported by Linux kernel for write operation directly via block device. So writing any data to them needs to be done via burning software. And therefore mkudffs cannot format them to UDF. But you can create UDF image and then burn it to recordable disc.

0

This is a limitation of the media: the oldest types (CD-R, DVD-R, etc.) are write-once, i.e. you can only write big image in a single session to the disc, and the disc cannot be erased. At some point multi-session CD-R discs were introduced, but they work by appending data to the unused part of the disc. Not even the most common re-writable (RW) discs cannot be rewritten to random locations, which a filesystem like UDF needs.

The UDF file system does support creating a "live" filesystem, i.e. a file system which you can add, delete and re-write files on. But this requires that the media supports it. You can create a UDF file system on a hard disk or a USB flash disk with mkudffs, but for a CD-R you will need to first create the filesystem in a disk file, add the files you want to it, and write the whole filesystem as an image to the optical disc.

2
  • How does Windows do it, then? I thought it was a standard part of UDF to be able to mark files as "outdated" and add a new copy later. This technology lets Windows (assuming it doesn't have extensions to it of some sort) make even normal CD-Rs editable (including deletions)... or at least it did a year or two ago, with the same disks I tried now. Furthermore, UDF does do exactly what you mentioned; it doesn't overwrite old data unless it can and it's out of free space. Lastly, it sounded to me that it meant that it can't access the disk to put the structures in place rather than in general. Feb 15 '20 at 22:27
  • Ok, seems I was wrong about the RW discs (DVD-RW and DVD+RW), which can be randomly rewritten using packet writing. See packet-wtriting for info. Feb 16 '20 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.