chlw的原创笔记 https://bbs.21ic.com/?111401 [收藏] [复制] [RSS] 本人做单片机、ARM的软硬件件开发,有一定的奉献精神,会不定时的将开发中的收获整理以方便家,希望我的工作能对同行有所帮助。  本站大部分作品为原创,若要转载请注明站点和作者(EE.C)

日志

在LINUX下把文件刻录到光盘上

已有 566 次阅读2012-9-1 14:49 |系统分类:兴趣爱好| LINUX

LINUX下把文件刻录到光盘上


13.3.2. Using CD-Rs and CD-RWs with Command Line Tools


There are two shell prompt applications used to write image to CDs and DVDs: mkisofs and


cdrecord. These utilities have several advanced options that are beyond the scope of this guide;


however, for basic image creation and writing, these tools save some time over the graphical


alternatives such as CD/DVD Creator.


13.3.2.1. Using mkisofs


The mkisofs utility creates ISO9660 image _les that can be written to a CD or DVD. The images


created by mkisofs can include all types of _les. It is most useful for archival and _le backup purposes.


For CDs, make sure that the total data to be written is less than 760MB. For DVDs, make sure


that it is less than 4.7GB of data.


Suppose you wish to backup a directory called /home/user/, but exclude the subdirectory


/home/user/junk/ because it contains unnecessary _les. You want to create an ISO image called


backup.iso and write it to CD or DVD. Backing up your data as an ISO9660 image is useful in


that it can be read by both Red Hat Enterprise Linux and Windows systems. This can be done with


mkisofs by running the following command:


mkisofs -o backup.iso -x /home/joeuser/junk/ -J -R -A -V -v /home/joeuser/


The image is created in your current working directory. Table 13-1 explains each command


line option. For more information on using mkisofs, refer to the additional resources in


Section 13.4 Additional Resources.


You can now use the ISO image _le with cdrecord, the command line based CD recording utility.


For more information about using cdrecord, refer to Section 13.3.2.2 Using cdrecord.


Option


-o Speci_es an output _le name of the ISO image.


-J Generates Joliet naming records; useful if the CD is used in


Windows environments.


-R Generates Rock Ridge (RR) naming records to preserve _lename


length and casing, especially for UNIX/Linux environments.


Chapter 13. Diskettes and CD-ROMs 119


Option


-A Sets an Application ID . a text string that will be written into


the volume header of the image which can be useful to determine


what applications are on the CD.


-V Sets a Volume ID. a name that is assigned to it if the image is


burned, and the disc is mounted in Solaris and Windows


environments.


-v Sets verbose execution, which is useful for viewing the status of


the image as it is being made.


-x Excludes any directory immediately following this option; this


option can be repeated (for example, ... -x /home/joe/trash -x


/home/joe/delete ...).


Table 13-1. mkisofs Options


13.3.2.2. Using cdrecord


The cdrecord utility writes audio, data, and mixed-mode (a combination of audio, video, and/or


data) CDs and DVDs using options to con_gure several aspects of the write process, including speed,


device, and data settings.


To use cdrecord, you must _rst establish the device address of your CD or DVD device by running


the following command as root at a shell prompt:


cdrecord -scanbus


This command shows all CD and DVD devices on your computer. It is important to remember the


device address of the device used to write your CD. The following is an example output from running


cdrecord -scanbus.


Cdrecord 1.8 (i686-pc-linux-gnu) Copyright (C) 1995-2000 Jorg Schilling


Using libscg version 'schily-0.1'


scsibus0:


0,0,0 0) *


0,1,0 1) *


0,2,0 2) *


0,3,0 3)'HP ' 'CD-Writer+ 9200 ' '1.0c' Removable CD-ROM


0,4,0 4) *


0,5,0 5) *


0,6,0 6) *


0,7,0 7) *


To write the backup _le image created with mkisofs in the previous section, switch to the root user


and type the following at a shell prompt:


cdrecord -v -eject speed=4 dev=0,3,0 backup.iso


The command sets the write speed (4), the device address (0,3,0), and sets write output (verbose [-v]),


which is useful for tracking the status of the write process. The -eject argument ejects the media


after the write process is complete. The same command can also be used for burning ISO image _les


downloaded from the Internet, such as Red Hat Enterprise Linux ISO images.


You can use cdrecord to blank CD-RW or DVD-RW discs for reuse by typing the following:


cdrecord --dev=0,3,0 --blank=fast


 


以上来自Redhat的手册。本文对手册中未提到但在使用中出现的现象进行说明。


1    生成ISO文件时 长文件件名会被短文件名替换,例如:


Using EBIKE00B.ZIP;1 for  um762/elec/v0.04/History/EBIKECONTROLER.~(17).PRJPCB.Zip


但是生成的ISO文件被挂载或被刻录到光盘后,文件名被复原(太长的一定会有限制,没有测试,但我用的已经很长了,它还是能复原的),故不用担心mkisofs输出的警告信息。(你可以把原目录与刻录到光盘的目录进行逐一对比)。


2    使用cdrecordISO文件刻录到光盘上 如果你只有一个刻录机,可以不用指定device;如果默认的刻录模式不行,试试另外一个,可在taosao两者中选一个;输出speed=0,让刻录机以最低的速度刻录。


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)