Linux命令行刻录光盘、光盘转ISO文件、校验光盘

版权声明:本文为博主原创文章,转载请注明出处,谢谢合作! https://blog.csdn.net/sch0120/article/details/71429490

准备工作

需要准备以下环境:
- 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

猜你喜欢

转载自blog.csdn.net/sch0120/article/details/71429490
今日推荐