dcsimg

Using cdrecord to Backup Files

I am using a CD recorder connected to an old system that has a SCSI card and is running a basic Debian system. Everything is connected properly, and I have recently installed the mkisofs and cdrecord applications, in order to be able to backup my files and burn them onto a CD. So, how do I create an ISO image of the files on my current system, and can the cdrecord command do the job?

I am using a CD recorder connected to an old system that has a SCSI
card and is running a basic Debian system. Everything is connected
properly, and I have recently installed the mkisofs and cdrecord
applications, in order to be able to backup my files and burn them
onto a CD. So, how do I create an ISO image of the files on my current system, and can the cdrecord command do the job?

Well, let’s look at your question one part at a time.

The first part is making a basic ISO image of your files. If you’ve ever looked at the mkisofs man page, you know that it is a very flexible and powerful tool that is, at first, not very user-friendly. So, to keep it simple, I would start by using it with only a few of the essential options that you need to get going. The syntax I would use can be seen in Figure One.




Figure One


mkisofs -r -L -o myimage.img /dir/of/files/to/backup

Doing this would create a file named myimageb.img that could then be burned onto a CD. It would contain all the files and directories you specify from the directory of choice (/dir/ of/files/to/backup). The -r switch sets the uid/gid to 0, and the -L allows filenames that begin with a period to be copied. If this is not set and you backup your home directory, no configuration files (.dot files) will be saved to your image. Finally, -o allows you to specify the name of the file to which the iso9660 filesystem image should be written. The example above specifies that the iso9660 file is written to a file named myimage.img.

What if you want to backup your home directory but want to exclude certain things? You can use sytax, like in Figure Two, to exclude some of the items in your home directory.




Figure Two


mikisofs -r -L -o cdrom.img -x /home/gbrown/rpms \ /home/gbrown

With the addition of the -x switch, you will end up getting the entire /home/gbrown directory except for the /home/gbrown/rpms directory. So, with all this in mind, let’s move on to the second part of your question and burn some CDs!

Cdrecord is the command that will enable you to take your iso9660 image file and burn it to disk. The first thing we need to do is determine the device parameters we need to use. There are three parameters we are going to need:

1. The SCSI bus number

2. The Target ID

3. The LUN (Logical Unit Number)

It’s easy to find these parameters, using the following command:


cdrecord –scanbus

That should return a list like you see in Listing Three.




Listing One: Scanbus Output


1,0,0   100) *

1,1,0 101) ‘yamaha ‘ ‘CRW8424s ‘ 1.0g’ Removable CD-ROM
1,2,0 102) *

1,2,0 102) *

1,3,0 103) *

The vfat filesystem will allow you to share Zip disks between Windows and Linux. If you’re going to be using vfat as your filesystem on the Zip disks, you will need to make sure that your kernel supports vfat either as a monolithic feature (compiled in the kernel) or loadable modules. To see if vfat support has been loaded by the kernel, you can use this command:


dmesg | grep vfat

If you get a response indicating that vfat support has been loaded, then you are fine. If you are not successful with the dmesg command, you can try cd‘ing to the /lib/modules/2.2.x.fs/ directory and looking for a vfat.o module there. If you find one, do a /sbin/ lsmod to list the currently loaded modules. If you see it in the list, you should be ready to go. If not, you can run the modprobe -v vfat command, and the vfat module should load with no problem.

If either option was successful, you can go ahead and load the ppa.o driver for your Zip drive (newer Zip drives might be better off using the imm.o driver). After doing that, type dmesg | grep ppa. You should see an entry there for the ppa driver and a device definition for your Zip drive. At this time, go ahead and create a temporary mount point for your Zip drive that you can use to mount your disks. I like to use /mnt/zip as my mount point for Zip drives, but you can name it anything you’d like. So for example:


mkdir /mnt/zip

Now with that mount point set, and the vfat module loaded and ready to go, you can go ahead and issue this simple command:


mount -t vfat /dev/sda /mnt/zip

You should have a vfat filesystem mounted under Linux. If you don’t have support for modules compiled into your kernel, and your kernel does not have support for vfat specifically compiled in, you will need to recompile your kernel. This is a process well worth the time it takes to learn. Make sure to read the kernel HOWTO before you start the process.

Now about those *.tar.gz file installs…

The basic syntax that I use to decompress these files is:

tar zxpvf packagename.tar.gz

What do all of those switches mean? Here is a list of them and what they do:

z — filter the archive through gzip

x — extract files from an archive

p — extract all protection information

v — verbosely list files processed

f — use archive file or device F

Now, once you have uncompressed your file, you will usually find some directions to follow in the newly created directory itself. Usually, these instructions will have names like INSTALL or Readme.txt. These files will tell you what else you need to do in order to get the software configured, compiled and installed. (See Newbies for more information on this topic.) I hope this explanation has answered your question.




App Tips










Tech Support Dia
Tech Support Gnomba
Tech Support Normal


* Dia — This is a program that lets you do flowcharting, electrical engineering diagrams, Pneumatic/Hydraulic, UML, network diagrams, and much more. It is similar to the very popular Visio program that runs under Windows9X/ 2000. It’s very flexible. It allows you to create new shapes and objects using simple XML files, and lets you draw the shapes with a subset of SVG. It can also save diagrams to a custom XML format or export them to EPS or SVG formats. I have switched all of my diagram draws to Dia from Visio. I really like this program and would highly recommend it.


* Gnomba — This is a tool that you can use to browse and mount SMB protocol (SAMBA) shares. You can add as many network segments to scan as you’d like. All you need to do is add some basic IP address information. Lately, I’ve been using Gnomba to move data to and from my VMware Win9x sessions on my Linux laptop.


* Motion 1.4 — This app takes its input from the video4linux motion detection device. It then converts that data to an mpeg movie. So basically, in less than an hour, with one cheap desktop video device, you can created a video security system for your home! This is a lot of functionality for less than $100 bucks. It’s a very cool application.



Gaylen Brown is a senior consultant at Linuxcare, Inc. He can be reached at tech@linux-mag.com.

Comments are closed.