普通是 rar, zip, tar, 7z 仅存档模式在使用时也需要先解压再使用, 打包成 iso 镜像后可以直接挂载使用. 可以节省解压时间, 硬盘空间
制作 iso 镜像会搜到两个工具名称 mkisofs
和 genisoimage
, 其实最早时候 Linux 系统使用 cdrtools 工具来管理 iso 及光盘, mkisofs 是 cdrtools 里面的一个工具, 后来 cdrtools 更改了授权许可, 从 GPL 修改为 CDDL 许可, 开源社区又推出了一套基于 GPL 的工具, cdrkit, mkisofs 也被 genisoimage 代替, 现在系统中的 mkisofs 实际是 genisoimage 的软连接
[root@server ~]# whereis mkisofs
mkisofs: /usr/bin/mkisofs /usr/share/man/man1/mkisofs.1.gz
[root@server ~]# ls -l /usr/bin/mkisofs
lrwxrwxrwx. 1 root root 25 Mar 29 05:32 /usr/bin/mkisofs -> /etc/alternatives/mkisofs
[root@server ~]# ls -l /etc/alternatives/mkisofs
lrwxrwxrwx. 1 root root 20 Mar 29 05:32 /etc/alternatives/mkisofs -> /usr/bin/genisoimage
[root@server ~]# whereis genisoimage
genisoimage: /usr/bin/genisoimage /usr/share/man/man1/genisoimage.1.gz
[root@server ~]# ls -l /usr/bin/genisoimage
-rwxr-xr-x. 1 root root 521240 Oct 31 2018 /usr/bin/genisoimage
安装工具
yum install genisoimage -y
制作镜像
一般情况下制作文件需要添加 -lJR
参数, 没添加时文件名会被裁剪并转为全大写名称 ISO-9660
标准
genisoimage -lJR -o output_image.iso directory_name
参数 | 说明 |
---|---|
-l | Allow full 31 character filenames |
-J | Generate Joliet directory records in addition to regular iso9660 file names |
-R | Generate System Use Sharing Protocol (SUSP) and Rock Ridge (RR) records using the Rock Ridge protocol |
-allow-multidot | 允许多个 . |
-o | 输出文件名 |
使用 7z 解压镜像
用 7z 查看 iso 文件内容
7z l acesheep.iso
7z 解压镜像可以设置解压位置, 命令行下比挂载方便
7z x acesheep.iso -oAceSheep-Folder
帮助
[root@server ~]# genisoimage --help
Usage: genisoimage [options] file...
Options:
-nobak Do not include backup files
-no-bak Do not include backup files
-abstract FILE Set Abstract filename
-A ID, -appid ID Set Application ID
-biblio FILE Set Bibliographic filename
-cache-inodes Cache inodes (needed to detect hard links)
-no-cache-inodes Do not cache inodes (if filesystem has no unique unides)
-check-oldnames Check all imported ISO9660 names from old session
-check-session FILE Check all ISO9660 names from previous session
-copyright FILE Set Copyright filename
-debug Set debug flag
-b FILE, -eltorito-boot FILE
Set El Torito boot image name
-e FILE, -efi-boot FILE Set EFI boot image name
-eltorito-alt-boot Start specifying alternative El Torito boot parameters
-B FILES, -sparc-boot FILES Set sparc boot image names
-sunx86-boot FILES Set sunx86 boot image names
-G FILE, -generic-boot FILE Set generic boot image name
-jigdo-template-compress ALGORITHM
Choose to use gzip or bzip2 compression for template data; default is gzip
-checksum_algorithm_iso alg1,alg2,...
Specify the checksum types desired for the output image
-checksum_algorithm_template alg1,alg2,...
Specify the checksum types desired for the output jigdo template
-sort FILE Sort file content locations according to rules in FILE
-split-output Split output into files of approx. 1GB size
-stream-file-name FILE_NAME Set the stream file ISO9660 name (incl. version)
-stream-media-size # Set the size of your CD media in sectors
-sysid ID Set System ID
-T, -translation-table Generate translation tables for systems that don't understand long filenames
-table-name TABLE_NAME Translation table file name
-ucs-level LEVEL Set Joliet UCS level (1..3)
-udf Generate UDF file system
-dvd-video Generate DVD-Video compliant UDF file system
-uid uid Make the owner of all files this uid.
-U, -untranslated-filenames Allow Untranslated filenames (for HPUX & AIX - violates ISO9660). Forces -l, -d, -N, -allow-leading-dots, -relaxed-filenames, -allow-lowercase, -allow-multidot
-relaxed-filenames Allow 7 bit ASCII except lower case characters (violates ISO9660)
-no-iso-translate Do not translate illegal ISO characters '~', '-' and '#' (violates ISO9660)
-allow-lowercase Allow lower case characters in addition to the current character set (violates ISO9660)
-allow-multidot Allow more than one dot in filenames (e.g. .tar.gz) (violates ISO9660)
-use-fileversion LEVEL Use file version # from filesystem
-v, -verbose Verbose
-version Print the current version
-V ID, -volid ID Set Volume ID
-volset ID Set Volume set ID
-volset-size # Set Volume set size
-volset-seqno # Set Volume set sequence number
-x FILE, -old-exclude FILE Exclude file name(depreciated)
-hard-disk-boot Boot image is a hard disk image
-no-emul-boot Boot image is 'no emulation' image
-no-boot Boot image is not bootable
-boot-load-seg # Set load segment for boot image
-boot-load-size # Set numbers of load sectors
-boot-info-table Patch boot image with info table
-XA Generate XA directory attruibutes
-xa Generate rationalized XA directory attruibutes
-z, -transparent-compression
Enable transparent compression of files
-hfs-type TYPE Set HFS default TYPE
-hfs-creator CREATOR Set HFS default CREATOR
-g, -apple Add Apple ISO9660 extensions
-h, -hfs Create ISO9660/HFS hybrid
-map MAPPING_FILE Map file extensions to HFS TYPE/CREATOR
-H MAPPING_FILE, -map MAPPING_FILE
Map file extensions to HFS TYPE/CREATOR
-magic FILE Magic file for HFS TYPE/CREATOR
-probe Probe all files for Apple/Unix file types
-mac-name Use Macintosh name for ISO9660/Joliet/RockRidge file name
-no-mac-files Do not look for Unix/Mac files (depreciated)
-boot-hfs-file FILE Set HFS boot image name
-part Generate HFS partition table
-cluster-size SIZE Cluster size for PC Exchange Macintosh files
-auto FILE Set HFS AutoStart file name
-no-desktop Do not create the HFS (empty) Desktop files
-hide-hfs GLOBFILE Hide HFS file
-hide-hfs-list FILE List of HFS files to hide
-hfs-volid HFS_VOLID Volume name for the HFS partition
-icon-position Keep HFS icon position
-root-info FILE finderinfo for root folder
-input-hfs-charset CHARSET Local input charset for HFS file name conversion
-output-hfs-charset CHARSET Output charset for HFS file name conversion
-hfs-unlock Leave HFS Volume unlocked
-hfs-bless FOLDER_NAME Name of Folder to be blessed
-hfs-parms PARAMETERS Comma separated list of HFS parameters
-prep-boot FILE PReP boot image file -- up to 4 are allowed
-chrp-boot Add CHRP boot header
--cap Look for AUFS CAP Macintosh files
--netatalk Look for NETATALK Macintosh files
--double Look for AppleDouble Macintosh files
--ethershare Look for Helios EtherShare Macintosh files
--exchange Look for PC Exchange Macintosh files
--sgi Look for SGI Macintosh files
--macbin Look for MacBinary Macintosh files
--single Look for AppleSingle Macintosh files
--ushare Look for IPT UShare Macintosh files
--xinet Look for XINET Macintosh files
--dave Look for DAVE Macintosh files
--sfm Look for SFM Macintosh files
--osx-double Look for MacOS X AppleDouble Macintosh files
--osx-hfs Look for MacOS X HFS Macintosh files
Report problems to debburn-devel@lists.alioth.debian.org.
Create iso image from folder via terminal commands
mkisofs 手册页
制作CentOS7的ISO镜像