1、將光盤isoliunx目錄復(fù)制到data/myiso目錄下,ks6-mini.cfg文件復(fù)制到/data/myiso/ksdir下,結(jié)構(gòu)如下:
[root@Centos6 ~]# tree /data/myiso
/data/myiso
├── isolinux
│ ├── boot.cat
│ ├── boot.msg
│ ├── grub.conf
│ ├── initrd.img
│ ├── isolinux.bin
│ ├── isolinux.cfg
│ ├── memtest
│ ├── splash.jpg
│ ├── TRANS.TBL
│ ├── vesamenu.c32
│ └── vmlinuz
└── ksdir
└── ks6-mini.cfg
2 directories, 12 files
2、修改isolinux.cfg文件
cd isolinux/
vim isolinux.cfg
內(nèi)存檢測刪掉
本地安裝留下,且留作默認(rèn)項(xiàng)(重要)
救援模式刪掉
增加桌面安裝
label desktop
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ksdir/ks6_desktop.cfg
增加最小化安裝
label mini
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ksdir/ks6_mini.cfg 效果如下:
[root@Centos6 isolinux]# vim isolinux.cfg
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.10!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img nomodeset
label local
menu label Boot from ^local drive
localboot 0xffff
label desktop
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ksdir/ks6_desktop.cfg
label mini
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ksdir/ks6_mini.cf
3、.生成boot.iso文件
mkisofs -R -J -T -v –no-emul-boot –boot-load-size 4 –boot-info-table -V "CentOS 6.9 x86_64 boot" -b isolinux/isolinux.bin -c isolinux/boot.cat -o /root/boot.iso /data/myiso/ 效果如下:
[root@Centos6 ~]# mkisofs -R -J -T -v –no-emul-boot –boot-load-size 4 –boot-info-table -V "CentOS 6.9 x86_64 boot" -b isolinux/isolinux.bin -c isolinux/boot.cat -o /root/boot.iso /data/myiso/
I: -input-charset not specified, using utf-8 (detected in locale settings)
genisoimage 1.1.9 (Linux)
Scanning /data/myiso/
Scanning /data/myiso/ksdir
Scanning /data/myiso/isolinux
Excluded: /data/myiso/isolinux/TRANS.TBL
Excluded by match: /data/myiso/isolinux/boot.cat
Writing: Initial Padblock Start Block 0
Done with: Initial Padblock Block(s) 16
Writing: Primary Volume Descriptor Start Block 16
Done with: Primary Volume Descriptor Block(s) 1
Writing: Eltorito Volume Descriptor Start Block 17
Size of boot image is 4 sectors -> No emulation
Done with: Eltorito Volume Descriptor Block(s) 1
Writing: Joliet Volume Descriptor Start Block 18
Done with: Joliet Volume Descriptor Block(s) 1
Writing: End Volume Descriptor Start Block 19
Done with: End Volume Descriptor Block(s) 1
Writing: Version block Start Block 20
Done with: Version block Block(s) 1
Writing: Path table Start Block 21
Done with: Path table Block(s) 4
Writing: Joliet path table Start Block 25
Done with: Joliet path table Block(s) 4
Writing: Directory tree Start Block 29
Done with: Directory tree Block(s) 3
Writing: Joliet directory tree Start Block 32
Done with: Joliet directory tree Block(s) 3
Writing: Directory tree cleanup Start Block 35
Done with: Directory tree cleanup Block(s) 0
Writing: Extension record Start Block 35
Done with: Extension record Block(s) 1
Writing: The File(s) Start Block 36
22.21% done, estimate finish Fri Feb 1 05:06:43 2019
44.31% done, estimate finish Fri Feb 1 05:06:41 2019
66.49% done, estimate finish Fri Feb 1 05:06:40 2019
88.60% done, estimate finish Fri Feb 1 05:06:40 2019
Total translation table size: 5380
Total rockridge attributes bytes: 1912
Total directory bytes: 4096
Path table size(bytes): 40
Done with: The File(s) Block(s) 22396
Writing: Ending Padblock Start Block 22432
Done with: Ending Padblock Block(s) 150
Max brk space used 1a000
22582 extents written (44 MB)
4、將boot.iso文件導(dǎo)出系統(tǒng),新開一臺虛擬機(jī),掛載boot.iso,并設(shè)置光盤引導(dǎo)啟動(dòng),在root下可以找到 boot.iso
[root@Centos6 isolinux]# ls /root
anaconda-ks.cfg boot.iso install.log install.log.syslog
sz boot.iso到桌面,
在虛擬機(jī)電源處點(diǎn)擊“打開電源時(shí)進(jìn)入固件”,即可設(shè)置,
5、開機(jī)成功,顯示我們通過isolinux.cfg修改過的菜單選項(xiàng),默認(rèn)本地安裝,選擇其他選項(xiàng)將進(jìn)行對應(yīng)系統(tǒng)的自動(dòng)安裝
注: 假設(shè)你想備份一個(gè)叫做 /home/joeuser/ 的目錄,但是不想包括子目錄 /home/joeuser/junk/,因?yàn)槠渲邪ǖ亩际遣槐匾奈募D阆雱?chuàng)建一個(gè)叫做 backup.iso 的映像,然后把它刻寫到 CD-R(W) 去,因而你能夠在辦公時(shí)在你的 Red Hat Linux PC 上使用,旅行時(shí)在你的 Windows 便攜電腦上使用。這個(gè)目的可以通過使用 mkisofs ,運(yùn)行以下命令來達(dá)到:mkisofs -o backup.iso -x /home/joeuser/junk/ -J -R -A -V -v /home/joeuser/
mkisofs(make iso file system)
功能說明:建立ISO 9660映像文件。
語法:mkisofs [-adDfhJlLNrRTvz][-print-size][-quiet][-A <應(yīng)用程序ID>][-abstract < 摘要文件>][-b <開機(jī)映像文件>][-biblio ][-c <開機(jī)文件名稱>] [-C <盤區(qū)編號,磁區(qū)編號>][-copyright <版權(quán)信息文件>][-hide <目錄或文件名>] [-hide-joliet <文件或目錄名>][-log-file <記錄文件>][-m <目錄或文件名>] [-M <開機(jī)映像文件>][-o <映像文件>][-p <數(shù)據(jù)處理人>][-P <光盤發(fā)行人>] [-sysid <系統(tǒng)ID >][-V <光盤ID >][-volset <卷冊集ID>][-volset-size <光盤總數(shù)>][-volset-seqno <卷冊序號>][-x <目錄>][目錄或文件]
補(bǔ)充說明:mkisofs可將指定的目錄與文件做成ISO 9660格式的映像文件,以供刻錄光盤。
參數(shù):
-a或–all mkisofs通常不處理備份文件。使用此參數(shù)可以把備份文件加到映像文件中。
-A<應(yīng)用程序ID>或-appid<應(yīng)用程序ID> 指定光盤的應(yīng)用程序ID。
-abstract<摘要文件> 指定摘要文件的文件名。
-b<開機(jī)映像文件>或-eltorito-boot<開機(jī)映像文件> 指定在制作可開機(jī)光盤時(shí)所需的開機(jī)映像文件。
-biblio 指定ISBN文件的文件名,ISBN文件位于光盤根目錄下,記錄光盤的ISBN。
-c<開機(jī)文件名稱> 制作可開機(jī)光盤時(shí),mkisofs會將開機(jī)映像文件中的全-eltorito-catalog<開機(jī)文件名稱>全部內(nèi)容作成一個(gè)文件。
-C<盤區(qū)編號,盤區(qū)編號> 將許多節(jié)區(qū)合成一個(gè)映像文件時(shí),必須使用此參數(shù)。
-copyright<版權(quán)信息文件> 指定版權(quán)信息文件的文件名。
-d或-omit-period 省略文件后的句號。
-D或-disable-deep-relocation ISO 9660最多只能處理8層的目錄,超過8層的部分,RRIP會自動(dòng)將它們設(shè)置成ISO 9660兼容的格式。使用-D參數(shù)可關(guān)閉此功能。
-f或-follow-links 忽略符號連接。
-h 顯示幫助。
-hide<目錄或文件名> 使指定的目錄或文件在ISO 9660或Rock RidgeExtensions的系統(tǒng)中隱藏。
-hide-joliet<目錄或文件名> 使指定的目錄或文件在Joliet系統(tǒng)中隱藏。
-J或-joliet 使用Joliet格式的目錄與文件名稱。
-l或-full-iso9660-filenames 使用ISO 9660 32字符長度的文件名。
-L或-allow-leading-dots 允許文件名的第一個(gè)字符為句號。
-log-file<記錄文件> 在執(zhí)行過程中若有錯(cuò)誤信息,預(yù)設(shè)會顯示在屏幕上。
-m<目錄或文件名>或-exclude<目錄或文件名> 指定的目錄或文件名將不會房入映像文件中。
-M<映像文件>或-prev-session<映像文件> 與指定的映像文件合并。
-N或-omit-version-number 省略ISO 9660文件中的版本信息。
-o<映像文件>或-output<映像文件> 指定映像文件的名稱。
-p<數(shù)據(jù)處理人>或-preparer<數(shù)據(jù)處理人> 記錄光盤的數(shù)據(jù)處理人。
-print-size 顯示預(yù)估的文件系統(tǒng)大小。
-quiet 執(zhí)行時(shí)不顯示任何信息。
-r或-rational-rock 使用Rock Ridge Extensions,并開放全部文件的讀取權(quán)限。
-R或-rock 使用Rock Ridge Extensions。
-sysid<系統(tǒng)ID> 指定光盤的系統(tǒng)ID。
-T或-translation-table 建立文件名的轉(zhuǎn)換表,適用于不支持Rock Ridge Extensions的系統(tǒng)上。
-v或-verbose 執(zhí)行時(shí)顯示詳細(xì)的信息。
-V<光盤ID>或-volid<光盤ID> 指定光盤的卷冊集ID。
-volset-size<光盤總數(shù)> 指定卷冊集所包含的光盤張數(shù)。
-volset-seqno<卷冊序號> 指定光盤片在卷冊集中的編號。
-x<目錄> 指定的目錄將不會放入映像文件中。
-z 建立通透性壓縮文件的SUSP記錄,此記錄目前只在Alpha機(jī)器上的Linux有效。
使用:mkisofs -l -R -J -T -V system-sp2 -o system.iso system/
擴(kuò)展資料一: 在GRUB中,可以利用 stage2_eltorito 來制作啟動(dòng)光盤:
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso
stage2_eltorito和menu.lst應(yīng)該放在光盤的/boot/grub目錄里。
在GRUB4DOS中,可以利用 grldr 來制作啟動(dòng)光盤。制作方法有兩種:
mkisofs -R -b grldr -no-emul-boot -boot-load-seg 0x1000 -o bootable.iso iso_root
mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root
grldr和menu.lst應(yīng)該放在光盤的根目錄里。
第一種方法告訴 BIOS,希望它能夠裝入整個(gè) GRLDR 文件到內(nèi)存。裝入內(nèi)存后,BIOS 還應(yīng)該正確設(shè)置堆棧,使得不至于把堆棧設(shè)置到 GRLDR 的程序體內(nèi),造成沖突。一般情況下,BIOS 做到這一點(diǎn)很容易,因?yàn)樗梢栽O(shè)置堆棧指針為裝入的起始地址。但也不排除存在 BUGGY BIOS 的可能性。
有些 BIOS 不完全符合可啟動(dòng)的 CDROM 規(guī)范,比如 VirtualPC 的就是的。這類 BIOS 只是裝入了一部分 GRLDR 扇區(qū)到內(nèi)存,典型的可能只裝入了一個(gè)扇區(qū)(2048 字節(jié)的大扇區(qū))到內(nèi)存。不過我們的代碼已經(jīng)替這些 BUGGY BIOS 打了補(bǔ)丁。只要這些 BIOS 能夠設(shè)置正確的堆棧,不至于和裝入內(nèi)存中的 GRLDR 扇區(qū)數(shù)據(jù)產(chǎn)生沖突就 OK 了。
也就是說,上述第一種制作光盤的方法,應(yīng)該沒有多大問題了。這種方法很有可能適應(yīng)于所有的 BIOS。
第二種方法本身就只要求 BIOS 裝入一個(gè) CDROM 扇區(qū)到內(nèi)存(等同于 4 個(gè) 512 字節(jié)的小扇區(qū))。這種方法是最保守的,沒有理由會失敗了。微軟的 win2000 啟動(dòng)光盤就是這么做的,isolinux 和 stage2_eltorito 也都是這么做的。如果這種方法失敗了,那么 win2000,isolinux 和 stage2_eltorito 應(yīng)該都會失敗的。
對于第二種方法,我們不需要 -boot-info-table 這個(gè)參數(shù)。但是允許你用這個(gè)參數(shù)(用了和沒用是一樣的,我們的引導(dǎo)代碼將忽略由這個(gè)參數(shù)所傳遞的數(shù)據(jù)結(jié)構(gòu))。
對于第一種方法也一樣,不需要 -boot-info-table 這個(gè)參數(shù),同時(shí)也是允許你用這個(gè)參數(shù)(用了和沒用是一樣的,我們的引導(dǎo)代碼將忽略由這個(gè)參數(shù)所傳遞的數(shù)據(jù)結(jié)構(gòu))。
這樣,stage2_eltorito 就可以完全用 grldr 來代替了。
擴(kuò)展資料二:
實(shí)例分析:
mkisofs -r -T -J -V "make iso " -b /isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -v -o myiso.iso ./myCD
這個(gè)實(shí)例是用來制作一個(gè)安裝盤。每一項(xiàng)的功能可以根據(jù)上面的選項(xiàng)得知。
其是 -no-emul-boot:Boot image is 'no emulation' image即非模擬模式啟動(dòng)
-boot-load-size:Set numbers of load sectors 即設(shè)置載入部分的數(shù)量
-boot-info-table:Patch boot image with info table 在啟動(dòng)的圖像中顯示信息
制作一個(gè)通用的ISO鏡像
mkisofs -a -l -J -L -r -o filename.iso /directory
這樣就能做出一個(gè)在windows和linux(或者其他UNIX)上面都能使用的ISO鏡像了。
-a或–all mkisofs通常不處理備份文件。使用此參數(shù)可以把備份文件加到映像文件中。
-l或-full-iso9660-filenames 使用ISO 9660 32字符長度的文件名
-L或-allow-leading-dots 允許文件名的第一個(gè)字符為句號。
-J或-joliet 使用Joliet格式的目錄與文件名稱。
-r或-rational-rock 使用Rock Ridge Extensions,并開放全部文件的讀取權(quán)限。
-o<映像文件>或-output<映像文件> 指定映像文件的名稱。
擴(kuò)展資料三
要做 Unix/Linux 下的數(shù)據(jù)盤或者開機(jī)啟動(dòng)盤,必須使用 Unix Rock Ridge 格式(mkisofs -r), 這種格式可以保存文件相關(guān)的權(quán)限
要所DOS/WIN下的光盤,用Joliet格式(-J)
最簡單的光盤生成ISO———–只有-o –v兩個(gè)基本參數(shù)
最簡單的光盤生成ISO———–只有-o –v兩個(gè)基本參數(shù)
[root@mail home]# ls
clamav guan guant iei simscan yu
[root@mail home]# mkisofs -o test.iso -v /home/guan /home/guant
可以后跟多個(gè)目錄做source
mkisofs 2.0 (i686-pc-linux-gnu)
Scanning /home/guan
Scanning /home/guan/.kde
Scanning /home/guan/.kde/Autostart
Scanning /home/guan/sun
Scanning /home/guan/t1
Scanning /home/guan/t1/temp
Scanning /home/guan/t1/temp/t11
Scanning /home/guant/t2/temp/t11
Scanning /home/guant/t2/temp/t11/t111
Using CLUST000.PDF;1 for /home/guan/newiei/cluster_ibm_totstor_osp.pdf (cluster_hp.pdf)
Using CLUST001.PDF;1 for /home/guan/newiei/cluster_hp.pdf (cluster_emc_osp.pdf)
Using NTRAC000.DOC;1 for /home/guan/newiei/Ntracker v9 r1.doc (nTracker Deployment Guide (2006-11-22).doc)
Using PRESE000.PPT;1 for /home/guan/newiei/Presentation3.ppt (Presentation2.ppt)
Using CISCO000.MHT;1 for /home/guan/newiei/Cisco IOS NetFlow Configuration Guide, Release 12_4 – Configuring NetFlow
Aggregation Caches – Cisco Systems.mht (Cisco IOS Switching Services ConfigurationGuide, Release12_2 – Configuring Multiprotocol Label Switching [Cisco IOS Software Releases 12_2 Mainline] – Cisco Systems.mht)
Writing: Initial Padbock Start Block 0
Done with: Initial Padbock Block(s) 16
Writing: Primary Volume Descriptor Start Block 16
Done with: Primary Volume Descriptor Block(s) 1
Writing: End Volume Descriptor Start Block 17
Done with: End Volume Descriptor Block(s) 1
Writing: The File(s) Start Block 38
10.49% done, estimate finish Fri Jun 15 14:40:41 2007
20.94% done, estimate finish Fri Jun 15 14:40:22 2007
62.83% done, estimate finish Fri Jun 15 14:40:14 2007
73.31% done, estimate finish Fri Jun 15 14:40:20 2007
83.77% done, estimate finish Fri Jun 15 14:40:19 2007
94.25% done, estimate finish Fri Jun 15 14:40:22 2007
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 28672
Path table size(bytes): 168
Done with: The File(s) Block(s) 47695
Writing: Ending pad block Start Block 47733
Done with: Ending pad block Block(s) 27
Max brk space used 21000
47760 extents written (93 Mb)
[root@mail home]#
[root@mail home]# ls -l test.iso
-rw-r–r– 1 root root 97812480 Jun 15 14:40 test.iso
將linux光盤生成iso文件
別忘了-r,否則做成的盤大寫都變成小寫,而且所有文件的權(quán)限都變成r_x
[root@mm guan]# ls /mnt/cdrom/
autorun RELEASE-NOTES-bn.html
EULA RELEASE-NOTES-de.html
GPL RELEASE-NOTES-en
images RELEASE-NOTES-en.html
isolinux RELEASE-NOTES-es.html
README-it.html RELEASE-NOTES-ru.html
README-ja.html RELEASE-NOTES-ta.html
README-ko.html RELEASE-NOTES-U1-bn.html
README-pa.html RELEASE-NOTES-U1-de.html RPM-GPG-KEY
README-pt_BR.html RELEASE-NOTES-U1-en SRPMS
README-ru.html RELEASE-NOTES-U1-en.html TRANS.TBL
README-ta.html RELEASE-NOTES-U1-es.html
README-zh_CN.html RELEASE-NOTES-U1-fr.html
README-zh_TW.html RELEASE-NOTES-U1-gu.html
RedHat RELEASE-NOTES-U1-hi.html
[root@mm guan]# mkiso -o linux-dev-redhat-as4r4.iso -v -r /mnt/cdrom
iso文件的檢驗(yàn)最簡單———直接mount即可,相當(dāng)于windows下的虛擬光驅(qū)
[root@mail home]# mount /home/test.iso /mnt/disk1
mount: /home/test.iso is not a block device (maybe try `-o loop')
[root@mail home]# mount -o loop /home/test.iso /mnt/disk1
[root@mail home]# ls /mnt/disk1
4_root_l _bash_lo _bashrc fggggggg.txt huawei.txt _kde network.txt
_bash_hi _bash_pr del.txt _gtkrc ifcfg_et linux_2_.bz2 newiei sdfsdf.txt
[root@mail home]#
制作linux啟動(dòng)光盤
mkisofs -r -J -T -V "Custom RHEL4 Build" -o /home/guan/custom-RHEL4-dvd.iso
-b isolinux/isolinux.bin -c isolinux/boot.cat
-no-emul-boot -boot-load-size 4 -boot-info-table .
-r -J: -rational-rock -joliet
-b:啟動(dòng)image
-c:cat文件
-no-emul-boot
-boot-load-size 4: Set numbers of load sectors
-boot-info-table:Patch boot image with info table