Clone Windows XP cd to usb pen drive using dd command

0

How to make an exact copy of Windows XP bootable cd using dd command in linux to an usb flash drive so to be able to use the flash drive to install XP in a netbook.

P. Kod

Posted 2018-03-12T17:46:14.893

Reputation: 43

Did you know about Rufus? If you have access to a Windows machine with a CD drive, it is difficult to make easier!

– AntoineL – 2018-03-12T19:25:45.433

I won't present this as an answer, since I have not tested it with Windows XP. However, I know this procedure works with Windows 7, 10, and Server 2012. http://www.intowindows.com/install-windows-10-from-usb-drive/

– Charles Burge – 2018-03-12T21:06:42.523

@AntoineL: i didn't know about Rufus, i heard about Winsetupfrom USB but it containes trojans but the issue is i'm obliged to work in linux. – P. Kod – 2018-03-12T23:49:47.037

@Charles Burge: i previously tried this method but making the flash disk partition active doesn't work for XP but i didn't tried to edit the mbr with the command Bootsect /nt52 that make XP disk partition bootable. – P. Kod – 2018-03-12T23:54:01.410

@CharlesBurge: it does not work with XP, because its older boot manager/loader is not able to load Windows from the USB disk (it lacks the the whole USB stack, in fact). Any solution requires of some additional component which is able to mount at boot time the USB disk, for Windows to load and start. – AntoineL – 2018-03-13T08:22:04.793

@AntoineL I just tried Rufus, prepared the ntfs usb drive with xp iso image but the usb doesn't boot. – P. Kod – 2018-03-13T18:14:57.980

@P.Kod: I am unfortunately discovering that XP is now unsupported by Rufus, which makes me really sorry. I cannot guess why the USB does not boot. The next best bet is to install some small operating system (either Windows PE v2+ or a Linux distribution will do) on the USB along with the XP ISO, boot it on the netbook, transfert the I386 directory to the hard disk, then install XP directly from the hard disk I386\winnt32.exe. PE is harder to set up and pickier for the ISO, Linux is easier until starting the .exe

– AntoineL – 2018-03-13T18:45:27.160

@AntoineL I will try this, i am lucky i have previously created Winpe iso image from Windows AIK (for Windows 7) let's suppose i successfully run the I386\winnt32.exe how to exactly write the syntax for installing Windows XP and should i copy the I386 folder only or the entire folders contained in the iso ? – P. Kod – 2018-03-13T20:18:32.513

Look at Microsoft Setup instruction about winnt32 syntax. It has been a long time I used it but I feel it should work without any argument at all. The I386 folder (which is 98% of the content of the ISO!) with its subfolders is all what you need; but it needs to be present on the hard disk for the 1st (blue screen) step to succeed. Also while I am on it, if your netbook is presently using AHCI, you should address that, either adding the relevant Mass Storage Device driver into the hard disk's setup files, or switching it to IDE (Legacy) mode at least until XP is installed. – AntoineL – 2018-03-14T09:45:47.183

@AntoineL I have run the setup of Windows XP from Winpe after formating the C drive and made it active, the syntax is I386\winnt32.exe /noreboot /s:"path to I386 folder" the problem is i get missing bootmgr after reboot, i didn't add sata drivers because i don't find it in hp support second i don't know where to put the files, people seems to use nlite but i prefer to copy the drivers myself. I searched a lot and didn't find information about the folder i should put the sata drivers in, if you want still to continue helping me i would be thankful, i never imagined windows XP is obstinate. – P. Kod – 2018-03-14T21:52:20.660

@AntoineL May be i need to run another command included in the setup cd that will modify or create the bootmgr, i remember i have done the same thing when i had a similar problem with Vista years ago, i deployed Vista image but get booting error then i activated the mgr by running bcdboot command in Winpe, is there someting equivalent to bcdboot in XP ? – P. Kod – 2018-03-14T22:34:54.113

@P.Kod: there is no direct equivalent of the "reparation" command bootrec (unfortunately). There are two small utilities, available in the recovery console, fixmbr and fixboot; but installing and starting the recovery console itself is exactly what you want (it cannot be installed on USB). Once you are in WinPE, you can run bootrec /FixMBR then bootsect /NT52 α: and copy NTLDR in the root directory to restore booting. The equivalent of the BCD is the text file BOOT.INI, it is easier to manage; the equivalent of bcdboot is notepad! – AntoineL – 2018-03-15T14:27:19.677

1@AntoineL I solved this issue, it's better not to copy I386 in C: drive, i have run winnt32 from the flash disk directly using this command: F:\I386\winnt32.exe /makelocalsource /noreboot /syspart:C: /tempdrive:C: where F: is Flash disk letter and C: is the primary active partition in the hard disk. On reboot WinXP started but i encountered blue screen cause of Sata drivers. Now i consider first part of my thread solved, back to my dd command how can i copy C: files with dd and then in future restore WinXP using dd ? this seems easier than applying WinXP iso to hard disk. – P. Kod – 2018-03-15T21:01:09.550

Nice after all! I did not remember that subcommand /makelocalsource (14 years I did not use it!) but yes it should make the trick, and it did for you. You should make it an answer for Google to make it more visible. – AntoineL – 2018-03-16T07:29:17.130

About the SATA drivers this is another, orthogonal problem, which I am sure you could encounter detailed solutions on the web; an integrated tool is often recommended; this article seems a nice explanation at cursory reading; of course you need to bias it since you do not need to make the ISO, just keep the source on the USB.

– AntoineL – 2018-03-16T07:40:54.213

About dd, let me do a quick recap at XP installation (in fact NT 3.x/4/5.x): first phase is running winnt[32] one way or another, it installs the minimum startup engine on the target, assuring that it will boot at next restart and also make available al the needed material for the next phase; then a reboot is needed. – AntoineL – 2018-03-16T07:48:20.670

Second phase, with blue background screen, a.k.a TEXTMODE, copies into the final place all the files from the I386 source (which could have been copied in the preceding step, exactly what your found); there are very little space for interaction here, albeit "F6" integration of mass storage drivers and TEXTMODE.OEM should be noted. At the end, there are no other choice than to do a reboot. Third step is the GUI part of the installation. Where in this sketch want you dd to operate? – AntoineL – 2018-03-16T07:53:42.223

@AntoineL Firstly i want to thank you for the links, i must admit that i find it a bit challenging because i never tried before to automate a windows installation, sure i want to integrate drivers but i want to edit files myself without using DriversPackBase or nlite i mean i want to do exactly what these software do using a text editor, i just don't trust 3rd party software, I found a download for sata drivers in hp support and there is a help file showing how to integrate the drivers to WINXP CD. – P. Kod – 2018-03-16T23:19:12.653

I just have to create two folders I386\$OEM$\$$\INF and I386\$OEM$\$1\drivers\IntelINF then copy the INF files into the first folder and copy INF and .CAT files into the second folder and finally edit the so called answer file UNATTEND.TXT by doing this [Unattended] OemPreinstall = Yes OemPnPDriversPath="drivers\IntelINF" So i think this is what nlite and similar software are doing. – P. Kod – 2018-03-16T23:21:20.157

@AntoineL I didn't formulate my question in a good manner about dd, i just mean in case i have finalized installing WinXP will it be possible to copy the new installed OS ? the correct term is making an image of the OS (but not the whole C: drive) so in future when i want to reinstall XP i will just run dd in my linux partition and copy the clean image to C: drive again, it will be better than doing all this things again with WInPE. I hope it's clear now, thank you for your answers it really helped me a lot, i will resume this in an answer when i finish reading about automating windows setup – P. Kod – 2018-03-16T23:34:14.497

