Linux命令行刻錄光盤、光盤轉ISO文件、校驗光盤

準備工作

需要準備以下環境:
- Linux(本文以Fedora25爲例)
- CD/DVD刻錄機
- DVD-R刻錄光盤或DVD-RW可擦寫光盤一張
- 刻錄軟件cdrecord(推薦刻錄CD)
- 刻錄軟件growisofs(推薦刻錄DVD)

使用cdrecord

刻錄軟件cdrecordwodim,它常被用來刻錄CD光盤,當然也可以刻錄DVD光盤。

安裝軟件

[root@dhcp-14-171 ~]# yum install -y cdrecord

刻錄光盤

驗證光盤(僅可擦寫光盤)

如果光盤有內容,最好先確認一下。

擦除數據(僅可擦寫光盤)

[root@dhcp-14-171 ~]# umount /dev/cdrom
[root@dhcp-14-171 ~]# cdrecord --dev=/dev/cdrom --blank=fast
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   : 
Vendor_info    : 'PLDS    '
Identification : 'DVD-RW DH16AFSH '
Revision       : 'DL31'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc DVD-R(W) driver (mmc_mdvd).
Driver flags   : SWABAUDIO BURNFREE 
Supported modes: PACKET SAO
Speed set to 2770 KB/s
Starting to write CD/DVD at speed   2.0 in real BLANK mode for single session.
Last chance to quit, starting real write in    0 seconds. Operation starts.
[root@dhcp-14-171 ~]# 

刻錄光盤

將鏡像文件RHEL5.11-Server-20140827.0-x86_64-DVD.iso刻錄到光盤:

[root@dhcp-14-171 ~]# cdrecord -v -eject dev=/dev/cdrom /home/cheshi/Downloads/RHEL5.11-Server-20140827.0-x86_64-DVD.iso
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
TOC Type: 1 = CD-ROM
scsidev: '/dev/cdrom'
devname: '/dev/cdrom'
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        : 5
Response Format: 2
Capabilities   : 
Vendor_info    : 'PLDS    '
Identification : 'DVD-RW DH16AFSH '
Revision       : 'DL31'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x0011 (DVD-R sequential recording)
Profile: 0x002B (DVD+R/DL) 
Profile: 0x001B (DVD+R) 
Profile: 0x001A (DVD+RW) 
Profile: 0x0016 (DVD-R/DL layer jump recording) 
Profile: 0x0015 (DVD-R/DL sequential recording) 
Profile: 0x0014 (DVD-RW sequential recording) 
Profile: 0x0013 (DVD-RW restricted overwrite) 
Profile: 0x0012 (DVD-RAM) 
Profile: 0x0011 (DVD-R sequential recording) (current)
Profile: 0x0010 (DVD-ROM) 
Profile: 0x000A (CD-RW) 
Profile: 0x0009 (CD-R) 
Profile: 0x0008 (CD-ROM) 
Profile: 0x0002 (Removable disk) 
Using generic SCSI-3/mmc DVD-R(W) driver (mmc_mdvd).
Driver flags   : SWABAUDIO BURNFREE 
Supported modes: PACKET SAO
Drive buf size : 262144 = 256 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size      : 4194304 = 4096 KB
Track 01: data  4239 MB        
Total size:     4868 MB (482:19.52) = 2170464 sectors
Lout start:     4868 MB (482:21/39) = 2170464 sectors
Current Secsize: 2048
HINT: use dvd+rw-mediainfo from dvd+rw-tools for information extraction.
Blocks total: 2298496 Blocks current: 2298496 Blocks remaining: 128032
Speed set to 22160 KB/s
Starting to write CD/DVD at speed  17.0 in real unknown 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: 4239 of 4239 MB written (fifo 100%) [buf  95%]   8.4x.
Track 01: Total bytes read/written: 4445110272/4445110272 (2170464 sectors).
Writing  time:  477.486s
Average write speed   7.0x.
Min drive buffer fill was 93%
Fixating...
Fixating time:    9.140s
wodim: fifo had 70015 puts and 70015 gets.
wodim: fifo was 0 times empty and 21105 times full, min fill was 90%.
[root@dhcp-14-171 ~]# 

使用growisofs

刻錄軟件growisofs更加專注於刻錄DVD光盤,它對DVD的支持比wodim更加出色。

安裝軟件

[root@dhcp-1-202 nfs_path]# dnf search growisofs
[root@dhcp-1-202 nfs_path]# dnf install cdw.x86_64

刻錄光盤

[root@dhcp-1-202 nfs_path]# growisofs -dvd-compat -Z /dev/sr0=/root/Win10_1511_Chinese\(Simplified\)_x64.iso 
Executing 'builtin_dd if=/root/Win10_1511_Chinese(Simplified)_x64.iso of=/dev/sr0 obs=32k seek=0'
/dev/sr0: "Current Write Speed" is 16.4x1352KBps.
     294912/4187224064 ( 0.0%) @0.0x, remaining 946:28 RBU 100.0% UBU   0.0%
   20676608/4187224064 ( 0.5%) @4.4x, remaining 23:30 RBU 100.0% UBU  98.4%
......
 4157276160/4187224064 (99.3%) @15.4x, remaining 0:02 RBU 100.0% UBU  94.5%
builtin_dd: 2044544*2KB out @ average 10.6x1352KBps
/dev/sr0: flushing cache
/dev/sr0: updating RMA
/dev/sr0: closing disc
/dev/sr0: reloading tray
[root@dhcp-1-202 nfs_path]# 

光盤轉ISO文件

在Linux下,光盤轉ISO文件非常簡單,只需要使用系統自帶的dd命令即可完成。

[root@dhcp-14-171 ~]# dd if=/dev/cdrom of=/root/temp.iso
8681856+0 records in
8681856+0 records out
4445110272 bytes (4.4 GB, 4.1 GiB) copied, 299.322 s, 14.9 MB/s

注意:如果刻錄光盤時沒有添加-eject參數,那麼刻錄完成後光盤將不會自動彈出。如果光盤沒有被重新插入,那麼dd命令可能無法正確工作,這時並不能說明是光盤有問題。所以,建議大家在進行後續操作之前,一定要推出並重新插入光盤。

校驗光盤

我們可以使用md5sum等工具對新生成的ISO文件進行比對。

[root@dhcp-14-171 ~]# md5sum /root/temp.iso /home/cheshi/Downloads/RHEL5.11-Server-20140827.0-x86_64-DVD.iso
5f83a3849aa0aaeacdf6430e54ddb1da  /root/temp.iso
5f83a3849aa0aaeacdf6430e54ddb1da  /home/cheshi/Downloads/RHEL5.11-Server-20140827.0-x86_64-DVD.iso

總結

對於刻錄光盤的總結:
1. RedHat Linux下可以通過cdrecordgrowisofs命令刻錄光盤,刻錄完成後最好推出並重新插入光盤。
2. 使用ddmd5sum命令可以校驗光盤。
3. 刻錄CD光盤推薦使用cdrecord,刻錄DVD光盤推薦使用growisofs

發佈了83 篇原創文章 · 獲贊 99 · 訪問量 62萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章