Home‎ > ‎Burning CD/DVD‎ > ‎

Blanking CD / DVD from command line

To blank the CD / DVD RW medium in Ubuntu, I use application called wodim, first find out name of your dev for optical drive, easy way is to use 

$ wodim --devices

wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sg1' rwrw-- : 'hp' 'BDDVDRW CT21L'
-------------------------------------------------------------------------

Then use this command to blank your CD / DVD disk: 

$ wodim -vv dev=/dev/sg1 blank=fast

Instead of blank=fast, use rather blank=all if you want to erase entire disk, not just PMA and TOC, but for most of us fast is the faster and better option. -v option will increment the level of verbosity by one, -vv is very verbose, see $ man wodim for more information.

This is sample output for blank=all:

$ wodim -vv dev=/dev/sg1 blank=all
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: '/dev/sg1'
devname: '/dev/sg1'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.34
Wodim version: 1.1.11
Using libusal version 'Cdrkit-1.1.11'.
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   : 
Vendor_info    : 'hp      '
Identification : 'BDDVDRW CT21L   '
Revision       : '1.02'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x0014 (DVD-RW sequential recording)
Profile: 0x0040 (BD-ROM) 
Profile: 0x0012 (DVD-RAM) 
Profile: 0x002B (DVD+R/DL) 
Profile: 0x001B (DVD+R) 
Profile: 0x001A (DVD+RW) 
Profile: 0x0016 (DVD-R/DL layer jump recording) 
Profile: 0x0015 (DVD-R/DL sequential recording) 
Profile: 0x0014 (DVD-RW sequential recording) (current)
Profile: 0x0013 (DVD-RW restricted overwrite) (current)
Profile: 0x0011 (DVD-R sequential recording) 
Profile: 0x0010 (DVD-ROM) 
Profile: 0x000A (CD-RW) 
Profile: 0x0009 (CD-R) 
Profile: 0x0008 (CD-ROM) 
Profile: 0x0002 (Removable disk) 
Using Session At Once (SAO) for DVD mode.
Drive current speed: 4
Drive default speed: 4
Drive max speed    : 4
Selected speed     : 4
Using generic SCSI-3/mmc DVD-R(W) driver (mmc_mdvd).
Driver flags   : SWABAUDIO BURNFREE 
Supported modes: PACKET SAO
Drive buf size : 1409024 = 1376 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
Track 1 start -150
Current Secsize: 2048
HINT: use dvd+rw-mediainfo from dvd+rw-tools for information extraction.
Speed set to 5540 KB/s
Starting to write CD/DVD at speed   4.0 in real BLANK mode for single session.
Last chance to quit, starting real write in    0 seconds. Operation starts.
Performing OPC...
Blanking entire disk
Blanking time: 1000.118s

Mounting and unmounting

In Ubuntu, if you have loaded GUI like Unity, it automatically mounts inserted media so after blanking your media disk, unmount it, eject and reapply to have a blank disk ready for use.

$ mount 

Command mount lists all mounted media, look for your DVD, in my case it is /dev/sr0, type iso9660. Use umount to unmount this media.

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/dev/sr0 on /media/Data disc (04 Nov 13) type iso9660 (ro,nosuid,nodev,uid=1001,gid=1001,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks)

$ umount /dev/sr0

Wodim is in main repositories, to install wodim use:

 $ sudo apt-get install wodim