📜 ⬆️ ⬇️

Frivolous cloning of the OS MS Windows XP / Server 2003 with their own hands, using GNU / Linux

Explanatory note


I publish the logged result of work on providing myself with a universal, tenaciously installed operating system (hereinafter referred to as OS) of Windows XP SP3.

It was needed to speed up the installation of the system on the computers of clients who wished to use this familiar version of the windows without fail, despite the ranting of support, activation and other unimportant moments.

Why is this necessary?


')
What distinguishes this material from common articles on OS cloning? Restrictions set before my life and myself. I will list them:

1) The OS must be installed and run on partitions of arbitrary sizes;
2) The OS should be properly loaded, being installed on any type of media that supports loading (equipped with MBR *);
3) The OS should operate on different variants of the device-dependent level (HAL **);
4) The OS image should occupy a minimum of space on the carrier to speed up its transfer, retrofit, and bulkheads;
5) The OS image must include the necessary set of software installed and configured in the best way (option "turnkey system");
6) All manipulations on the preparation of the image and on its scan should be made by regular means of GNU / Linux ***. Meaning: parse the principle of the existing software for cloning the OS;
7) The carrier of an OS image can be a server on the network, a USB drive (solid-state or hard drive), an optical or hard magnetic disk;
8) The carrier of the OS image must be equipped with diagnostic and repair tools for the computer software;
9) It is desirable to make the OS cloning process as accessible as possible for the sake of good repeatability without reducing the reliability of the result;
10) The dd command is undoubtedly good, only the reluctance to mess around with empty space, zeros and the lack of a clear conclusion of the current action. In addition, the section in which the clone will be installed must be arbitrary (see Section 1).

Outside of consideration:

1) Legal aspects of installing a currently unsupported OS;
2) Activation of the OS that is currently not officially activated;
3) The feasibility of actions taken. Not for the sake of red- eyes , but only by the will of the users who sent me. Sent for trying to convince kosher use of fresh free software on their crapbreakers;
4) Details of the typical installation of Windows XP and add. Software on a computer, with the exception of disk partitioning;
5) Details of the network cloning method: I will consider it in the future; now I don’t have such a need.

Who needs it?

The work is focused on meeting the needs of end users. The article is written for system administrators who want to learn from my experience and knowledge and use the method described below. Hence the details that might not like the hasty people. The volume of the text, in my opinion, monstrous for easy perception, but I can not do it otherwise: it is necessary to convey my every step.

Constructive criticism is welcome; Especially valuable are suggestions for improving the method, as well as a theory that justifies the comments.

The article was written on December 2, 2014, so I send my regards to future generations, and I don’t know how much the material remains relevant to you.

Welcome,% username%, under the segment.

What needs to be done at all?


Dear reader, cloning involves the preparation of tools and materials, their creation of a clone and its distribution (installation). The Windows XP operating system is satisfied with the capriciousness of any waving flash drives, and especially nasty moments await us at the stage of installing the bootloader and when starting the cloned OS on SATA controllers enabled in AHCI mode. However, patience and hard work all a little bit.

Terms



To begin with, we introduce terminology .

1) Reference computer **** , or reference computer = PC, which is a clean installation and configuration of the operating system, the necessary programs, updates. Accordingly, the resulting software is called the reference OS ;
2) OS clone , it is also the image of the reference OS = archive, which contains the contents of the system partition of the installed OS. And nothing more;
3) Target computer (target computer) = PC on which you want to deploy the resulting clone of the reference OS;
4) Under the add-on software, I distribute distributions of all kinds of office programs, multimedia codecs and players, a normal human browser. Anonymous, you yourself define it!

Inventory



We describe the materials necessary for the work.

