Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

CD/DVD Drives

Note: With today's polished distributions of GNU/Linux, including Debian and Ubuntu, (as of 2008) the description here may be dated, but we retain this information for reference.

If watching a DVD seems a bit choppy (stops and starts) then perhaps the CD/DVD IDE device needs some tuning. First check to see what the current settings are (e.g., on Belinos (38.16) where the DVD driver is /dev/hda):

  $ hdparm /dev/hda

   IO_support   =  0 (default 16-bit)
   unmaskirq    =  0 (off)
   using_dma    =  0 (off)
   keepsettings =  0 (off)
   readonly     =  0 (off)
   readahead    = 256 (on)
   HDIO_GETGEO failed: Invalid argument

For a DVD, setting the readahead to 8 (-a8) seems to fix it. Turning unmask on (-u1) also might help:

  $ sudo hdparm -d1 -a8 -u1 /dev/hda
   setting fs readahead to 8
   setting unmaskirq to 1 (on)
   setting using_dma to 1 (on)
   HDIO_SET_DMA failed: Operation not permitted
   unmaskirq    =  1 (on)
   using_dma    =  0 (off)
   readahead    =  8 (on)

To have this tuning survive a reboot add something like the following into /etc/hdparm.conf:

/dev/hda {
	read_ahead_sect = 8
	interrupt_unmask = on
This needs to be run on boot after the appropraite modules for the CD/DVD have been loaded, so following the instructions in the README file:
  $ wajig readme hdparm | most
  $ sudo editor /etc/hdparm.conf
  $ sudo ln -s /etc/init.d/hdparm /etc/rcS.d/S39hdparm.second
The instructions suggest S29 but that did not work for me.

If you have any problem rebooting after making these changes, use the nohdparm boot parameter and this will inhibit hdparm from doing anything and allow you to boot and fix the problem.

Visit http://www.mplayerhq.hu/DOCS/HTML/en/drives.html for a collection of tuning suggestions.

Turning DMA on (-d1) fails on many DVDs. According to the Red Hat Linux Release Notes (http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/release-notes/x86/) DMA is often disabled on CD-ROM drives because they are often not capable of IDE DMA. If you are sure that your CD-ROM drive is capable of IDE DMA you can do the following:

  # rmmod ide_cd
  # modprobe ide-cd dma=1

Copyright © 1995-2020 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.