Gangmax Blog

Erase DCD-RW/DVD±RW on Linux

From here and here.

Erasing a BD-RE, DVD-RW, or CD-RW disc 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
32
33
34
35
# 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'
-------------------------------------------------------------------------

# Note: if the command above doesn't work("Cannot open SCSI driver!"),
# use the following ones:
sudo apt-get install lsscsi
lsscsi -g

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

# 4. In case if you run into some error during the blanking process
# you may want to 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
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 disc:

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
18
# 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.
# Note: this is required otherwise the disc cannot be played by CD player.
wodim -v -fix -eject dev='/dev/sr0'

Here is the sample output:

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
> wodim -v -nofix -eject dev='/dev/sg0' -audio -pad *.wav
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
TOC Type: 0 = CD-DA
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: '/dev/sg0'
devname: '/dev/sg0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.36
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type : Removable CD-ROM
Version : 0
Response Format: 2
Capabilities :
Vendor_info : 'TSSTcorp'
Identification : 'DVD+-RW SN-208FB'
Revision : 'D100'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x000A (CD-RW)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0012 (DVD-RAM)
Profile: 0x0011 (DVD-R sequential recording)
Profile: 0x0010 (DVD-ROM)
Profile: 0x000A (CD-RW) (current)
Profile: 0x0009 (CD-R)
Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 342496 = 334 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size : 12582912 = 12288 KB
Track 01: audio 38 MB (03:51.46) no preemp
Track 02: audio 53 MB (05:16.93) no preemp
Track 03: audio 34 MB (03:23.73) no preemp
Track 04: audio 48 MB (04:45.96) no preemp
Track 05: audio 44 MB (04:25.82) no preemp
Track 06: audio 44 MB (04:21.73) no preemp
Track 07: audio 43 MB (04:21.38) no preemp
Track 08: audio 48 MB (04:47.99) no preemp pad
Track 09: audio 13 MB (01:18.73) no preemp pad
Track 10: audio 27 MB (02:41.43) no preemp pad
Track 11: audio 36 MB (03:39.09) no preemp pad
Track 12: audio 30 MB (03:01.68) no preemp pad
Track 13: audio 14 MB (01:25.47) no preemp pad
Track 14: audio 12 MB (01:16.56) no preemp
Track 15: audio 14 MB (01:26.82) no preemp
Track 16: audio 10 MB (01:01.78) no preemp pad
Track 17: audio 7 MB (00:44.80) no preemp
Total size: 528 MB (52:23.46) = 235760 sectors
Lout start: 529 MB (52:25/35) = 235760 sectors
Current Secsize: 2048
ATIP info from disk:
Indicated writing power: 2
Reference speed: 6
Is not unrestricted
Is erasable
Disk sub type: High speed Rewritable (CAV) media (1)
ATIP start of lead in: -12900 (97:10/00)
ATIP start of lead out: 359849 (79:59/74)
1T speed low: 4 1T speed high: 10
2T speed low: 4 2T speed high: 0 (reserved val 6)
power mult factor: 1 5
recommended erase/write power: 5
A1 values: 24 1A D8
A2 values: 26 B2 48
Disk type: unknown dye (reserved id code)
Manuf. index: -1
Manufacturer: unknown (not in table)
Manufacturer is unknown because of the orange forum embargo.
As the orange forum likes to get money for recent information,
it may be that this media does not use illegal manufacturer coding.
Blocks total: 359849 Blocks current: 359849 Blocks remaining: 124089
Speed set to 1764 KB/s
Starting to write CD/DVD at speed 10.0 in real TAO mode for single session.
Last chance to quit, starting real write in 0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
Performing OPC...
Starting new track at sector: 0
Track 01: 38 of 38 MB written (fifo 100%) [buf 100%] 10.1x.
Track 01: Total bytes read/written: 40830720/40830720 (17360 sectors).
Starting new track at sector: 17512
Track 02: 53 of 53 MB written (fifo 100%) [buf 100%] 10.3x.
Track 02: Total bytes read/written: 55907040/55907040 (23770 sectors).
Starting new track at sector: 41434
Track 03: 34 of 34 MB written (fifo 100%) [buf 100%] 10.1x.
Track 03: Total bytes read/written: 35938560/35938560 (15280 sectors).
Starting new track at sector: 56866
Track 04: 48 of 48 MB written (fifo 100%) [buf 100%] 10.7x.
Track 04: Total bytes read/written: 50443344/50443344 (21447 sectors).
Starting new track at sector: 78465
Track 05: 44 of 44 MB written (fifo 100%) [buf 100%] 10.7x.
Track 05: Total bytes read/written: 46891824/46891824 (19937 sectors).
Starting new track at sector: 98554
Track 06: 44 of 44 MB written (fifo 100%) [buf 100%] 10.7x.
Track 06: Total bytes read/written: 46169760/46169760 (19630 sectors).
Starting new track at sector: 118336
Track 07: 43 of 43 MB written (fifo 100%) [buf 100%] 10.4x.
Track 07: Total bytes read/written: 46108608/46108608 (19604 sectors).
Starting new track at sector: 138092
Track 08: 48 of 48 MB written (fifo 100%) [buf 100%] 10.7x.
WARNING: padding up to secsize.
Track 08: Total bytes read/written: 50801648/50803200 (21600 sectors).
Starting new track at sector: 159844
Track 09: 13 of 13 MB written (fifo 100%) [buf 100%] 10.6x.
WARNING: padding up to secsize.
Track 09: Total bytes read/written: 13888700/13890912 (5906 sectors).
Starting new track at sector: 165902
Track 10: 27 of 27 MB written (fifo 100%) [buf 100%] 10.5x.
WARNING: padding up to secsize.
Track 10: Total bytes read/written: 28477628/28478016 (12108 sectors).
Starting new track at sector: 178162
Track 11: 36 of 36 MB written (fifo 100%) [buf 100%] 10.1x.
WARNING: padding up to secsize.
Track 11: Total bytes read/written: 38647484/38648064 (16432 sectors).
Starting new track at sector: 194746
Track 12: 30 of 30 MB written (fifo 100%) [buf 100%] 10.2x.
WARNING: padding up to secsize.
Track 12: Total bytes read/written: 32048828/32050704 (13627 sectors).
Starting new track at sector: 208525
Track 13: 14 of 14 MB written (fifo 100%) [buf 100%] 10.3x.
WARNING: padding up to secsize.
Track 13: Total bytes read/written: 15077564/15078672 (6411 sectors).
Starting new track at sector: 215088
Track 14: 12 of 12 MB written (fifo 100%) [buf 100%] 10.3x.
Track 14: Total bytes read/written: 13505184/13505184 (5742 sectors).
Starting new track at sector: 220982
Track 15: 14 of 14 MB written (fifo 100%) [buf 100%] 10.3x.
Track 15: Total bytes read/written: 15316224/15316224 (6512 sectors).
Starting new track at sector: 227646
Track 16: 10 of 10 MB written (fifo 100%) [buf 100%] 10.3x.
WARNING: padding up to secsize.
Track 16: Total bytes read/written: 10898108/10899168 (4634 sectors).
Starting new track at sector: 232432
Track 17: 7 of 7 MB written (fifo 100%) [buf 100%] 10.7x.
Track 17: Total bytes read/written: 7902720/7902720 (3360 sectors).
Writing time: 421.465s
Average write speed 7.6x.
Min drive buffer fill was 99%
BURN-Free was never needed.
wodim: fifo had 8651 puts and 8651 gets.
wodim: fifo was 0 times empty and 8399 times full, min fill was 97%.

