[clug] Figuring out the optical disk type
soxwell at gmail.com
Fri Sep 16 12:51:42 UTC 2016
I'm finally getting around to a project to get my home server automatically
rip audio cds.
As is my want, I'm trying to do this within a Linux container and an
external DVD drive in a USB enclosure.
It's been pretty easy to pass the drive into the container with these
lxc.aa_profile = lxc-container-default-with-mounting
lxc.cgroup.devices.allow = c 189:* rwm
lxc.mount.entry = /dev/bus/usb dev/bus/usb none bind,optional,create=dir
lxc.cgroup.devices.allow = b 11:* rwm
lxc.mount.entry = /dev dev none bind,optional,create=dir
And lo, there's a /dev/sr0 and a /dev/cdrom symlinked to it when the drive
is plugged in.
udev events aren't available, so a udev rule to kick off the cd rip isn't
an option, but doing an inotifywait on /dev/sr0 looking for attribute
changes can tell me when a cd is put into the drive.
My sticking point is trying to figure out the type of optical disk in the
udevadm info /dev/sr0 in the host instance give me very useful info and
more environment variables than I can shake a stick at:
root at xoanon:~# udevadm info /dev/sr0
E: DEVLINKS=/dev/cdrom /dev/cdrw
but in the container, I have a smaller set:
root at test06:~# udevadm info /dev/sr0
My google-fu hasn't been able turn up anything useful as to what I'm missng
or even why udevadm info isn't as forthcoming with information.
Anyone have any ideas or any suggestions as to what secret sauce I might
be missing, or alternatively any suggestions for other command line tools
that can identify the media type? Google searching has really only turned
up the udevadm info command
More information about the linux