DVD Burning Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
Here's the scenario, I'm backing up some files into a DVD using an
automated script. The script just takes the database entries as well as
the files associated with them, and transfers them into the DVD. As I'm
backing up, I'm pulling up the recording.log to make sure that it's
backing up. It goes through and makes a file list of all the files on
the directory, then procceeds with burning the files. When it gets to
about 32-34 percent the program closes the DVD. To my knowledge the
script doesn't have anything keeping the dvd from backing up only 32-34%
of the data.
 
System specs: AMD duron 1400, 256MB DDR 2100, Maxtor 120 GB HDD x2.
Promise Fasttrak tx2000 RAID 0+1, NEC ND1200 DVD+RW, Shuttle barebone
system.
 
Here's the script which makes the back up:
 
#!/usr/bin/php
<?php
set_time_limit(0);
define("PAGENAME","backup");
include("includes/functions.inc");
$options = new Conf; // Read options file
 
$link = mysql_connect ($options->opts["db_host"],
$options->opts["db_user"], $options->opts["db_passwd"])
or die ("Could not connect");
mysql_select_db("recording");
 
$list_file = "/tmp/files.list";
$db_file = "/tmp/files.csv";
$disc_file = "/tmp/DISC";
$users_file = "/tmp/users.csv";
$groups_file = "/tmp/groups.csv";
$recording_logfile = "/tmp/recording.log";
 
$query = "SELECT
id,filename,filesize,user,ref1,ref2,date,time,client_ip,client_hostname,
found_timestamp,loc,id_backu
p,extra,duration ";
$query .= "FROM files WHERE loc='NULL' ORDER BY date,time";
$result = mysql_query($query);
 
$db_fhandle = fopen($db_file,"w");
$tmp_string =
"\"id\",\"filename\",\"filesize\",\"user\",\"ref1\",\"ref2\",\"date\",\"
time\",\"client_ip\"," .
"\"client_hostname\",\"found_timestamp\",\"loc\",\"id_backup\",\"extra\"
,\"duration\"\n";
fwrite($db_fhandle,$tmp_string);
$total = strlen($tmp_string);
$fp = fopen($list_file,"w");
fwrite($fp,substr(strrchr($db_file,"/"),0) . "=$db_file\n");
fwrite($fp,substr(strrchr($disc_file,"/"),0) . "=$disc_file\n");
fwrite($fp,substr(strrchr($users_file,"/"),0) . "=$users_file\n");
fwrite($fp,substr(strrchr($groups_file,"/"),0) . "=$groups_file\n");
while($row = mysql_fetch_array($result)) {
$total += $row["filesize"];
if($total > $options->opts["dvdsize"]*1000000) {
$total -= $row["filesize"];
break;
}
$idfiles[] = $row["id"];
fwrite($fp,str_replace('=','\=',substr(strrchr($row["filename"], "/"),
0)) . "=" . str_replace('=','\=',$row["filename"]) . "\n");
$tmp_string =
"\"$row[id]\",\"$row[filename]\",\"$row[filesize]\",\"$row[user]\",\"$ro
w[ref1]\",\"$row[ref2]\",\"$row[date]\"," .
"\"$row[time]\",\"$row[client_ip]\",\"$row[client_hostname]\",\"$row[fou
nd_timestamp]\",\"$row[loc]\",".
"\"$row[id_backup]\",\"$row[extra]\",\"$row[duration]\"\n";
fwrite($db_fhandle,$tmp_string);
//$total += strlen($tmp_string);
 
if($total < $options->opts["dvdsize"]*1000000) {
//$total += strlen($tmp_string);
}
}
fclose($fp);
fclose($db_fhandle);
 
$query = "SELECT MAX(id) FROM backup";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$disknr = $row[0]+1;
 
// Write disc file
$disc_fhandle = fopen($disc_file,"w");
fwrite($disc_fhandle,"\"backupsize\",\"media\",\"volumename\"\n");
fwrite($disc_fhandle,"\"$total\",\"DVDR/RW\",\"Grid Disk $disknr\"\n");
fclose($disc_fhandle);
 
// Write users file
$users_fhandle = fopen($users_file,"w");
fwrite($users_fhandle,"\"id\",\"id_group\",\"username\",\"fullname\",\"p
assword\",\"filerights\",\"viewrights\"\n");
$query = "SELECT * FROM users";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
fwrite($users_fhandle,"\"$row[id]\",\"$row[id_group]\",\"$row[username]\
",\"$row[fullname]\",\"$row[password]\"".
"\"$row[filerights]\",\"$row[viewrights]\"\n");
}
fclose($users_fhandle);
 
// Write groups file
$groups_fhandle = fopen($groups_file,"w");
fwrite($groups_fhandle,"\"id\",\"name\",\"description\"\n");
$query = "SELECT * FROM groups";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
fwrite($groups_fhandle,"\"$row[id]\",\"$row[name]\",\"" .
str_replace("\n","\\n",$row[description]) . "\"\n");
}
 
fclose($groups_fhandle);
//$cmd = "dvdblocks=`mkisofs -print-size -r -v -V \"Grid Disk $disknr\"
-graft-points -path-list $list_file`;";
//$cmd .= "mkisofs -r -v -V \"Grid Disk $disknr\" -graft-points
-path-list $list_file | ";
//$cmd .= "dvdrecord -data -eject -v speed=";
//$cmd .= $options->opts["speed"] . " dev=" . $options->opts["device"] .
" -tsize=\${dvdblocks}s - > $recording_logfile 2>&1";
$cmd = "growisofs -dvd-compat -Z /dev/cdrom ";
$cmd .= "-r -v -V \"Grid Disk $disknr\" -graft-points -path-list
$list_file > $recording_logfile 2>&1";
exec("echo '$cmd' > /tmp/command.txt");
exec($cmd);
 
$fh = fopen($recording_logfile,"r");
while($read = fread($fh, 1024)) {
$dvdrecord_cmdl .= $read;
}
fclose($fh);
$dvdrecord = parse_cdrecord($dvdrecord_cmdl);
 
// If the disc has been closed, everything is fine
if(!preg_match("/error/i",$dvdrecord_cmdl) && preg_match("/closing
disc/",$dvdrecord_cmdl)) {
$query = "INSERT INTO backup (`backupsize`,`media`,`volumename`) VALUES
('$total','DVDR/RW','Grid Disk $disknr')";
mysql_query($query)
or die ("Query failed with message: ".mysql_error());
$id_backup = mysql_insert_id();
$query = "UPDATE files SET loc='DVDR/RW:Grid Disk
$disknr',id_backup='$id_backup' ";
$query .= "WHERE id IN (" . implode(',',$idfiles) . ")";
mysql_query($query)
or die ("Query failed with message: ".mysql_error());
// Everything was written successfully
$query = "SELECT filename FROM files WHERE id_backup='$id_backup'";
$result = mysql_query($query)
or die ("Query failed with message: ".mysql_error());
while($row = mysql_fetch_array($result))
@unlink($row["filename"]);
}
@unlink($db_file);
@unlink($list_file);
?>
 
 
The recording log is waaay too big for me to post here, so i'll take out
parts of it:
 
Executing 'mkisofs -r -v -V Grid Disk 3 -graft-points -path-list
/tmp/files.list | builtin_dd of=/dev/cdrom obs=32k seek=0'
mkisofs 2.0 (i686-pc-linux-gnu)
Using CHRIS000.;1 for /CHRISTINE,20040429144536040,,
(CHRISTINE,20040429144434361,,)
Using CHRIS001.;1 for /CHRISTINE,20040429144434361,,
(CHRISTINE,20040429144346252,,)
Using CHRIS002.;1 for /CHRISTINE,20040429144346252,,
(CHRISTINE,20040429144247368,,)
Using LINDA000.;1 for /LINDA,20040429144455282,,
(LINDA,20040429144116658,,)
Using CHRIS003.;1 for /CHRISTINE,20040429144247368,,
(CHRISTINE,20040429144030471,,)
Using CHRIS004.;1 for /CHRISTINE,20040429144030471,,
(CHRISTINE,20040429143841895,,)
Using JIM_2000.;1 for /JIM,20040429144523513,, (JIM,20040429143813685,,)
Using CHRIS005.;1 for /CHRISTINE,20040429143841895,,
(CHRISTINE,20040429143813103,,)
Using CHRIS006.;1 for /CHRISTINE,20040429143813103,,
(CHRISTINE,20040429143744502,,)
Using CHRIS007.;1 for /CHRISTINE,20040429143744502,,
(CHRISTINE,20040429143717934,,)
Using CHRIS008.;1 for /CHRISTINE,20040429143717934,,
(CHRISTINE,20040429143608654,,)
Using JIM_2001.;1 for /JIM,20040429143813685,, (JIM,20040429143441199,,)
Using BONNI000.;1 for /BONNIE,20040429144427519,,
(BONNIE,20040429143058045,,)
Using LINDA001.;1 for /LINDA,20040429144116658,,
(LINDA,20040429142956630,,)
Using CHRIS009.;1 for /CHRISTINE,20040429143608654,,
(CHRISTINE,20040429142952493,,)
Using CHRIS00A.;1 for /CHRISTINE,20040429142952493,,
(CHRISTINE,20040429142901971,,)
 
Writing: Initial Padbock Start Block 0
Done with: Initial Padbock Block(s) 16
Writing: Primary Volume Descriptor Start Block 16
Done with: Primary Volume Descriptor Block(s) 1
Writing: End Volume Descriptor Start Block 17
Done with: End Volume Descriptor Block(s) 1
Writing: Version block Start Block 18
Done with: Version block Block(s) 1
Writing: Path table Start Block 19
Done with: Path table Block(s) 4
Writing: Directory tree Start Block 23
Done with: Directory tree Block(s) 2114
Writing: Directory tree cleanup Start Block 2137
Done with: Directory tree cleanup Block(s) 0
Writing: Extension record Start Block 2137
Done with: Extension record Block(s) 1
Writing: The File(s) Start Block 2138
 
32.74% done, estimate finish Wed Jun 16 12:28:25 2004
32.97% done, estimate finish Wed Jun 16 12:28:24 2004
33.19% done, estimate finish Wed Jun 16 12:28:23 2004
33.42% done, estimate finish Wed Jun 16 12:28:22 2004
33.64% done, estimate finish Wed Jun 16 12:28:24 2004
33.87% done, estimate finish Wed Jun 16 12:28:23 2004
34.10% done, estimate finish Wed Jun 16 12:28:22 2004
34.32% done, estimate finish Wed Jun 16 12:28:18 2004
34.55% done, estimate finish Wed Jun 16 12:28:20 2004
34.77% done, estimate finish Wed Jun 16 12:28:19 2004
35.00% done, estimate finish Wed Jun 16 12:28:18 2004
35.22% done, estimate finish Wed Jun 16 12:28:17 2004
:-[ LBA=bf450h, SENSE KEY=3h/ASC=0Ch/ASCQ=00h ]
:-( write failed: Input/output error
/dev/cdrom: flushing cache
/dev/cdrom: closing track
/dev/cdrom: closing disc
/dev/cdrom: reloading tray
mkisofs: Broken pipe. cannot fwrite 32768*1
 
 
Here's more stuff:
 
[root@localhost root]# cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,user,ro 0 0
 
[root@localhost root]# cat /etc/mtab
/dev/sda2 / ext3 rw 0 0
none /proc proc rw 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
none /dev/shm tmpfs rw 0 0
 
[root@localhost root]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
/proc /proc proc rw 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/pts devpts rw 0 0
none /dev/shm tmpfs rw 0 0
 
[root@localhost root]# fdisk -l
 
Disk /dev/sda: 61.0 GB, 61000000000 bytes
255 heads, 63 sectors/track, 7416 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 7359 59006745 83 Linux
/dev/sda3 7360 7416 457852+ 82 Linux swap
[root@localhost root]#
 
 
Oliver J. Ignacio
Voxred International LLC
12 Spielman Road
Fairfield, NJ 07004
 
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux