How to create UDF images and burn them to DVD or CDROM?
There are in fact two ways of generating a UDF filesystem image on Linux, depending on your requirements.
Create a UDF/ISO-9660 image with mkisofs
The mkisofs
tool has the ability to generate a combined UDF and ISO-9660 bridge filesystem in a single pass. This is a filesystem that stores both a UDF directory and a legacy ISO-9660 directory referring to the same file data (so the data is only stored once). Any modern operating system (Windows XP or newer) will access the UDF data and completely ignore the ISO-9660 information, so to all intents and purposes this is a UDF filesystem.
The advantage of this approach is that you can create the filesystem in one pass, starting with an input directory and ending with a populated filesystem image. This means you can also dump the output directly to growisofs
and burn it straight to disk. The possible disadvantage is that there will be a small amount of space wastage due to the legacy ISO-9660 structures, and the resulting filesystem will not be writable (so you can't use it for your DVD-RAM or BD-RE media if you want to be able to modify the data on a mounted disk).
To generate such a filesystem image, you would use a command like:
mkisofs -udf -o myimage.udf -V MyDiskTitle /path/to/input/files
or to burn directly to disk:
growisofs -Z /dev/dvd -udf -V MyDiskTitle /path/to/input/files
Note that to use this option you need a recent version of proper mkisofs
, not the abandoned and ancient genisoimage
fork that ships with many Linux distributions.
Create a "pure" UDF filesystem with mkudffs
If you absolutely must have a pure UDF filesystem with no ISO-9660 data structures, you can use the mkudffs
tool from the udftools
package along with a loopback device to generate a local image. This requires more steps than using mkisofs
above, but it is the only way to generate both a pure UDF filesystem and one which can be mounted read-write after being burned to random-access media like DVD-RAM or BD-RE.
First, you need to generate a blank file to contain the image. Here the size is given as 650 MB to match a standard CD, this will obviously need to be larger for a DVD/Blu-Ray. See this wikipedia article for the exact sizes of DVD media.
$ truncate -s 650M /tmp/cdimage.udf
Now invoke mkudffs
to generate a UDF filesystem in this blank image:
$ mkudffs --media-type=dvdrw /tmp/cdimage.udf
See mkudffs(1)
for other possible media types. Both truncate
and mkudffs
will create sparse files if your filesystem supports them; so the image won't occupy the full size unless you fill it.
Then you can mount your image locally to copy data to it
$ sudo mkdir /media/udfimage
$ sudo mount -t udf -o loop,rw /tmp/cdimage.udf /media/udfimage
After the data has been copied to the image, the process is followed in reverse to unmount the image and detach the loopback device:
$ sudo umount /dev/loop0
Related videos on Youtube
polemon
Updated on November 21, 2022Comments
-
polemon over 1 year
Writing CDs with
cdrecord
and making images withgenisoimage
is no problem.I want to write DVDs in a similar manner, first creating an image, then burning it to disk. This is quite beneficial, since I can inspect the image before burning it to disk.
Now, all I've seen, is how to use the
growisofs
command to burn something to DVD, but all how-to's were using ISO9660 for DVDs. But I want to burn UDF images. Before I can burn them, I need to make them, but how do I create UDF images?Also, If you could explain, or link on how to burn BluRay, that would be great, too.
All tools must be command line, as I need to work with it, where GUI is no option.
-
Admin almost 13 yearsOK, but I want to use UDF just for general data, not just for video. Since UDF is a filesystem, it can be used on CDROM as well.
-
Admin almost 13 yearsNice! And I believe, I burn that image to DVD just as I burn ISO images to CDROM, right? With BluRay this procedure is the same, I'm guessing?
-
Admin almost 13 yearsI just noticed, you can use
mkudffs
directly on a file:mkudffs --media-type=dvd test.udf
-
Admin almost 13 years@polemon - yes, you just burn the image as normal. I haven't tried Blu-ray myself, but I imagine the process is very similar. And good find with mkudffs, I had no idea you could use it directly on the blank file and this makes the process a lot easier.
-
Admin almost 13 yearsI don't want to morph this into a discussion, but with
genisoimage
I don't have to care about the image size,genisoimage
figures out the size itself, when creating it. But when dealing with UDF, I make a UDF image beforehand and then fill it. More often than not, the size doesn't fit, and I need to create another image. Is there a tool, that can create the image and fill it with the files specified, while keeping the size of the image minimal? Keeping the image size minimal, facilitates putting the image online, etc. -
Admin almost 13 years@polemon: you could use
du
for example, to determine the size of the directories to be copied and then make the image this size, but I don't know of a single tool that does this. You are right we are not supposed to have discussions in the comments but I have edited the answer to include mention of this. -
Admin over 12 years@polemon:
truncate
andmkudffs
both create sparse files by default if your filesystem uses them: so go ahead and create a 4.4G image, it won't occupy that on disk unless you fill it. -
Admin over 11 yearsDoesn't work on Ubuntu 11.04! I can follow the "general data" recipe to the point where I can mount the
*udf
file. However, I can not write in theudfimage
directory. The error I get is "Read-only file system" (even thoughmount
lists it asrw
) -
Admin over 11 years@Oleg2718281828, I run into the same problem on Ubuntu 12.04. And following the instruction in /usr/share/doc/udftools/README.Debian.gz, I can create a data udf file.
-
Admin almost 11 yearsTo prevent the "readonly mount" error, When passing the media type to mkudffs use dvdrw instead of dvd.
-
Admin almost 9 yearsThe
mkisofs
tool has a-udf
option that will create a udf filesystem. It actually creates a hybrid that is UDF and ISO9660 plus, optionally, rockridge and joliet (if the-r
and-J
options are also given).