Posted by: isaraffee | August 9, 2009

Data Backup and Restoration Using CD-R

Data Backup and Restoration Using CD-R

This mini HOW-TO explain how to do a full backup of your system directories and personal data to a disc (CD-R or CD-RW)

For the full backup script please refer to the “Full Backups Documentation”

The script will backup system directories and personal data. The output is a tar file. After which you can run the gzip command on the backup file to compress its size.

Firstly run the full backup script. In my case, the script is located in the /root/script_mercury directory.

cd /root/script_mercury/


This will take less then a minute. After the backup has completed, the backup file will be stored in the /mybackup directory.

Verify that this backup file exists and shown below:

# cd /mybackup/

[root@mercury /mybackup]# ll -rt

-rw-r–r– 1 root root 20510 Aug 4 18:09 backup_tar_log

-rw-r–r– 1 root root 1104089 Aug 4 18:09 04Aug2007_1809_backupfile

# file 04Aug2007_1809_backupfile

04Aug2007_1809_backupfile: GNU tar archive

The backup file is a tar file and has not been gzipped. Execute the gzip command on the file and you should see something like this:

# gzip 04Aug2007_1809_backupfile

-rw-r–r– 1 root root 1104089 Aug 4 18:09 04Aug2007_1809_backupfile.gz

With the gzipped backup file, you are now ready to burn it to a disc

To burn it to a file you have to make an ISO file of the file by using the mkisofs command as shown below. But first change to a /tmp directory (or any directory you like)

cd /tmp

# cd /tmp

Then execute the following command:

[root@mercury /tmp]# mkisofs -r -o backup_04Aug2007_1815hr.img /mybackup/04Aug2007_1809_backupfile.gz

You will see an output similar to the one shown below:

Total translation table size: 0

Total rockridge attributes bytes: 269

Total directory bytes: 0

Path table size(bytes): 10

Max brk space used 35a4

565 extents written (1 Mb)

List the file just to check it existed.

ll -rt /tmp

-rw-r–r– 1 root cdwriter 1157120 Aug 4 18:12 backup_04Aug2007_1815hr.img

With this image file, you can run the cdrecord command to burn itto disc. Type:

[root@mercury /tmp]# cdrecord dev=0,0,0 -v -data backup_04Aug 2007_1815hr.img

Cdrecord 1.9 (i586-mandrake-linux-gnu) Copyright © 1995-2000 Jörg Schilling

TOC Type: 1 = CD-ROM

scsidev: ‘0,0,0’

scsibus: 0 target: 0 lun: 0

Linux sg driver version: 3.1.17

Using libscg version ‘schily-0.1’

atapi: 1

Device type : Removable CD-ROM

Version : 0

Response Format: 2

Capabilities :

Vendor_info : ‘BENQ ‘

Identifikation : ‘DVD DC DW1670 ‘

Revision : ‘101 ‘

Device seems to be: Generic mmc2 DVD.

Using generic SCSI-3/mmc CD-R driver (mmc_cdr).

Driver flags : SWABAUDIO

Drive buf size : 1114112 = 1088 KB

FIFO size : 4194304 = 4096 KB

Track 01: data 1 MB

Total size: 1 MB (00:07.56) = 567 sectors

Lout start: 1 MB (00:09/42) = 567 sectors

Current Secsize: 2048

ATIP info from disk:

Indicated writing power: 5

Reference speed: 2

Is not unrestricted

Is erasable

ATIP start of lead in: -11635 (97:26/65)

ATIP start of lead out: 337350 (75:00/00)

speed low: 0 speed high: 4

power mult factor: 4 6

recommended erase/write power: 3

A2 values: 4A C8 06

Disk type: Phase change

Manuf. index: 3

Manufacturer: CMC Magnetics Corporation

Blocks total: 337350 Blocks current: 337350 Blocks remaining: 336783

Starting to write CD/DVD at speed 4 in write mode for single session.

Last chance to quit, starting real write in 1 seconds.

Waiting for reader process to fill input buffer … input buffer ready.

Performing OPC…

Starting new track at sector: 0

Track 01: 1 of 1 MB written (fifo 100%).

Track 01: Total bytes read/written: 1157120/1157120 (565 sectors).

Writing time: 19.186s


Fixating time: 62.819s

cdrecord: fifo had 19 puts and 19 gets.

cdrecord: fifo was 0 times empty and 0 times full, min fill was 100%.[

To verify that the file exist in the disc by typing:

# ll /mnt/cdrom

total 1083

-r–r–r– 1 root root 1104089 Aug 4 18:09 04Aug2007_1809_backupfile.gz

With the backup file in the disc you can restore the file to any machine or even you can test restoration onthe current machine you are working right now.

To restore the backup file to the current machine, I suggest you make a restoration directory, something like this:

mkdir restore_mercury_04Aug2007

Then copy the backup file from the disc to the restoration directory:

# cp 04Aug2007_1809_backupfile.gz /root/script_mercury/restore_venus_Apr2007/

To restore the file type the following command:

First unzip the file:

# gzip 04Aug2007_1809_backupfile(

Then run the tar command to extract the file contents:

tar xvf 04Aug2007_1809_backupfile

You will get an output something like this. Your backup directories and data will be restored:

# ll /root/script_mercury/restore_mercury_Aug2007

total 5476

-r–r–r– 1 root root 5580800 Aug 4 18:18 04Aug2007_1809_backupfile

drwxr-xr-x 9 root root 4096 Aug 4 18:20 etc/

drwxr-xr-x 3 root root 4096 Aug 4 18:20 root/

drwxr-xr-x 3 root root 4096 Aug 4 18:20 var/

The directories above will have all the files that have been backup. Cool eh!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: