Linux下iso的制作与刻录


1、检验下载好了的ISO镜像的MD5值:
  $ md5sum download.iso
  2、刻录ISO:
  1)先下载cdrecord:
  $sudo apt-get install cdrecord
  2)寻找设备(刻录机):
  $ cdrecord --scanbus (这会给出类似这样的一组数字:0,0,0)
  3)开始刻录:
  $ cdrecord dev=0,0,0 download.iso
  3、检验已经刻录好的光盘的md5值:
  (确保安装了isoinfo 没有的话apt-get~~~)
  $ isoinfo -d -i /dev/cdrom
  (查看光盘信息,会出现如下字样: Logical block size is: 2048 Volume size is: 339344)
  $ dd if=/dev/cdrom bs=2048 count=339344 conv=notrunc,noerror|md5sum
  制作ISO镜像
  ===========
  mkisofs -J -T -R -V volume_id -o mycd.iso source_dir
  mkisofs 主要参数说明:
  -J/-joliet 使用 Joliet 格式的目录与文件名称
  -T/-translation-table 为每个目录都生成一个 TRANS.TBL 文件名转换表文件
  -R/-rock 使用 Rock Ridge Extensions
  -V/-volid <光盘ID> 指定光盘的卷标ID
  制作具有自我校验功能的光盘
  ==========================
  ISO文件在网络传输过程中可能会发生改变,这个可以通过MD5校验码来检测文件的完整性,即:发布ISO的同时也公布其MD5校验码,这样他人下载 ISO后,再进行一次MD5运算,如果得到的MD5值和提供的一样,则ISO文件和原始文件一模一样,否则就得重新下载。
  将ISO刻录到光盘后,又如何校验光盘上刻录的内容是否和原始ISO中的内容完全一样呢?因为在刻录过程中,也许...也许会出现错误。
  这就需要用到 isomd5sum 这个工具了
  加入MD5校验信息:
  implantisomd5 --force ISO文件
  刻录后,可以通过 checkisomd5 --verbose <光盘设备地址,如/dev/hdb> 来校验数据完整性
  附ISO制作完整脚本(带MD5校验)
  ==============================
  脚本运行参数
  ============
  mkiso.sh <需要刻录的原始文件或目录> <输出ISO文件> <CD卷标>
  #!/bin/sh
  #****************************************************
  # Author: Muddyboot - toobyddum@gmail.com
  # Last modified: 2007-09-11 21:21
  # Filename: mkiso.sh
  # Description: script for easy creating ISO image
  #****************************************************
  if [ $# -lt 3 ]; then
  echo -e "\nUsage: `basename $0` source_dir output_iso cd_label \n"
  exit 1
  fi
  source=$1
  output=$2
  label=$3
  ### extra mkiso argument
  shift 3
  for i in $@; do
  extra_args="$extra_args $1 "
  shift
  done
  if [ ! -e "$source" ]; then
  echo -e "\nERR: Source file or directory does not exist ! \n"
  exit 1
  fi
  ## remove exists TRANS.TBL files
  if [ -d "$source" ]; then
  find $source -name TRANS.TBL | xargs rm -f
  fi
  ### 制作ISO
  mkisofs -J -T -R $extra_args \
  -V $label -o $output $source
  ### 加入 MD5 校验信息
  MD5_CHECKSUM=`whereis implantisomd5|awk -F': ' '{print $2}'`
  if [ -z "$MD5_CHECKSUM" ]; then
  echo -e "\n** WARNING: implantisomd5 not found, no md5sum added.\n"
  else
  echo -e "\n** Good, implantisomd5 program found."
  echo "Adding md5sum information for ISO image ..."
  implantisomd5 --force $output
  fi
  echo
  echo "** ISO image $output created successfully ! "
  echo

相关内容