Imagex instead of ghost

Source: Internet
Author: User
Tags add numbers
Application of Microsoft's packaging tool imagex!

This article will introduce several basic applications of imagex: image creation, image compression, image file splitting, and application image.

All operations in this article must be performed in Windows PE. Although this may not be convenient in the DOS environment, replacing dos with Windows PE is an inevitable trend. At the same time, the Windows PE environment also makes imagex more suitable.

We all know that traditional disk sector-based image tools can only run outside the Windows operating system, so dedicated recovery environments are used, such as the special version of DOS provided by software developers. But there is a problem, mainly about the storage subsystem. Now we are using more and more storage subsystem specifications, in addition to traditional IDE, common also include SCSI, SATA, and various levels of RAID, etc, how to enable the image tool to support these uncommon storage subsystems has become the biggest problem.

Taking dos as an image tool for restoring the environment as an example, if the tool does not have a built-in dos driver for the raid system, it cannot be used to create and restore images for the raid system. However, imagex solves this problem, and its recovery environment is Windows PE. This can be seen as a Windows Kernel without the graphical interface. Therefore, any disk subsystem, A driver in windows can be used in Windows PE.

During use, you may notice that the windows PE optical disk is used to guide the computer. before entering the Windows PE environment, the screen will first display "Press F6 to install ..." This is similar to the option when we directly use a CD to install the Windows operating system. If you use some less commonly used storage subsystems, such as SCSI or raid, you need to press F6 on this interface and then provide the required driver, in this way, Windows PE can recognize your hard disk after boot.

In the following example, the system used in the experiment is set as follows: Drive C is used to install the operating system, drive D is used to drive D, and drive E is used to save the created image file. However, when we use a Windows PE disc to boot the computer, the situation has changed. The C disk is still a system disk, but the optical drive is an X disk, and the E disk in Windows is a D disk in Windows PE. Therefore, to avoid confusion, operations in Windows PE will use the drive letter name in PE, but operations in Windows will use the drive letter in windows.

Create an image

First, we need to prepare a template computer, install the operating system to be deployed in batches on this computer, and install all the required drivers, application software, and system updates, at the same time, we can also set various options of the system and program according to actual needs. Run sysprep.exe after the settings are completed to delete all unnecessary information and disable the computer.

In this step, there is no big difference between the traditional partition-based impact tool deployment, but next we will use Microsoft's own image tool.

Suppose we want to use the default settings to create a C disk image. the name of Wim is stored in the root directory of the d disk, and the data is verified after the creation is complete. You can use the following command:

Imagex/capture C: D: \ data. Wim "drive C"/verify

The "/capture" parameter is used to create an image file. The "C:" parameter after this parameter specifies the target partition of the image to be created. The "D: \ data. Wim" parameter specifies the storage location and name of the image file. The "drive C" parameter defines the description of the image file and must be referenced in quotation marks. The final "/verify" parameter allows imagex to verify the image after it is created. When we see the interface shown in figure 1, our command is correct, and the program is creating a C disk image. When "successfully imaged c: \" is displayed, the image has been created.

At this time, we can save the created data. Wim file and use it for subsequent deployment. There is also an interesting feature to remind you: imagex can save the created image file on the pre-created image partition. For example, in this example, we can completely store data. Wim on disk C, which is actually the biggest difference between a file-based image tool and a sector-based image tool.

Compressed image

Of course, imagex can do a lot more. Sometimes we may want to minimize the size of the generated image file. At this time, we can use the imagex compression function. The compression parameter has two options: fast and maximum. The latter has a higher compression ratio, and of course it takes a longer time. In the preceding example, if you want to compress the created image file at the maximum level, run the following command:

Imagex/compress maximum/capture C: D: \ data2.wim "Drive C"/verify

Unfortunately, this parameter can only be used when an image file is created. You cannot use this parameter to compress an image file or change the compression level.

Split the image

You can use the "/split" parameter of imagex if you want to split the created image file by a certain size so that it can be burned to a CD or saved to other removable storage media. For example, if you want to split the previously created data. Wim file in 640 MB to burn it to a CD, run the following command:

Imagex/split D: \ data. Wim D: \ datasplited. swm 640

This operation will create a series of. swm files with fixed numbers. For example, if the file to be split is data. Wim, then the split files are data1.swm and data2.swm. This parameter is also insufficient: First, it cannot be used when creating an image file. It can only be used after the image file is created successfully. In addition, the size of the split file is specified in MB. If we need to split the file in GB to burn the DVD, it is not flexible enough.

Application Image

