这段时间流行了一阵“N合1”风,最早是WIN2000的PRO,SERVER和ADVSERVER三个版本做成一张光盘,刚开始我还以为是简单的把三个系统的安装盘刻在一张上面,后来大概算了一下,少说也有900M-1G的数据,不太可能。下了一张来看看,发现做法非常新鲜:
其实WIN2000的三个版本的安装盘中,有大量的文件是相同的,特别是语言包/字库(I386\LANG目录)以及写字板等自带应用程序,以及那个50M的driver.cab。不同的只是相对少数的系统文件。这种N合1光盘将ISO映象经过特殊处理,重复的文件,实际数据在光盘上只有一份,通过类似于修改光盘目录表的办法,让不同的目录/文件指向相同的数据区。完成ISO修改后再刻成光盘。这样,既省了空间,又让每个目录看起来仍然独立、完整。
那么到底有多少相同呢?我自己做了个实验,我有一个WIN2K PRO安装目录和一个ADV SERVER安装目录,分别是260M和280M左右。(为了省空间,我去掉了除简/繁体中文外的其它语言包,象韩文日文阿拉伯文,我这辈子都用不到)。两个目录如果简单的刻在一张盘上,将占540M左右的空间。而用N合1的方法,“相同文件只处理一次”,合并下来只有340M左右。照这个数字看来,二者有70-75%是相同的!不同部分只占各自的25%-30%!依此数字估算,就算将SERVER也加进去,最后的大小也应该只有400-450M,相对于简单相加的800M,几乎少了一半。如果你不想将三个差不多的WIN2000分别用三张CDR保存的话,可以考虑自己做个N合1光盘。
说到这里不仅要提一下DOS/WIN文件系统的落后。UNIX/LINUX从最开始就提供了符号连接的功能,一个简单的ln命令就可以完成上面的工作,而在DOS/WIN下,这种操作必须借助专门的软件通过修改ISO进行,而且这种结构还不能存在于硬盘上,因为它在所有针对DOS/WIN的磁盘检查软件看来,都是“交叉连接”,会被更正。
好了,别扯远了。话说回来,理解这种方式很容易,实际做起来呢?关键是“相同文件”是怎么判断。靠人工是很麻烦的。实际上微软内部提供了一个工具,叫CDIMAGE,专门干这个。加上一个-o参数,就可以实现“自动优化”的功能。MS很多内部发行版本,都是用这个办法“挤”在一张盘上。这个小工具解压只有70K。
运行cdimage它会给出详细的命令参数:
CDIMAGE 2.39 CD-ROM Premastering Utility
Copyright (C) Microsoft, 1993-1997. All rights reserved.
For Microsoft internal use only.
Usage: CDIMAGE [options] sourceroot targetfile
-l volume label, no spaces (e.g. -lMYLABEL)
-t time stamp for all files and directories, no spaces, any delimiter
(e.g. -t12/31/91,15:01:00)
-g encode GMT time for files rather than local time
-h include hidden files and directories
-n allow long filenames (longer than DOS 8.3 names)
-nt allow long filenames, restricted to NT 3.51 compatibility
(-nt and -d cannot be used together)
-d don’t force lowercase filenames to uppercase
-c use ANSI filenames versus OEM filenames from source
-j1 encode Joliet Unicode filenames AND generate DOS-compatible 8.3
filenames in the ISO-9660 name space (can be read by either
filenames in the ISO-9660 name space (can be read by either
Joliet systems or conventional ISO-9660 systems, but some of the
filenames in the ISO-9660 name space might be changed to comply
with DOS 8.3 and/or ISO-9660 naming restrictions)
-j2 encode Joliet Unicode filenames without standard ISO-9660 names
(requires a Joliet operating system to read files from the CD)
When using the -j1 or -j2 options, the -n, -nt, and -d options
do not apply and cannot be used.
-js non-Joliet "readme.txt" file for images encoded with -j2 option
(e.g. -jsc:\location\readme.txt). This file will be visible as
the only file in the root directory of the disc on systems that
do not support the Joliet format (Windows 3.1, NT 3.x, etc).
-u1 encode "UDF" file system along with mirror ISO-9660 file system
(-n, -nt, -d, -c, or -j1, -j2 options apply to ISO-9660 portion)
-u2 encode "UDF" file system without a mirror ISO-9660 file system
(requires a UDF capable operating system to read the files)
-us non-UDF "readme.txt" file for images encoded with -u2 option
(e.g. -usc:\location\readme.txt). This file will be visible as
the only file in the root directory of the disc on systems that
do not support the UDF format.
-b "El Torito" boot sector file, no spaces
(e.g. -bc:\location\cdboot.bin)
-s sign image file with digital signature (no spaces, provide RPC
-s sign image file with digital signature (no spaces, provide RPC
server and endpoint name like -sServerName:EndPointName)
-x compute and encode "AutoCRC" values in image
-o optimize storage by encoding duplicate files only once
-oc slower duplicate file detection using binary comparisons rather
than MD5 hash values
-oi ignore diamond compression timestamps when comparing files
-os show duplicate files while creating image
(-o options can be combined like -ocis)
-w warning level followed by number (e.g. -w4)
1 report non-ISO or non-Joliet compliant filenames or depth
2 report non-DOS compliant filenames
3 report zero-length files
4 report each file name copied to image
-y test option followed by number (e.g. -y1), used to generate
non-standard variations of ISO-9660 for testing purposes:
1 encode trailing version number ’;1’ on filenames (7.5.1)
2 round directory sizes to multiples of 2K (6.8.1.3)
5 write \i386 directory files first, in reverse sort order
6 allow directory records to be exactly aligned at ends of sectors
(ISO-9660 6.8.1.1 conformant but breaks MSCDEX)
7 warn about generated shortnames for 16-bit apps under NT 4.0
b blocksize 512 bytes rather than 2048 bytes
b blocksize 512 bytes rather than 2048 bytes
d suppress warning for non-identical files with same initial 64K
-k (keep) create image even if fail to open some of the source files
-m ignore maximum image size of 681,984,000 bytes
-a allocation summary shows file and directory sizes
-q scan source files only, don’t create an image file
NOTE: Many of these options allow you to create CD images
that are NOT compliant with ISO-9660 and may also
NOT be compatibile with one or more operating systems.
If you want strict ISO and DOS compliance, use the -w2
warning level and correct any discrepencies reported.
YOU are responsible for insuring that any generated CDs
are compatible with all appropriate operating systems.
Also note that Microsoft company information is placed
in the image volume header, so don’t use this program
to generate CDs for companies other than Microsoft.
当