将Linux CD镜像文件合并成DVD镜像文件的方法

环境:Linux操作系统的计算机或服务器、Linux的CD镜像文件(后缀名为.iso)。

步骤:

1、创建一个目录—————–mkdir(创建目录命令)

2、将linux的CD光盘镜像全部拷贝在此目录中,,并将镜像名依次命名为disk1.iso、disk2.iso、disk3.iso …—————————-cp(拷贝文件命令) mv(重命名命令)

3、在此目录中创建convert2dvd.sh文件———————-touch(创建文件命令)

4、编辑convert2dvd.sh文件——————–vi编辑命令

在文件中输入以下内容:

#/bin/bash# by Chris Kloiber <ckloiber@RedHat.com># A quick hack that will create a bootable DVD iso of a Red Hat Linux# Distribution. Feed it either a directory containing the downloaded# iso files of a distribution, or point it at a directory containing# the “RedHat”, “isolinux”, and “images” directories.# This version only works with “isolinux” based Red Hat Linux versions.# Lots of disk space required to work, 3X the distribution size at least.# GPL version 2 applies. No warranties, yadda, yadda. Have fun.if [ $# -lt 2 ]; thenecho “Usage: `basename $0` source /destination/DVD.iso”echo “”echo ” The ‘source’ can be either a directory containing a single”echo ” set of isos, or an exploded tree like an ftp site.”exit 1ficleanup() {[ ${LOOP:=/tmp/loop} = “/” ] && echo “LOOP mount point = \/, dying!” && exit[ -d $LOOP ] && rm -rf $LOOP[ ${DVD:=~/mkrhdvd} = “/” ] && echo “DVD data location is \/, dying!” && exit[ -d $DVD ] && rm -rf $DVD}cleanupmkdir -p $LOOPmkdir -p $DVDif [ !`ls $1/*.iso 2>&1>/dev/null; echo $?` ]; thenecho “Found ISO CD images…”CDS=`expr 0`DISKS=”1″for f in `ls $1/*.iso`; domount -o loop $f $LOOPcp -av $LOOP/* $DVDif [ -f $LOOP/.discinfo ]; thencp -av $LOOP/.discinfo $DVDCDS=`expr $CDS + 1`if [ $CDS != 1 ]; thenDISKS=`echo ${DISKS},${CDS}`fifiumount $LOOPdoneif [ -e $DVD/.discinfo ]; thenawk ‘{ if ( NR == 4 ) { print disks } else { print; } }’ disks=”$DISKS” $DVD/.discinfo > $DVD/.discinfo.newmv $DVD/.discinfo.new $DVD/.discinfofielseecho “Found FTP-like tree…”rsync -avP –exclude SRPMS $1/* $DVD# cp -av $1/* $DVD[ -e $1/.discinfo ] && cp -av $1/.discinfo $DVDfirm -rf $DVD/isolinux/boot.catfind $DVD -name TRANS.TBL | xargs rm -f# My thanks to Mubashir Cheema for suggesting this fix.# cd $DVDmkisofs -J -R -v -T -o $2 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 8 -boot-info-table $DVD/usr/lib/anaconda-runtime/implantisomd5 –force $2# Don’t like forced mediacheck? Try this instead.# /usr/lib/anaconda-runtime/implantisomd5 –supported-iso –force $2cleanupecho “”echo “Process Complete!”echo “”

保存并退出

5、将该目录中的convert2dvd.sh、CD镜像文件的权限改为可执行—–chmod(改变权限命令)

6、在目录中执行convert2dvd.sh文件并设置相关参数

./convert2dvd.sh CD镜像文件目录 目标文件目录/转换后的镜像文件名

例如:./convert2dvd.sh /root/as4u4/ /root/as4u4/mydvd.iso

稍候便可转换成功

人生并不在于获取,更在于放得下。放下一粒种子,收获一棵大树;

将Linux CD镜像文件合并成DVD镜像文件的方法

相关文章:

你感兴趣的文章:

标签云: