Showing posts with label dvd. Show all posts
Showing posts with label dvd. Show all posts

12 February 2025

Ensuring USB DVD order

As my USB dvd drives were being detected into a seemingly random order, I wanted to be able to control what device each was being assigned.


Adding udev rules

  • Find serials to add
    • sudo udevadm info /dev/sr0 | grep ID_SERIAL_SHORT
    • sudo udevadm info /dev/sr1 | grep ID_SERIAL_SHORT
    • sudo udevadm info /dev/sr2 | grep ID_SERIAL_SHORT
  • Create /etc/udev/rules.d/99-dvd.rules
ACTION="add", KERNEL="sr[0-9]", ENV{ID_SERIAL_SHORT}="first drive serial", SYMLINK+="dvd0"

ACTION="add", KERNEL="sr[0-9]", ENV{ID_SERIAL_SHORT}="second drive serial", SYMLINK+="dvd1"

ACTION="add", KERNEL="sr[0-9]", ENV{ID_SERIAL_SHORT}="third drive serial", SYMLINK+="dvd2"

  • Reboot or force rerunning the rules
    • sudo udevadm control --reload
    • sudo udevadm trigger
  • However, this did not work
  • Edit /etc/udev/rules.d/99-dvd.rules and remove the ACTION
KERNEL="sr[0-9]", ENV{ID_SERIAL_SHORT}="first drive serial", SYMLINK+="dvd0"

KERNEL="sr[0-9]", ENV{ID_SERIAL_SHORT}="second drive serial", SYMLINK+="dvd1"

KERNEL="sr[0-9]", ENV{ID_SERIAL_SHORT}="third drive serial", SYMLINK+="dvd2"

  • Reboot or force rerunning the rules
    • sudo udevadm control --reload
    • sudo udevadm trigger


Outcome

Success, it now creates the /dev/dvd* in a consistent order. Unfortunately, Handbrake still tries to use the /dev/sr* labels.


Appendix

Sources


02 September 2022

Saving data off a scratched DVD

I had a DVD with files on it that I needed. Unfortunately, it was giving me errors when trying to pull them off. Here is what I did to try to recover as much data as possible.

  • Install ddrescue and a gui for visualizing its progress
    • sudo apt-get install gddrescue ddrescueview
  • Run a first pass with no retries to get as much info as possible
    • ddrescue -dn -b2048 /dev/sr0 disk.img disk.mapfile
  • Retry failed blocks
    • ddrescue -d -r5 -b2048 /dev/sr0 disk.img disk.mapfile
  • Description of the options:
    • /dev/sr0: the dvd drive
    • disk.img: the file to create
    • disk.mapfile: the mapfile that keeps track of the status of the recovery
    • -d: Use direct disc access for input (aka, no caching)
    • -n: Skip the scraping phase
    • -b2048: block size of 2048, use for cdroms and dvd
      • defaults to 512
    • -r5: retry 5 passes
      • -1 for infinite passes

Sources: