[SOLVED] Command-line utility to check burned DVD?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You could use dd to copy the data back from the DVD to a file and checksum it, for example with md5sum. If you are doing this there are a couple of potential "gotchas". The DVD must not be mounted or you will get its contents not the image and you must dd the same amount of data back from the DVD using dd's count= option (divide the iso size in bytes by 512, assuming dd's default block size of 512 bytes).
Like catkin says, use md5sum and dd to read the burned image. No need for using another file though.
Here's a `rawread` command (a script) that came with some package or other, I've had it floating around for quite a while.. I don't think it currently comes with Slackware.. Anyhow, let's say your DVD drive is /dev/sr0, then you would do:
Code:
root# ./rawread /dev/sr0 | md5sum
and wait till it finishes - it takes a little while. Here's the code:
Code:
#!/bin/sh
# rawread - reads raw data of optical drive.
device=$1
blocksize=`isoinfo -d -i $device | grep "^Logical block size is:" | cut -d " " -f 5`
if test "$blocksize" = ""; then
echo catdevice FATAL ERROR: Blank blocksize >&2
exit
fi
blockcount=`isoinfo -d -i $device | grep "^Volume size is:" | cut -d " " -f 4`
if test "$blockcount" = ""; then
echo catdevice FATAL ERROR: Blank blockcount >&2
exit
fi
command="dd if=$device bs=$blocksize count=$blockcount conv=notrunc,noerror"
echo "$command" >&2
$command
EDIT: Here's what you see if you use it:
Code:
sasha@reactor: /home/sasha/SCRIPTING/rawread /dev/sr0 | md5sum
dd if=/dev/sr0 bs=2048 count=1884590 conv=notrunc,noerror
1884590+0 records in
1884590+0 records out
3859640320 bytes (3.9 GB) copied, 298.572 s, 12.9 MB/s
560b0feb704ae2e742682babdb1bde40 -
sasha@reactor:
With the final md5sum there in bold.
Last edited by GrapefruiTgirl; 11-17-2010 at 11:12 AM.
Thanks much for the tip, but although the DVD is in the drive but apparently not mounted, the above script didn't work:
Code:
root@ubuntu:/tmp# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
root@ubuntu:/tmp# ./rawread /dev/scd0 | md5sum
catdevice FATAL ERROR: Blank blocksize
d41d8cd98f00b204e9800998ecf8427e -
Correct that the disc does not need to be mounted. I suspect the problem using the script is that you do not have cdrtools and/or dvd+-rw_tools (approximate spelling) packages installed. So, the value of that variable is not being set correctly, and the script is failing. The script is pretty simple as you can see, so I can't imagine what else could be wrong.
Whatever package brings `isoinfo` with it. For me, I have:
Code:
root@reactor: which isoinfo
/usr/bin/isoinfo
# Which comes from Slackware package:
cdrtools-3.00-x86_64-1
So the above indicates for me, a Slackware package called cdrtools-3.00-x86_64-1 - maybe you have (or don't have) a similar package (cdrtools) for your OS which would provide this tool?
Otherwise, you'll have to come up with another means of determining correctly, the count= and blocksize= values you require for `dd` to correctly read back the data.
OK, found what it was: When copy/pasting from the web page to the terminal, the "blocksize=" and "blockcount=" lines were turned into two lines. Fixing those two errors solved the problem.
Apparently, an alternative to using md5 directly is using the original ISO file as reference:
pv? What's that? Not on Slackware64 and netsearching matches too many irrelvant pages.
Given that any padding will be on the DVD, not in the .iso, would it be better to use pv /dev/scd0 | cmp myfile.iso? Otherwise an early EOF could indicate an error.
Last edited by catkin; 11-18-2010 at 11:17 AM.
Reason: SLackware64 -> Slackware64
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.