|
|
CD and DVD writing from the Linux command lineFrom ezUnix
IntroductionThis page aims to provide a gentle introduction to the world of CD and DVD writing from the command line under Linux.
Making Copies of Your Favourite Linux DistroBurning a copy of your favourite Linux distro is the way copying CDs and DVDs should be: easy, cheap and completely legal. # dd if=/dev/dvd of=my_distro.iso bs=2048 I have rarely had any trouble with a data transfer of this type but I have been known to err on the side of caution and mount the iso and read a few files from it before burning to DVD.
# mount -o ro,loop -t iso9660 my_distro.iso /mnt/tmp # umount /mnt/tmp There is something a little special about that isn't there? But next to burn the iso image to a fresh DVD and the following command should do that quite nicely: # growisofs -dvd-compat -Z /dev/dvd=my_distro.iso Now your Linux DVD is ready to distribute to your friends, keep as backup or install to your computer.
# cdrecord --scanbus This gives the address 1,0,0 on my system, yours of course will be different.
# cdrecord -v dev=1,0,0 -speed 8 driveropts=burnfree fs=32 -eject my_distro.iso And there you have it, although all of these settings can varied according to your hardware, burning needs, available media, inclination etc.
#----- /etc/default/cdrecord ------------# # The default recording device to be used by cdrecord: CDR_DEVICE=Optiarc # The default writing speed to be used by cdrecord: CDR_SPEED=8 # The default fifo size while writing: CDR_FIFOSIZE=32m # Device name, scsi address, speed, fifo, drive specific options separated by # tab spaces (-1 means use the defaults, use "" if no driveropts): Optiarc= 1,0,0 -1 -1 burnfree The exact location of this file on your system may vary from this.
Making Copies of Audio CdsDuplicating audio cds has an undeserved reputation for difficulty.
# cdrdao scanbus On my system this identifies the address of the single drive as 1,0,0 yours of course will be different.
# cdrdao read-cd --source-device 1,0,0 --driver generic-mmc \
--paranoia-mode 3 audiocd.toc
This leaves the file data.bin and audiocd.toc in your working directory ready for burning.
# cdrdao write --device 1,0,0 --driver generic-mmc \
--buffers 128 --speed 8 audiocd.toc
If you are a little cautious you can use cdrdao simulate instead of cdrdao write and this will run a simulated burn rather than an actual burn.
#-- /etc/cdrdao.conf --# write_buffers: 128 write_device: "1,0,0" write_driver: "generic-mmc" read_device: "1,0,0" read_driver: "generic-mmc" read_paranoia_mode: 3 write_speed: 8 Now these options do not need to be included in your command line, although any settings you make on the actual command line will override these options.
Making Copies of Your Movie DVDsI have a small collection of DVD movies that I have paid a fair sum for and usually watch them from a backup copy rather than risk the expensive originals.
# vobcopy -m The -m option simply tells vobcopy to "mirror" the DVD to your HDD with decryption carried out at the same time.
# mkisofs -v -dvd-video -o ../movie_name.iso . The final "." is important as it tells mkisofs to use the current directory contains the movie files.
# cd .. # growisofs -dvd-compat -Z /dev/dvd=movie_name.iso I should probably remind you, Gentle Reader, that you will need to substitute your own values for the movie title and iso file.
Backing up Some Directories to DVDI have been working for some time on a fairly basic backup system for my Linux computer which really only involves taking a copy of certain directories a few times a week.
To start with I give the syntax to create the iso image backup.iso of my $HOME directory in a format that can be read on Linux computers, using the Rock Ridge Interchange Protocol, and Windows computers, using the Joliet extension.
# mkisofs -o backup.iso -r -J /home/username Now say that I really don't want to include the sub-directory /home/username/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/username/source \
-graft-points "my_files/=/home/username" "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.
# mkisofs -o backup.iso -r -J -V "Backup `date +"%d %B %Y"`" \
-x /home/username/source -publisher "John Doe" \
-graft-points "my_files/=/home/username" "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.
# growisofs -dvd-compat -speed=1 -Z /dev/dvd \
-r -J -hide-rr-moved -V "Backup `date +"%d %B %Y"`" \
-x /home/username/source -publisher "John Doe" \
-graft-points "my_files/=/home/username" "configuration_files/=/etc" \
"cron_files/=/var/spool/cron/crontabs"
growisofs is of course a frontend for mkisofs and thus uses the same commands.
ConclusionI owe Greg Ippolito a special thanks for his page YoLinux Tutorial: Burning a CD or DVD which was very helpful in research for my own page. I would recommend this page for those who would like a more "encyclopaedic" approach to the area. Please feel free to contact me with any errors of fact that you have found on this page, any errors of opinion will probably remain uncorrected.
ResourcesOriginal Howto by Andrew Strong: http://www.andrews-corner.org/burning.html
That's all folks!
|