We have created a system image file. If you need to deploy it on multiple computers in the future or the system of a computer crashes, you can use the created image file to restore it. The recovery process is very simple. You still need to enter the Windows PE environment, and then run the imagex.exe program using "/applydomaindetail.

Note that before using imagex to install the operating system image, you must partition the hard disk. You can use diskpart.exe, a partition tool provided by Windows pe. If you are in trouble or have too many computers to process, you can also write a script to enable Windows PE to automatically perform partitioning after it is started.

If we want to restore the data. Wim file that was previously created on drive d to drive C, we can format drive C first and then use this command:

Imagex/apply D: \ data. Wim 1 C:/verify

Note the number "1" after the image name. We will introduce it later. imagex can append multiple image files to the same image, how to specify a specific image from the image file attached with multiple images when using a specific image to deploy the system or perform other similar operations? Here we need to use the number. If you want to operate on the first image, add the image number after the image file name.

Advanced Applications

In addition to the functions described above, imagex also has many functions that can be used in different situations. Similarly, we will introduce you to you through several specific instances below.

File Attachment

Sometimes we may encounter this situation: after installing the operating system, we need to create an image file. After installing the patch and driver, we need to create another image; after installing all other required applications and making necessary settings, you need to create a third image file. This requirement has a feature that most of the three image files share the same data, and each time only some files are added, deleted, or changed. As a general practice, directly creating three independent image files will undoubtedly waste a lot of storage space, and too many image files will not be conducive to future management.

To solve this problem, imagex contains an additional function. Simply put, this function can save Multiple Operating System Images in different States in an image file. For example, in the preceding scenario, the operating system is attached to the same image file in different States at three times, because there are a large number of files in three states that have not been changed, these files actually only need to save one instance in the image file, this further reduces the size of the image file based on compression.

Note: two terms are mentioned: "image" and "image ". To facilitate the description, the following two terms are defined as follows: The File Created by copying the partition where the operating system is located is called an image ", multiple "Images" are appended to form an "image ".

In the above operations, we have created a complete image data for the entire system disk. wim. If we only installed the operating system and didn't install drivers and applications, we can now start to normal windwos and install all the drivers and programs as needed, then restart the computer to Windows pe(( do not forget to run sysprep.exe ). To create a new image and attach it to an existing image file, run the following command:

Imagex/append C: D: \ data. Wim "Drive C 2"/verify.

"/APPEND" is used to attach the target partition to an existing file. Note that if the "/APPEND" parameter is used, you do not need to use "/capture" at the same time. "D: \ data. Wim" specifies the location and name of the file to be appended.

Note: If the attached source image file is compressed, the attached image file must be compressed at the same level.

Configuration File

Some options of imagex can be specified by the configuration file, so that we can write the configuration file in advance and then execute it once to implement complicated operations. To specify the configuration file, start imagex with the "/config" parameter. The configuration file contains three main fields. Their meanings are as follows.

[Exclusionlist]
Defines the names of excluded files and folders after the "/capture" parameter is used.

[Compressionexclusionlist]
Defines the name of the file or folder that is not compressed, or the file type. Wildcard characters can be used here.

[Alignmentlist]
The specified files are arranged in the 64 K range. These files are not compressed, and the compressed files are arranged in the 32 K range.

It is called through the "/config" parameter during callback.

Open windows notepad or any other text editor, enter the [exclusionlist], [compressionexclusionlist], and [alignmentlist] fields, and set the content for the three fields as needed.

For example, if you want to skip the paging and sleep files when creating an image file, you can add the names of the two files in the [exclusionlist] field: "hiberfil. sys and pagefile. sys ". Note that each file occupies one row of space. If we want to reduce the compression of all files with the extension name ".zip" (after all, they have been compressed, and the compression can only be extended for a longer time, and the volume changes will not be too obvious ), you can add "*. zip.

Note: In general, if you want to use the configuration file, you must use the/config parameter when running the imagex command and specify the location of the configuration file. However, if we first save the configuration file wim.inias the name in the folder where the imagex.exe file is located, the configuration file will be automatically loaded if the "/capture" parameter is used for subsequent running, whether we use it with the "/config" parameter or not.

Image File Maintenance

We have learned how to create and apply image files. In terms of daily maintenance, what can this new file format bring to us? Note that all the operations described previously run in the command line environment of Windows PE using imagex, and some functions to be introduced can be operated in normal Windows mode.

View Image File Information

First, let's continue to discuss a problem in the previous article. For image files attached with multiple images, you can add numbers to specify which image to operate on. But after a long time, how do we know how many images exist in an image file? This requires another imagex parameter "/INFO.

