About device characteristics and CD/DVD drives

Thomas Schmitt scdbackup at gmx.net
Thu Jan 14 10:20:55 UTC 2010


Hi,

i have installed
  ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/8.0/8.0-RELEASE-amd64-dvd1.iso.gz 
with the intention to provide full technical
support for libburn on FreeBSD. I myself am used
to Linux and older workstation systems.

The MMC stuff to operate CD drives seems to
still work well, thanks to a contribution of
bland in 2006 or alternatively the FreeBSD
driver of upcomming libcdio-0.83.

Nevertheless a few questions arised.
Any link enhanced RTFM is welcome.

------------------------------------------------

- How to detect by a C program that a character
  device is indeed block-wise readable and
  writeable ?
  I.e. devices which would be block devices on
  Linux.

  libburn can emulate DVD+RW on regular files or
  random-access-read-write devices. I would like
  to use USB sticks as ISO 9660 multi-session
  storage. It already works by a hack that boldly
  regards any /dev/da[0-9] as "block device".
  Eligible would be devices which allow to
  lseek(2), write(2), read(2) with 2 kB
  granularity.

  Does handbook 18.2 "Device Names" describe a
  hard rule ? 
  Is every CAM CD drive accessible as /dev/cdN
  and is every /dev/cdN a CAM CD drive ?
  Is every /dev/daN a random-rw storage device ?
  What about fd, fla, sa, ad, ast ?

------------------------------------------------

- How to determine the storage capacity of a
  device file ?

  Most interesting with the random-access
  devices of the previous question.

------------------------------------------------

- How to revive a USB CD drive after power
  cycle ?
  How to kill a stuck cdrecord process ?

    $ cdrecord -v -sao -multi dev=2,0,0 test.iso
  reliably gets stuck with SATA and
  USB drive. (One should disable this mode.)
  The stuck SATA drive needs power cycle of the
  whole system. The USB drive should be
  resettable independently but FreeBSD does not
  make it accessible as /dev/cd* after a power
  cycle of the drive.

  It might have to do with the failed cdrecord
  run which still sat there and said:
    Writing pregap for track 1 at -150
  (The -150 is normal with SAO. Being stuck is
   not. libburn SAO works fine on FreeBSD 8.0.)
  Nothing but reboot could end that process.

  On Linux, the same drive gets always back to
  life after being power-cycled or re-plugged.
  On FreeBSD i currently have to perform
    shutdown -p now
  a bit more often than i would like to.
  (Confessed: i provoke it intentionally.)

  Is there a hard reason why cdrecord is so old
  on the FreeBSD 8.0 DVD ?
  Is there a maintainer for it on FreeBSD ?
  I would like to cooperate.

------------------------------------------------

- Are there specs what mkisofs is supposed to do
  when preparing a bootable FreeBSD image ?
  Anything more than pointing an El Torito record
  to the boot file in the ISO image ?

------------------------------------------------

- Where to read about this phenomenon:
  - xterm on SuSE Linux 10.2
  - ssh to FreeBSD 8.0
  - Backspace key works, Delete key prints "~"
  Strange: My program xorriso uses libreadline.
  Its Delete key does work in the same SSH
  session. Only the one of the shell does not.

------------------------------------------------

- What is the meaning of the ruleset numbers ?

  I combined the advise of the libburn ports
  maintainer and handbook "18.5 USB Storage
  Devices". J.R. Oldroyd enabled my SATA drive
  cd0 by [localrules=10]. The other set
  [localrules=5] is composed from handbook and
  my guessing.
  If i do not repeat the lines about 'pass*'
  and 'cd*' in number 5, then the USB drive
  cd1,pass1 stays rw-r-----.
  man 5 devfs.rules does not bring insight.
  I executed after each rules change:
    /etc/rc.d/devfs start

  Now working content of /etc/devfs.rules :

  # Advise by J.R.Oldroyd for SATA and libburn:
  [localrules=10]
  # rules for grip and xfburn support
  add path 'acd*' mode 0666
  add path 'cd*' mode 0666
  add path 'pass*' mode 0666
  add path 'xpt*' mode 0666

  # From handbook 18.5 :
  [localrules=5]
  # This is for USB sticks:
  add path 'da*' mode 0666 group operator
  # Why do i have to do this again for USB cd1 ?
  add path 'pass*' mode 0666
  add path 'cd*' mode 0666
  # This i need for USB cd0 if no atapicam is up
  add path 'xpt*' mode 0666
  # This is needed for normal users with acd0 
  # if no atapicam is up
  add path 'acd*' mode 0666

  (I know 0666 is very lax. My advise to users
   is to have an extra group for CD devices.)

------------------------------------------------

- Would there be interest in comments and small
  objections with handbook chapters 18.6 (CDs),
  18.7 (DVDs), 18.12 (Backup) ?
  Especially 18.12.7 ("dump(8) Period") could
  need a little discussion about why, what,
  and how to backup. Coordination seems
  indicated with 18.14 (Snapshots) and the
  optical media chapters.

------------------------------------------------

  
Have a nice day :)

Thomas



More information about the freebsd-questions mailing list