0

I have a scripts that write some backups on DVD on a Gentoo system.
Initially I gathered the files, create a ISO image, and the burn that image on disk using cdrecord.
After the burn process is complete I want to mount the written DVD then mount the ISO image and compare the files and sizes.
The issue is that I cannot the DVD without ejecting it first.
Unfortunately in my scenario I cannot get back the DVD as I have a small portable USB DVDRW.

Any idea on how should I approach this ?

1
  • It seems udev related - hardware probably doesn't trigger and find the burned image. Checkout udevadm trigger.
    – orion
    Jan 21 '16 at 19:18
1

use lsscsi to determine the scsi id of the dvd drive (I am using "A", "B", "C", "D" to represent numbers)

# lsscsi
[0:0:0:0]    disk    ATA      SAMSUNG MZNLN512 1L6Q  /dev/sda 
[A:B:C:D]    cd/dvd  PLDS     DVD-RW DU8A6SH   DU53  /dev/sr0 

delete the device

# echo 1 > /sys/class/scsi_device/A\:B\:C\:D/device/delete

reload the device. In the example below 'hostA' the A is from the lsscsi line above

# echo 'B C D'> /sys/class/scsi_host/hostA/scan
0

This is a known problem between burn programs and the Linux kernel. The kernel only forwarded SG_IO ioctls to the burner device and does not know that the device content changes. So its device state model and its data buffers stay outdated.

I am not aware of a reliable method to let the kernel re-assess the medium, other than reloading the medium. If orion's proposal of udevadm trigger helps, then i would be interested to learn the exact command text.

Well, if it is an ISO 9660 filesystem, xorriso can compare the files by reading their real content via SG_IO ioctls.

xorriso -for_backup -indev /dev/sr0 -compare_r /disk/path1 /iso/path1 -compare_r /disk/path2 /iso/path2 ...more.compare_r...

where you use instead of /disk/pathX /iso/pathX the directory tree paths on hard disk and in ISO which you want to compare.

It would become more convenient if you created the ISO by xorriso while its command -for_backup is in effect, or with xorrisofs and option --for_backup.

xorrisofs --for_backup ...mkisofs.arguments...

Such an ISO can be verified by

xorriso -for_backup -indev /dev/sr0 -check_md5_r SORRY / --

1
  • Upvoted for mentioning xorriso.
    – Kevin S
    Mar 23 '16 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy