When I burn a DVD with Brasero, it asks me whether I want to close the DVD after burn or leave it open to add files later.
How do I check whether a DVD is read-only or it's still writable? I am talking of course of DVD-R, not DVD-RW disks.
I am looking for some kind of console command to check whether the disk is closed or not.
You can use
cdrskin
to get this information. Here are the two options that might be of use (fromman cdrskin
, emphasis mine):The manpage also has a list of examples, one of which shows the use of
-msinfo
:To sum it up, you should be able to test for a CD/DVD to be appendable with the following script:
Oneliner version:
cdrskin
takes the default drive which should be fine for nearly everyone. If it uses the wrong device, specify it explicitly with the option e.g.dev=/dev/sr1
. If in doubt you can display information about a device with the option-checkdrive
.dessert's test exactly answers David's question.
But as said im my comment, we have three possible states for DVD-R. To distinguish them all, one may use cdrskin option
-minfo
. (Note well:-minfo
without the "s" of-msinfo
.)This should yield 4 possible text results on standard output.
With a blank medium (unused and writable):
With an appendable medium (written and still writable):
With a closed medium (written and not writable any more):
As fourth possible result, if something goes wrong with accessing the medium, no text at all will appear. In this case you should repeat the run without
2>/dev/null | grep '^disk status:'
in order to see all messages.(I use
/dev/sr0
in the example, because/dev/hdc
is out of fashion as device name since at least kernel version 3.)