Gangmax Blog

Erase DVD/CD-RW from Linux Command Line

From here and here.

Erasing a BD-RE, DVD-RW, or CD-RW disk on a Linux system can be as easy as entering one line command using the “wodim“ utility.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 1. Install.
sudo apt install wodim

# 2. Identify the CD/DVD block device file name.
wodim --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
0 dev='/dev/scd0' rwrw-- : 'TSSTcorp' 'CD/DVDW SH-S183L'
-------------------------------------------------------------------------

# 3. Use the "fast" method to erase the disk.
wodim -v blank=fast dev=/dev/scd0

# 4. In case if you run into some error during the blanking process
# you may tryto include a "-force" option.
wodim -v -force blank=fast dev=/dev/scd0

# In case you prefer a different method, you can see the other blanking
# methods with the following command:
wodim blank=help
Blanking options:
all blank the entire disk
disk blank the entire disk
disk blank the entire disk
fast minimally blank the entire disk (PMA, TOC, pregap)
minimal minimally blank the entire disk (PMA, TOC, pregap)
track blank a track
unreserve unreserve a track
trtail blank a track tail
unclose unclose last session
session blank last session

“wodim” can also be used to write data to CD/DVD. For example, write an “iso” image file to disk:

1
2
# Burn your ISO image to the CD/DVD.
wodim -v dev=/dev/sg1 speed=10 -eject "path-to-iso"

You can also use “wodim” to write audio CD with the following steps. From here and here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 1. Install packages.
sudo apt install wodim ffmpeg normalize-audio

# 2. Normalize audio files.
for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done
for i in $( ls ); do ffmpeg -i $i $i.wav; done
normalize-audio -m *.wav


# 3. Confirm the optical drive's device name.
wodim dev=/dev/sr0 --scanbus

# 4. Write "wav" files to CD-RW disk.
wodim -v -nofix -eject dev='/dev/sr0' -audio -pad *.wav

# 5. Close session.
wodim -v -fix -eject dev='/dev/sr0'

Comments