Burning CD/DVD using CLI in linux (redhat/debian/ubuntu)

Posted by Md. Mahidul Hasan on 12:06 PM with No comments
Burning CD/DVD using CLI:
1. find cdrom/dvdrom
2. make an iso
    i. create an iso
    ii. create an iso from collecting data from diffrent location
    iii. add new data to an existence iso
3. burn the disk (cd/dvd)
    i. single session burning
    ii. Multi-session burning
    iii. Blank a disk for re-writing cd/dvd (re-writable disk)


1. First findout the cd drive. Here my cd/dvd rom is dev=1,0,0
root@mahidul:~# cdrecord --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sg1'    rwrw-- : 'hp' 'DVDRAM GT80N'
-------------------------------------------------------------------------

"OR"
root@mahidul:~# cdrecord -scanbus
scsibus0:
    0,0,0      0) 'ATA     ' 'Hitachi HTS54757' 'JE4O' Disk
    0,1,0      1) *
    0,2,0      2) *
    0,3,0      3) *
    0,4,0      4) *
    0,5,0      5) *
    0,6,0      6) *
    0,7,0      7) *

scsibus1:
    1,0,0    100) 'hp      ' 'DVDRAM GT80N    ' 'R102' Removable CD-ROM
    1,1,0    101) *
    1,2,0    102) *
    1,3,0    103) *
    1,4,0    104) *
    1,5,0    105) *
    1,6,0    106) *
    1,7,0    107) *


2. Then make an iso of the folder that you want to write.
root@mahidul:~# mkisofs -J -r -o /storage/cdwrite.iso /storage/cdwrite/

If -joliet-long error shows then use below command.
root@mahidul:~# mkisofs -joliet-long -r -o /storage/cdwrite.iso /storage/cdwrite/

You can make an iso from diffrent locations.
root@mahidul:~# mkisofs -J -r -o  /root/testburn.iso -graft-points /folder1=/var/log/test.log /folder2=/home/mahidul/DSC_9881_20131111_140755.jpg

You can add folders/files later like the below step.

3. Now, Burn the cd with cdrecord command.
root@mahidul:~# cdrecord -v -dev='/dev/sg1' /storage/cdwrite.iso

"OR"
root@mahidul:~# cdrecord -v -dao dev=1,0,0 /storage/cdwrite.iso

"OR" Using wodim (Write Optical DIsc Media):
root@mahidul:~# wodim -eject -tao speed=1 dev=/dev/sg1 -v -data /storage/cdwrite.iso

Write multiple times to a re-writable disk:
root@mahidul:~# cdrecord -v -multi -eject -tao speed=1 -dev='/dev/sg1' /storage/cdwrite.iso

Note:
1. The programs wodim, cdrskin, and xorrecord may be used on all kinds of media with the options shown with "cdrecord".
2. The meaning of the options is:
    -V: Gives the filesystem a name which will probably show up as mount point if the medium is mounted automatically. The ISO specs allow             only "A" to "Z", "0" to "9", and "_". 32 characters at most.
    -J: Prepares names of up to 64 UTF-16 characters for MS-Windows readers. Aka "Joliet".
    -joliet-long: Would allow 103 UTF-16 characters for MS-Windows readers. Not conformant to Joliet specs.
    -r: Prepares names of up to 255 characters for Unix readers and gives read permission for everybody. Aka "Rock Ridge".
    -o: Sets the file path for the resulting ISO image.