0) Strong hands, an inquiring mind, a strong desire for results. In the absence of any component, anonymous, you were warned;
1) Full information about the hardware configuration of the target computer, specifically: the name of the controller NCW *****. If it is built into the motherboard, then the name of the south bridge is required (hereinafter referred to as YuM).
2) A clean image of the installation disk of MS Windows XP; service pack and language = to taste. In the household of each broad admin should be;
3) The image of the GNU / Linux boot distribution = to taste; Required support for working with file systems NTFS, FAT16, FAT32. The maximum set of drivers on board is desirable. I used the ubuntu-12.04.5-dvd-i386 distribution;
4) Minimum set of external media: optical disc for Windows XP installer, any bootable media for Linux distribution and storing a clone of the reference OS. I used USB-HDD: a lot of space, enough for everything, and the normal partition table to the heap;
5) Prepare media and dig the necessary materials needed on a running computer running a network OS. I used the usual office PC and the Ubuntu 12.04 distribution for this. I can safely assure the username: everything can be done from under Windows;
6) A fresh driver for the NCM or UM controller of the motherboard of the target computer, compatible with Windows XP;
7) Unpacked archive driver.cab (you can find it in the image of the Windows XP installation disk);
8) Unpacked archive deploy.cab (you can find it on the Microsoft website );
9) Unpacked grub4dos archive ( links to builds, Russian-language manual ). And the additional help for the young, impure, clouded consciousness of the young admin:



Bake clone

Here, we have collected all of the above, let's brush our brains with the general scheme of creating a clone . Details will be discussed later.

0) Prepare a reference computer: let it be a computer with a hardware configuration that most closely matches the configuration of most of the target computers;
1) Prepare bootable media for a clean installation of the OS Windows XP (in other words, a bootable disc with Windows);
2) Prepare a bootable media arbitrary distribution of Linux. It will serve us as a means of preparing / developing a clone, as well as diagnosing / repairing the target computer. It should have an unpacked grub4dos archive;
3) Install Windows XP on a reference computer, configure it most generally (as customers like most);
4) Install the list of additional software on this OS, set up;
5) Install the driver of the NCMJ target computer on the reference OS;
6) Write the necessary tools to prepare the clone in the root section of the reference OS. We complete the work of the target computer.
7) Load the Linux distribution media on the reference computer, mount the file system (hereinafter FS) of the partition with the reference OS installed;
8) Create a clone of the reference OS, save it to arbitrary media mounted on Linux (in my case, the same Linux boot media).

Serving on the table



The clone is created and looks at you,% username%. Now it’s common how to roll it onto the user's target computer:

0) Take the Linux distribution media, go to the user, drive it away, stick the media into his (target) computer. Start!
1) If you do not smoke, download our live distribution of Linux;
2) From now on, the rollback of actions will be very difficult , I warned. So, we mark in a new way a hard disk (or SSD?) Target computer. Create a section for it on Windows. Format it (I would choose ntfs). We mount the received section somewhere;
3) Extract the clone of the reference OS in the resulting partition of the target computer;
4) Install the Grub4Dos loader on the target computer;
5) Turn off, take out extra carriers, take a deep breath, launch;
6) If everything went well, you will be met by the Windows XP pre-install program, where you and the user will set everything up as it should;
7) I will use overseas word: PROFIT!

How do we achieve this?




So, my patient reader, we got to the very pulp . Yes, now the coveted lines of commands will be displayed on the monitor screen, detailed instructions will be announced for each step of the scheme for creating and rolling a clone. The title should have been called “How I did it,” but I hope that you will succeed exactly the same way!

Inventory preparation

I repeat, I was preparing everything under the Ubuntu 12.04 OS.

1) Get clean MS Windows XP installation, devoid of all kinds of bells and whistles, they are also called 'MSDN images'. Preferred embedded service pack. After getting it, roll it onto a suitable optical disc. I did this with the Brasero program;
2) Download any suitable GNU / Linux distribution with the ability to boot from any media (the so-called Live-system). Requirements: wide support for various hardware, support for NTFS, FAT16, FAT32 file systems. For best compatibility, get a 32-bit OS. Repeat: I used the ubuntu-12.04.5-dvd-i386 distribution, satisfies in all respects. Torrent , link to direct download;
3) You can roll up the extracted Linux from under Ubuntu using the usb-creator-gtk program, everything is intuitive there. I rolled up to a separate clean 160GB USB-HDD with one NTFS partition, allocating all the remaining space to stored files and folders; thus, I immediately got a boot disk and space for various tools, clones, user data and a library of programs;
3.1) Nobody prevented me from properly marking, formatting my USB-HDD, and writing an image on it using the command:

dd if=/--- of=/dev/sd{ } [ bs={      } ] 
.
Only it is better to wait until the disc indicator stops blinking, because the command is insidious;
4) Add the unpacked archive with a fresh build of Grub4Dos ( download here ) to the media with vivifying Linux. Desirable closer to the root. Why rude 4dos? Yes, because I do not want to force you to master the joys of a native Windows bootloader, but it's rude and more pleasant to tune. This archive contains the menu.lst boot menu management file: if you want to configure the bootloader, do it now in any text editor. Details here ;
5) On the same carrier, if space allows, place the installation software packages that will be needed by users. In any directory, of course;
6) In order to ensure the best compatibility of Windows clone with various motherboards (or rather, power management methods), there will subsequently be a need to supplement the list of loaded XP cores. To do this, unzip the i386 / Driver.cab archive from the Windows XP installation image. In it, look for the following dll: hal, halaacpi, halacpi, halapic, halmacpi, halmps, halsp. Copy these files to some directory of Linux bootable media, we will need them soon;
7) In order to avoid problems with booting XP on the target computers, download and unpack the latest drivers from suitable NCMD controllers. If the controllers are built into the motherboard, download drivers to its YuM. In any case, you will have to reinstall the drivers after on each target computer. Save the drivers on the same Linux healing media;
8) Admin! Be attentive and careful. Check all that you dropped on this multi-purpose media, learn the paths to the files. Know: you may have to look for them in the Linux shell. Do not scatter files, better distribute them correctly catalogs. And finally, copy the installation image of Windows on the same media: the stock of trouble does not repair.

Clones, it's time to execute command 66!



We have prepared the necessary. We take the reference computer in hand, the disk with Windows in the teeth. Our task: to install and configure the reference OS, ext. programs, to make preliminary preparation of the cloned system.

1) Install the reference axis on the reference comp. We add according to need a minimum of the necessary programs, so as not to be pressed after them. Activate the Windows and the program now is not worth it: you need to do this at the end user on the target computer;
2) We work for this OS. Objective: to ensure, after cloning, the choice of the configuration of power management of the motherboard of the target computer. Connecting our bootable media with Linux `: I guess you formatted it in NTFS? Copy from it to the directory% systemroot% \ system32 \ files {halaacpi, halacpi, halapic, halmacpi, halmps, halsp} .dll, previously saved by us on the media in a secluded folder. This is a microkernel for booting an OS with a particular motherboard device. In order to use these kernels, change the configuration file of the Windows% systemdrive boot loader% \ boot.ini. Do not forget to create a backup file! You should get something like this:

 [boot loader] timeout=10 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Standart PC" /fastdetect /hal=halstd.dll multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="ACPI PC" /fastdetect /hal=halacpi.dll multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="ACPI Uniprocessor PC " /fastdetect /hal=halmacpi.dll C:\grldr=" GRUB4DOS" 

Do you recognize? This is the most hidden choice of the XP installer, available by pressing F5 when installing from disk. The last line will serve us in the future;
3) If you downloaded a fresh hard disk controller driver for the target computer, install it in the reference XP forcibly. Good for you! Otherwise, you will have to get bogged down in the target computer's BIOS, turn on the compatibility mode (IDE) ...
4) Check the entire system. See if everything is set up correctly. Further actions will need to be performed without rebooting;
5) Prepare the system for final cloning. To do this, look for the deploy.cab archive, which we saved in advance on the Linux bootable media. Open with any archiver, and then unzip the SYSPREP folder to the% systemdrive% root (disk C: our way). This is a natural microsoftware tool for preparing the OS for cloning. We will use it in order to avoid a handful of minor problems like the same SID of the cloned OS, the same activation data and all that. This is done in detail like this:

5.1) Run setupmgr.exe. Select Create a new answer file, Sysprep Install. CAREFULLY choose your version of Windows. Answer Yes, full automate the installation. Fill in the fields as we want and click "Next." The program will save the results of its work in the file C: \ SYSPREP \ SYSPREP.INF.
5.2) Run:

 c:\sysprep\sysprep.exe -pnp -mini 

Change Shutdown mode to quit, click "Reseal" and wait for the program to finish.
We will be attentive. The next time the system boots, the installation will start, so it is better not to allow it to reload.
6) Most likely, the reference OS has completed its work. Now it is time to take off her image. To do this, we connect our vivifying media with Linux `to the reference computer, boot from it (do not allow XP to boot!). Of course, we are not interested in installing the system, but simply downloading. In the case of Ubuntu, we get a graphical interface and a bunch of different useful applications;
7) Today we act decisively and quickly. Open the terminal emulator (ctrl + alt + t), execute the sequence of commands:

 sudo su mkdir /mnt/sd{1,2} 

- we go under the root and create mount points for two carriers. Our task now is to mount the drive on which the reference OS is installed, and the external drive with Linux and our files. We do this by substituting the necessary values ​​for partitions and disks into commands:

 mount /dev/sd<. _1- > /mnt/sd1 mount /dev/sd<. _ > /mnt/sd2 

Check whether we have mounted:

 ls /mnt/sd1 ls /mnt/sd2 

Catalogs for image transfer are ready;
8) Pack a Windows clone using the tar command:

 cd /mnt/sd1 tar -czvf /mnt/sd2/xp.tar.gz ./* 

9) Observe the packing process. I got the xp.tar.gz archive in the root of the Linux media, approximately 1.2GB in size. This is a ready-made clone of the reference OS!

Clone spread



Until a sustainable result, I had to do these steps fifteen times.

The task now is to roll our image onto the test target computer, install the bootloader and make sure that everything works .

1) Take with us our vivifying carrier Linux ʻa. On it now there is a clone, and a means to put it. We connect to the target computer, we load Linux. Open the terminal emulator again and start working;
2) Mark up the hard disk of the target computer. I use the old-fashioned program fdisk. Attention! If there is something valuable on the target drive, do not forget to copy it to a reliable backup medium! After that we execute the commands:

 sudo su mkdir /mnt/sd{1,2} mount /dev/sd<  ,  > /mnt/sd1 ls /mnt/sd1 mount /dev/sd<  ,   > /mnt/sd2 ls /mnt/sd2 

So, we checked that we identified the disks correctly. Suppose everything is correct, and everything is mounted exactly as indicated. Then we proceed further (hedgehogs #, of course, do not enter, this is a comment):

 umount /dev/sd<  ,   > fdisk /dev/sd<  > #   o  #  n  #  : ,  1, ,  ( ) #    NTFS t  1  //  7  //=NTFS #   ( -) a  1  #        ( !) w  

The fdisk program should exit successfully. Otherwise, complain, and then look for a solution on the web. Often, the admin forgets to unmount the media before changing the partition table; this does not allow overwriting it. Will help umount;
3) Format the resulting partition in a quick way in NTFS, mount it:

 mkfs.ntfs -f /dev/sd<  ,  > mount /dev/sd<  ,  > /mnt/sd2 ls /mnt/sd2 

The output of the last command must be empty;
4) Let's unpack our clone of the reference OS into this section:

 cd /mnt/sd1 tar -xzvf xp.tar.gz -C /mnt/sd2 

We sit, quickly drink coffee, in one gulp!
5) The last major touch: install the bootloader. Let me remind you, we unpacked the archive of the fresh build grub4dos on the Linux media:

 cd /mnt/sd1/    ls #    ,   : ./bootlace.com /dev/sd<  > #      grldr   menu.lst       : cp grldr menu.lst /mnt/sd2 

6) Turn off the target computer, you can:

 shutdown -h now 


Is the end of the torment?


All my patient reader! If the stars are formed today correctly, you did it. If not, then either I missed something, or - lay out the configuration, we'll see.

Thanks for attention!

Source: https://habr.com/ru/post/244893/


All Articles