OK now I got it! It was usually called "cloning" and also "ghosting", from the name of a then-famous tool for that purpose. With dd I do not know, problem are NTFS metadata. I believe you need to first install XP in a very small disk and image that with dd. On restore, after running dd on the same hardware, you then need to extend the disk to the full available disk space: read KB325590 to learn how; GNUPart should be able to do that as well, although I never tried. Should work; but starting from installed XP, not from the boot CD.

– AntoineL – 2018-03-21T08:42:34.400

@AntoineL What you described is exactly what i was hoping to do with dd command and you are right we can not clone a part of a drive/partition this is done by imaging the whole drive so your idea is to install the OS on a small drive to be extended later, i will put this in my mind because now i installed XP but i will still be searching for a way to export the portion where the OS is installed (stocked in the disc) and to apply the copy (small size) in the partition i want, if i will succeed doing this i will mention you in a comment or message you and now i think my topic is solved : ) – P. Kod – 2018-03-25T00:09:37.090

Answers

0

I solved my problem, i created a winpe flash drive and copied into it the I386 folder from the windows XP cd which contains the sata drivers, if your copy of XP doesn't contain Sata drivers you can add them by using nlite (use an old version because they are virus-free).

When you boot WinPE, browse to the I386 folder and run the winnt32.exe by typing this command

F:\I386\winnt32.exe /makelocalsource /noreboot /syspart:C: /tempdrive:C: 

where F: is Flash disk letter and C: is the primary active partition, make sure you previously formatted and made the C: partition active using the command diskpart.

If you want to install windows XP by using the linux command dd the only way you can achieve this is by installing windows XP in a small disk and image that disk with dd, now with that image you can, every time you wish, apply it to your hardware and extend it to the full disk space, see here how to extend volumes KB325590

P. Kod

Posted 2018-03-12T17:46:14.893

Reputation: 43

1

You don't. Not with dd.

Some linux distributions have special hybrid isos that are sufficiently valid as both a bootable cd and a bootable disk so you can copy one to the other and use the same image, but cd and flash stick booting protocols are different and incompatible. I think flash drives boot similarly to hard drives and floppy discs, at least in the BIOS (non-efi) versions.

I think I have seen software that can convert XP installation cd to a usb stick, but it needs to do non-trivial alterations.

Maybe Rufus would work, as @AntoineL commented.

Also, relevant answer from sidebar: Installing Windows XP from USB pen drive.

Edit: If you don't have a Windows host, you could try wine, maybe with some fiddling to access the drive properly. Or a windows OS on VirtualBox, if you have the RAM for it. You can use windows from the installation CD, download freely virtual images available images from Microsoft or many other options.

Ivan

Posted 2018-03-12T17:46:14.893

Reputation: 178

I don't know much about booting so i thought cd and flash drive booting protocols are the same, i am not sure if it is possible to make the pc think the usb drive is a sort of cd i mean the flash will mimic a cd filesystem, is this possible ? – P. Kod – 2018-03-13T00:18:57.963

@P.Kod A flash can have a cd filesystem (though Windows might not accept it), but the method of hardware access and the boot process is quite different. You need different drivers, probably bootloader and configuration. – Ivan – 2018-03-13T10:04:47.157

I used Rufus as AntoineL suggested but it didn't work, i don't know why because in the link you posted they say Rufus can create windows Xp installer, i used a 4GB flash disk and Windows bootable image ISO. – P. Kod – 2018-03-13T18:17:13.450

0

AFAIK Windows cannot be copied this way. It needs some special treatment and I haven't found any programs (half a year ago) on Linux that are able to do so.

dd command will run succesfully but you won't be able to install any Windows from that flash drive. Your safest bet is doing it on Windows.

Karol Bienkowski

Posted 2018-03-12T17:46:14.893

Reputation: 1

You are right 'dd' run successfully but the flash drive can't boot even if it contains the same exact copy of the disc, i don't know how to modify usb mbr in linux to make it boot windows XP. – P. Kod – 2018-03-13T00:03:20.103