How To: Burn DVD’s from the command line
Burning DVD’s from the command line can seem quite geeky, but it happens to be really usefull mainly when you want to back up datas or simply don’t want to bother launching CD/DVD burning interfaces such as k3b or gcombust …
As usual, before being able to use any tools, we need to have such tools installed on your system. In most od the case, the required packages will already be installed. In case it is not, just type:
sudo apt-get install dvd+rw-tools
This will install growisofs
(used for burning) and dvd+rw-tools
(used for formatting a DVD-RW).
If you are using a DVD-RW, you need to format it in the first place, let suppose that our DVD burner is located at /dev/hda, it might be somewhere else, check your /etc/fstab in order to find out more. Here is the dvd formating command line:
dvd+rw-format -force /dev/hda
Now that your DVD is blank, let’s burn it. Suppose that you want to burn the content of /my/directory/datas at the root of the DVD, you need to type:
growisofs -dvd-compat -input-charset=ISO-8859-1 \
-Z /dev/hda -R -J -pad "/my/directory/datas"
Mind that input-charset is setted to the right value. If you do not define it, you default system charset will be used.
The previous command is rather simple, but not really convenient as everything will be at the root of the DVD.
We are now going to make something a bit more ordered. Let say I want to burn the content of /my/directory/datas1 in /dir1 at the root of the DVD, and /my/directory2/content in /otherdir. In this case, we are going to graft directories and the command line will look like:
growisofs -dvd-compat -input-charset=ISO-8859-1 \
-Z /dev/hda -R -J -pad \
-graft-points "/dir1=/my/directory/datas1" \
"/otherdir=/my/directory2/content"
The -R and -J generate records for the Rock Ridge protocol and for Joliet directories (usefull for windows-NT and windows 95 machines). These switches are mkisofs options. You can get more informations from man mkisofs.
The -Z switch is a growisofs argument, it defines an initial burning session. If now, you want to append datas to your project, use -M like:
growisofs -dvd-compat -input-charset=ISO-8859-1 \
-M /dev/hda -R -J -pad \
-graft-points "/morecontent=/my/new/dir"
That’s about it.
You can now eject your DVD with
eject