> wodim -v -fix -eject dev='/dev/sr0'
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type : Removable CD-ROM
Version : 0
Response Format: 2
Capabilities :
Vendor_info : 'TSSTcorp'
Identification : 'DVD+-RW SN-208FB'
Revision : 'D100'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x000A (CD-RW)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0012 (DVD-RAM)
Profile: 0x0011 (DVD-R sequential recording)
Profile: 0x0010 (DVD-ROM)
Profile: 0x000A (CD-RW) (current)
Profile: 0x0009 (CD-R)
Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 342496 = 334 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
Current Secsize: 2048
ATIP info from disk:
Indicated writing power: 2
Reference speed: 6
Is not unrestricted
Is erasable
Disk sub type: High speed Rewritable (CAV) media (1)
ATIP start of lead in: -12900 (97:10/00)
ATIP start of lead out: 359849 (79:59/74)
1T speed low: 4 1T speed high: 10
2T speed low: 4 2T speed high: 0 (reserved val 6)
power mult factor: 1 5
recommended erase/write power: 5
A1 values: 24 1A D8
A2 values: 26 B2 48
Disk type: unknown dye (reserved id code)
Manuf. index: -1
Manufacturer: unknown (not in table)
Manufacturer is unknown because of the orange forum embargo.
As the orange forum likes to get money for recent information,
it may be that this media does not use illegal manufacturer coding.
Speed set to 1764 KB/s
Starting to write CD/DVD at speed 10.0 in real TAO mode for single session.
Last chance to quit, starting real write in 0 seconds. Operation starts.
Performing OPC...
Fixating...
Fixating time: 39.315s
BURN-Free was never needed.

Comments