Mastering the 'wodim' Command for CD/DVD Recording (with examples)
- Linux
- December 17, 2024
The ‘wodim’ command is a powerful utility for recording data to CDs and DVDs. It is often aliased as ‘cdrecord’ on some systems and is popular among users who need to archive data onto optical media. The command offers various functionalities, including listing available optical drives, burning audio-only discs, and recording data files onto discs. It’s important to use ‘wodim’ with caution, as some invocations can lead to destructive actions like erasing all data on a disc. Here’s how you can utilize ‘wodim’ for different tasks.
Use case 1: Display optical drives available to wodim
Code:
wodim --devices
Motivation:
Before burning data onto a CD or DVD, it’s essential to know which optical drives are available for use. This command helps you identify the correct device path to ensure you’re recording to the right drive. Misidentifying the drive could lead to wasted resources or data being written to the wrong place.
Explanation:
--devices
: This argument instructs ‘wodim’ to scan the system for available optical drives. It’s a non-destructive operation meant purely for information gathering.
Example output:
wodim: Overview of accessible drives (1 found) – >
0 dev='/dev/sr0'
This output indicates there’s one accessible optical drive available at the device path /dev/sr0
.
Use case 2: Record (“burn”) an audio-only disc
Code:
wodim dev=/dev/optical_drive -audio track*.cdaudio
Motivation:
When you want to create an audio CD from a collection of audio files, this command sequence gets the job done efficiently. It’s a handy use for preserving music tracks in a format that can be readily played in standard CD players.
Explanation:
dev=/dev/optical_drive
: Specifies the device path for the optical drive to be used for recording.-audio
: Tells ‘wodim’ that the tracks to be burned are audio files.track*.cdaudio
: A wildcard pattern that includes all audio files with the.cdaudio
extension, allowing you to record multiple tracks at once.
Example output:
Track 01: Audio 12 MB [02:34.10]
Track 02: Audio 34 MB [05:07.64]
...
Recording completed successfully.
This feedback specifies each track’s size and duration, followed by a successful recording confirmation.
Use case 3: Burn a file to a disc, ejecting the disc once done
Code:
wodim -eject dev=/dev/optical_drive -data file.iso
Motivation:
This command is useful when you want to create a data disc from an ISO file. Opting for an automatic ejection allows for easy retrieval once burning is complete, which is particularly helpful in batch operations or when dealing with high-volume tasks.
Explanation:
-eject
: Instructs the system to eject the disc from the drive after the burning process finishes, which is convenient for users who are multitasking or managing multiple operations.dev=/dev/optical_drive
: Designates the optical drive to be used.-data
: Indicates that the type of content being burned is data as opposed to an audio track.file.iso
: Represents the ISO file that is to be burned onto the disc.
Example output:
Speed set to 4x
Starting data disk...
ejecting media...
Data disk burned successfully.
The output details the burning speed, confirms the data disc creation, and states that the disc has been ejected from the drive.
Use case 4: Burn a file to the disc in an optical drive, potentially writing to multiple discs in succession
Code:
wodim -tao dev=/dev/optical_drive -data file.iso
Motivation:
This command is ideal when needing to produce multiple copies of the same data disc. It uses the Track-At-Once (TAO) mode, which allows for successive disc writing without the need for additional, specialized hardware.
Explanation:
-tao
: Selects the Track-At-Once writing mode, which writes one track at a time and allows for the burning of multiple tracks or data blobs in sequence.dev=/dev/optical_drive
: Identifies the specific drive for operations.-data
: Specifies that the content to be burned is data.file.iso
: The ISO file data source.
Example output:
Writing in TAO mode
Track 01: Total data length 15000 MB
Performing OPC (Optimum Power Calibration)...
Writing lead-in and lead-out
Operation completed successfully.
The output informs the user of the TAO mode initiation, confirms data length, and announces successful completion of the operation.
Conclusion:
The ‘wodim’ command is versatile in its capacity to manage various CD/DVD burning tasks, whether identifying available optical drives or executing complex data-recording operations. Understanding each command’s arguments and their roles will make the process smoother and help avoid errors or potential data loss. With these examples, users can confidently employ ‘wodim’ for both their everyday and specialized optical media needs.