Hi, > how can I check if a medium has never been burnt, i.e. is ready for > burning?
Both states are not equivalent on media level. A new BD-RE for example is not ready for burning until you format it. Burn programs are supposed to detect that state and to apply formatting on the first write attempt, though. Vice versa, written DVD+RW, DVD-RAM, BD-RE and formatted DVD-RW are ready for burning although they are not new or blank. With other media there are states which allow to append sessions to written media. It looks like a necessary condition for the desired state is that MMC command READ CAPACITY returns 0 bytes of size. That would include blanked (non-new) CD-RW and DVD-RW. If you restrict your media zoo to sequential one-time media CD-R, DVD-R, DVD+R, BD-R, then READ CAPACITY 0 should be equivalent to "never burnt" (except ill burnt media perhaps). How to inquire READ CAPACITY ? The block device driver probably uses that command to learn the device size. So on shell level one could do this: dd if=/dev/sr0 bs=2048 count=1 2>/dev/null | \ wc | fgrep 2048 >/dev/null \ || echo "Empty media found" On Linux kernel level there is #include <linux/fs.h> fd = open("/dev/sr0", O_RDONLY); ioctl(fd, BLKGETSIZE, &blocks); Have a nice day :) Thomas -- To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@other.debian.org