cdrecord

Backing up Some Directories to DVD

Posted on Updated on

Start with I give the syntax to create the iso image backup.iso

$ mkisofs -o backup.iso -r -J /home/andrew

Now say that I really don’t want to include the sub-directory /home/andrew/source in this image and I also want to add a few more directories but I would like to map them to the DVD in a slightly different structure:

# mkisofs -o backup.iso -r -J \
-x /home/andrew/source \
-graft-points "my_files/=/home/andrew" "configuration_files/=/etc" \
"cron_files/=/var/spool/cron/crontabs"

Now I would like to add a volume label to the DVD so that my system will identify it by a recognisable label, in this case the backup date. I will also add my own name here as the publisher of this DVD:

# mkisofs -o backup.iso -r -J -V "Backup `date +"%d %B %Y"`" \
-x /home/andrew/source -publisher "Andrew Strong" \
-graft-points “my_files/=/home/andrew” “configuration_files/=/etc” \
“cron_files/=/var/spool/cron/crontabs”

The final addition to the mkisofs syntax is designed to hide the directory RR_MOVED from sight, a directory created when Rock Ridge has to move a lot of files around in deep directory structures. But in a bonus for you, Gentle Reader, I also add the growisofs command to burn the iso image to DVD in a single command:

# growisofs -dvd-compat -speed=1 -Z /dev/dvd \
-r -J -hide-rr-moved -V "Backup `date +"%d %B %Y"`" \
-x /home/andrew/source -publisher "Andrew Strong" \
-graft-points "my_files/=/home/andrew" "configuration_files/=/etc" \
"cron_files/=/var/spool/cron/crontabs"

growisofs is of course a frontend for mkisofs and thus uses the same commands. And there you have it, a backup DVD that is readable on both Linux and Windows. The many, many other options available in mkisofs I will leave you, Gentle Reader, to explore on your own. Again I wish you all the best with your burning and remember: keep it legal!