Erase a CD-RW in ‘Linux’ (Command-line)

I have a USB DVD writer (Imation ‘Slimtype’) and the other day I tried to erase a CD-RW that I haven’t really used in a few months using Brasero DiscBurner (in Ubuntu 15.10). It had some data on it and the file manager was able to mount it, but Brasero for some reason failed to even recognize that a CD was present in the DVD burner, let along erasing it.

Now I’m sure I could’ve done it by using a different disc burning GUI, but I’m a bit of a lazy bugger 😉 so I tried to erase the CD-RW using the command-line. For that I used a program called ‘wodim’ (it’s included by default in many GNU/Linux distributions) and it did the trick.

In this post I’ll share with you what I did (it’s quite simple actually) in case you come across a similar situation where the GUI fails you.


Step 1:

First attach (if it’s a removable) the disc burner device to your computer, then insert the CD-RW. Once it’s loaded, open the terminal window and enter the below command (we’re simply trying to find the device address of the disc burner):

wodim --devices

The command might take a couple of seconds to finish, once it finishes, take a look at the output and ‘wodim‘ will give you the device path (in this case it’s ‘/dev/sg1’) and a small description (usually the model name) of the hardware.


If you have multiple devices attached, choose the correct one before moving on to the next section.

Step 2:

Since now we know the device path, we can now go ahead and erase the CD-RW. This will erase all the data on it, so if you want to backup something, this will be your last chance.

When it comes to erasing a CD-RW, we can use two options (there are few others actually, but these two are the most common erasing methods). The first one is the ‘fast’ option (which doesn’t actually erase the whole disc and simply clears out the ‘metadata’. This is the fastest method and in most cases, it should be enough).

The second option is the ‘all’ method which will fully erase the whole disc but it’s slow compared to the ‘fast’ method (it can last couple of minutes, depending on the speed of your CD-RW).

[ms_alert icon=”fa-hand-paper-o” background_color=”#f5f5f5″ text_color=”” border_width=”0px” border_radius=”0px” box_shadow=”no” dismissable=”no” class=”” id=””]If you come across write or read failures after using the ‘fast’ blank method, then re-erase the disc with the ‘all’ method.[/ms_alert]

If you want to get a list of all the available blanking methods, use the below command:

wodim blank=help

In my case, I just erased it with ‘fast’ method and for that I used the below command:

wodim blank=fast dev=/dev/sg1 -v

Make sure to replace the ‘/dev/sg1‘ with your device’s address and, from ‘fast‘ to ‘all‘, if necessary.

wodim will notify you when it’s done with the blanking. Afterwards you can either use wodim to write files to the disc (which is what I did) or you can use the GUI since adding multiple files to the burning list is easy with GUI tools.


Well, that’s it. Good luck.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

6 thoughts on “Erase a CD-RW in ‘Linux’ (Command-line)”

  1. Thanks a lot. This method worked perfectly. I had tried to erase the cd (full method), but about halfway through the record it was interrupted because there was dirt that I didn’t notice. After cleaning the disc I tried again with Brasero but it stopped immediately. So I tried this solution and I recovered the disk. Thanks for sharing.

  2. I keep getting-
    wodim: Operation not permitted. Warning: cannot raise RLIMIT_MEMLOCK limits.
    What does this mean? I tried both ‘fast’ and ‘all’ and got the same thing.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.