Or the image file data with multiple images attached to the above file. for example, run the following command in Windows PE: imagex/info d: \ data. wim, we can see that the program will automatically display a file saved in XML format, the content of the file is the information of all the attached image files in the image file (Figure 3 ). You can check the content in the field "". This is the description we entered when using the "/capture" parameter to create an image. Therefore, you must enter detailed descriptions to facilitate future use.

View Image File Content

As the usage time increases, administrators may need to manage more and more image files for various purposes. It is very important to quickly find your target from multiple image files. By using the "/DIR" parameter of imagex, we can directly display an image file, or even the content of an image attached to it. The usage of this parameter is as follows: imagex/dir d: \ data. Wim 1.

First, let's try to use the "/DIR" parameter to list the content of a specific image in the image file. Return to the normal Windows status (note that this step cannot be performed in the Windows PE environment. You must return to the Windows environment) and run the following command:

Imagex/dir d: \ data. Wim 1

This will display the image content contained in the Data. Wim image file (if the image file contains multiple images, you can also specify a specific image by number ). There are a lot of content displayed here, which is inconvenient to view, so we can use this command:

Imagex/dir d: \ data. Wim 1> D: \ list.txt

This command can output the displayed content to a text file named list.txt on the dashboard. It is quite easy to use a text editor to view and search for a specific file.

Note that even if your image file contains only one image, you still need to specify the image number after the file name when using the/DIR parameter, otherwise, the contents cannot be listed. It is unclear whether this is a design feature or a software bug.

Map the image file content to a folder

In addition to the "/DIR" parameter, you can also use the "/Mount" parameter and "/unmount" parameter to map the specific image in the image file to a folder on the local hard disk and edit the content. The "/Mount" parameter has two options: "/Mount" and "/mountrw". The former can map the image to a read-only folder, and the latter can map the image to a read/write folder.

Note that these two commands can only be used in Windows XP SP2, Windows Server 2003 SP1, and Windows Vista. Before ing, install the wim fs plug-in, which is provided in the Waki toolkit.

After installing the plug-in, run the following command in the command prompt line window:

Imagex/mountrw E: \ c E: \ data. Wim 1

"E: \ c" means to map the image to the folder named "C" next to the edisk. If there are files in the folder, the original content cannot be accessed before the mapped image is detached. After the image is mapped, you can use Windows Resource Manager to open the mapped folder, view the content, add or delete files, or perform other operations like operating the local hard disk.

Because the previously used parameter is "/mountrw", the mapped file is writable, so after use, in order to make the changes to the file take effect, we need to use the "/unmount" parameter with the "/commit" option to merge the modifications to the image file and unmount it. Run the following command: imagex/unmount/commit E: \ c.

Image extraction and Deletion

Sometimes you may encounter this situation: an image file is attached with many image files in different environments, but one of them is useless. To reduce storage space usage, you may want to delete unused image files. At the same time, you may need to extract the independent image attached to an image file for other purposes. These tasks can still be implemented using imagex parameters (this section must be operated in Windows PE environment ).

To delete an image attached to an image file, use the "/Delete" parameter, for example, imagex/delete D: \ data. Wim 1. If you want to extract an image from the image file, you can use the "/export" parameter, for example, imagex/export D: \ new. Wim D: \ data. Wim 1.

Note: When extracting an image, make sure that the partition of the target image file has sufficient available space. If the available space is insufficient, the program will not report an error and will still generate a new image file, but the file itself is incomplete.

Imagex.exe Insufficiency

Although there are many advantages, currently imagex.exe still has many shortcomings, mainly manifested in:

Imagex can only be used to create and apply images for complete operating systems and applications. Some third-party photo recognition tools can be used to create visual differences between the operating system and the application. This imagex.exe cannot be used.

Imagex can only create and use. WIM (Windows imaging) format image files. Images created using other third-party tools are not supported.

Only one compression level can be used for the same image file, and the attached image file must also use the same compression level as the initial image file.
The ing of image files can only be performed in Windows XP SP2, Windows Server 2003 SP1, or Windows Vista. However, imagex can create image files for Windows XP, Windows Server 2003, and any version of Windows 2000 without service pack installed.

Only image files stored in the NTFS file system can be mapped to folders with read/write permissions, the image files stored in the fat, FAT32, ISO, or UDF file system can only be mapped to read-only folders. This is mainly to avoid data loss caused by the maximum size limit of 2 GB files in the fat/FAT32 file system.

This tool does not support disk operations because it uses other Microsoft tools, such as diskpart and format, to prepare disk partitions for volume images.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.