Backup (and restore) Partition to DVD(s)
Lets say you want to backup an entire partition to DVD(s) with the ability to restore this backup when needed. The command to accomplish this would looks something like this:
dd if=/dev/sda2 of=/home/my-home-directory/backup1.img bs=1M count=4600
dd if=/dev/sda2 skip=4600 of=/home/my-home-directory/backup2.img bs=1M count=4600
dd if=/dev/sda2 skip=9200 of=/home/my-home-directory/backup3.img bs=1M count=4600 ...
... and so on until you have your entire drive backed up. In this example we assume you are using single sided DVDs for your backup, count=4600 will create an image file that will fit on one DVD. Your backup will span multiple DVDs depending on the size of the partition you want to backup. As you can see in the example you use the "skip" argument to skip that many ibs-sized (read bytes) blocks at the start of the input. Again, you want the image files to equal the size of the DVDs you will be using for your backup. If you are using double sided DVDs you will need to adjust the count and skip arguments accordingly.
Next we will will burn our image files to DVD. The tool you use this will depend on your distribution. Some Linux distributions use cdrecord while others use wodim when burning from the command line. Feel free to make use of these command line tools or an application with a GUI (Graphical User Interface) such as Brasero or K3B to burn your images.
When you encounter a situation where you need to restore these images you can do this very easily using the dd command. Based on the above backup you will execute the following commands:
dd if=/media/dvd/backup1.img of=/dev/sda2 bs=1M conv=sync,noerror
dd if=/media/dvd/backup2.img of=/dev/sda2 seek=4600 bs=1M conv=sync,noerror
dd if=/media/dvd/backup3.img of=/dev/sda2 seek=9200 bs=1M conv=sync,noerror ...
... and so on. Again, you will need to adjust the commands to meet the needs of your specific system. If your DVD drive is not located at /media/dvd adjust accordingly. Here you are simply restoring your images to the partition that you backed up. You use the "seek" argument to skip that many obs-sized (write bytes) blocks at the start of the output. For our purposes this number will equal the number you used for "skip" during your image creation.
These examples and much more are possible using the dd command. dd is a powerful command and used improperly can do some serious damage to your system. Be careful experimenting with dd on a production system, otherwise feel free to explore what dd has to offer. Until next time, keep it open source!