How to figure out what device (if any) my DVD drive is assigned to in Debian GNU/Linux
2014-07
I am running stock Debian Jessie and I would like to burn a DVD with xfburn. Problem is that xfburn can't see my DVD drive. e.g. it does not show up under as /dev/scd0 or any other (as far as I can tell).
My DVD drive is a IDE drive who is connected via a IDE/SATA adapter to a internal SATA port. The DVD drive is set to master as stated by the adapters documentation and the adapter is configured correctly.
dmesg | grep NEC does find my dvd drive and it shows up like this:
ata5.00: ATAPI: _NEC DVD_RW ND-3520AW, 2.U5, max UDMA/33
So I am basically pondering: Where do I go from here?!
Edit: Just to clarify, The main intention is to learn "where the chain is broken". I can get the DVD drive to work if I configure the SATA controller for legacy IDE "emulation" it just does not work under AHCI that's all. I replaced the drive with a newer sata version however I would still like how to troubleshoot this.
Try
sudo lshw -businfo
It should appear there. For instance, in my case, I obtain:
lshw -businfo
Bus info Device Class Description
========================================================
system PORTEGE R930 (PT331E)
bus PORTEGE R930
memory 128KiB BIOS
memory 6GiB System Memory
memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
memory 2GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
cpu@0 processor Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
memory 32KiB L1 cache
memory 256KiB L2 cache
memory 4MiB L3 cache
memory 32KiB L1 cache
pci@0000:00:00.0 bridge 3rd Gen Core processor DRAM Controller
pci@0000:00:02.0 display 3rd Gen Core processor Graphics Controller
pci@0000:00:14.0 bus 7 Series/C210 Series Chipset Family USB xHCI Host Controller
pci@0000:00:16.0 communication 7 Series/C210 Series Chipset Family MEI Controller #1
pci@0000:00:16.3 communication 7 Series/C210 Series Chipset Family KT Controller
pci@0000:00:19.0 eth0 network 82579LM Gigabit Network Connection
pci@0000:00:1a.0 bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
pci@0000:00:1b.0 multimedia 7 Series/C210 Series Chipset Family High Definition Audio Controller
pci@0000:00:1c.0 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 1
pci@0000:01:00.0 generic MMC/SD Host Controller
pci@0000:00:1c.1 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 2
pci@0000:00:1c.2 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 3
pci@0000:04:00.0 wlan0 network Centrino Advanced-N 6235
pci@0000:00:1c.5 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 6
pci@0000:00:1d.0 bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
pci@0000:00:1f.0 bridge QM77 Express Chipset LPC Controller
pci@0000:00:1f.2 storage 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
scsi0 storage
scsi@0:0.0.0 /dev/sda disk 256GB TOSHIBA THNSNF25
scsi@0:0.0.0,1 /dev/sda1 volume 27GiB EXT4 volume
scsi@0:0.0.0,2 /dev/sda2 volume 210GiB Extended partition
/dev/sda5 volume 5722MiB Linux swap / Solaris partition
/dev/sda6 volume 204GiB Linux filesystem partition
scsi2 storage
scsi@2:0.0.0 /dev/cdrom disk DVD-RAM UJ8C2
power Lithium Ion Battery
power
wwan0 network Ethernet interface
You see it toward the end. Alternatively, you can use:
lshw -C disk
*-disk
description: ATA Disk
product: TOSHIBA THNSNF25
vendor: Toshiba
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: FSTA
serial: Y2ES102UT5MY
size: 238GiB (256GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 sectorsize=512 signature=0db170df
*-cdrom
description: DVD-RAM writer
product: DVD-RAM UJ8C2
vendor: MATSHITA
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/cdrom
logical name: /dev/sr0
version: 1.00
capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
configuration: ansiversion=5 status=nodisc
which again shows the presence of the cd-rom reader.
Edit:
Before saying that your DVD reader does not work, you should know that a SATA interface can be used with two different protocols, IDE and AHCI. Go to your BIOs and check whether you can change mode to the other one, since the one you have clearly does not work.
Now try lshw again. If it does not appear once again, then it is broken.
The following command may be useful:
$> ls /sys/block/
fd0/ sda/ sr0/
As you can see in the output from my system, fd0 is the floppy drive, sda is the hard drive (you can see it in the dmesg command output). sr0 is my DVD drive (as it's the only other block device present in the PC).
I tested this on a Debian Squeeze, but I think should work the same on Jessie.
I'm trying to do a text search in some files that share a similar directory structure, but are not in the same directory tree, in GNU/Linux.
I have a web server with many sites that share the same tree structure (Code Igniter MVC PHP framework), so I want to search in a specific directory down the tree for each site, example:
/srv/www/*/htdocs/system/application/
Where * is the site name. And from those application directories, I want to search all the tree down to its leaves, for an *.php file that has some text pattern inside, let's say "debug(", no regular expression needed.
I know how to use find and grep but I'm not good at combining them.
How would I do this?
Thanks in advance!
Try
find /srv/www/*/htdocs/system/application/ -name "*.php" -exec grep "debug (" {} \; -print
This should recursively search the folders under application for files with .php extension and pass them to grep.
An optimization on this would be to execute:
find /srv/www/*/htdocs/system/application/ -name "*.php" -print0 | xargs -0 grep -H "debug ("
This uses xargs to pass all the .php files output by find as arguments to a single grep command e.g grep "debug (" file1 file2 file3
. The -print0 option of find and -0 option of xargs ensure the spaces in file and directory names are correctly handled. The -H option passed to grep ensures that the filename is printed in all situations. (By default, grep prints the filename only when multiple arguments are passed in.)
From man xargs:
-0 Input items are terminated by a null character instead of by whitespace, and the quotes and backslash
are not special (every character is taken literally). Disables the end of file string, which is
treated like any other argument. Useful when input items might contain white space, quote marks, or
backslashes. The GNU find -print0 option produces input suitable for this mode.
find
is not even needed for this example, one can use grep
directly (at least GNU grep
):
grep -RH --include='*.php' "debug (" /srv/www/*/htdocs/system/application/
and we are down to a single process fork.