Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A way to check if there is a dvd-ram in the device

Status
Not open for further replies.

svnhunix

Technical User
Mar 27, 2008
34
0
0
BE
Hello

I was looking for a simple check (command) to see there is a dvd-ram (or other media) in the /dev/cdx.
For example, with a tape drive I would do a rewind. If that command goes well, there is a tape available in the drive. I would like to be able to do something simular with a CD/DVD.

Steven
 
What if you read 1 block of data from the device and check result code?

[tt]dd if=/dev/cd0 of=/dev/null bs=512 count=1 2>/dev/null
if [ $? -ne 0 ]
then
echo empty
fi[/tt]

(I have not tried that out, mind you)


HTH,

p5wizard
 
Try it also with an empty DVD-RAM disk though.

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top