Recently, I bought an old Surface, for playing, not for productivity. So, before I get mess with the system when playing, I need to backup everything on the disk of the Surface. If I do mess with the system in the future, I can recover the system with the backup. I’m a savvy doing backup on PC: boot from a USB disk, run ghost to clone all disks/partitions on the target PC to images, and save the images on safety place. But I’m a newbie playing with Surface. I even don’t know how to boot up Surface from an external USB drive. The BIOS of Surface is not as advanced as that of PC. I could not find a place to change the bootup device in BIOS. After doing some research, I finally got to know how to boot up Surface from USB disk:
- shutdown Surface
- plugin in a bootable USB disk
- press the Volume-down button(on the left side of your Surface) and don’t release
- press/release the power button(on the right-top side of your Surface)
- when you see a spinning circle on bottom of screen, release the Volume-down button
The bootable USB disk was created with Windows PE on it. The Windows PE system starts without a problem and I can see a cmd window appear on the scree. So what? I cannot type a character on the cmd window. This is because I cannot use the blue-tooth keyboard accompanied with the Surface. I cannot use an ordinary cable keyboard,either, because the USB port is being occupied by the bootable Windows PE USB disk and I cannot connect my cable keyboard to Surface. I don’t know how to enable blue-tooth on Windows PE which is rather complex task.
I finally find a way out: let Windows PE automatically start the backup program after booting so that I don’t need to type anything. How to let Windows PE automatically run a script/program in its initial stage? In DOS, you can write an autoexec.bat, but in Windows PE, you should modify a Windows PE system file:Windows\System32\startnet.cmd to add the path name of the to-be-executed program as a new line. But where is the file located? I cannot find it in the created Windows PE bootable USB key. The file(and all other Windows PE system files) is saved in D:\sources\boot.wim supposing your USB drive is D:. The file is in binary format so you cannot see or edit its content directly. How to edit startnet.cmd? You should mount boot.wim on an existing directory on your PC first, using the following command. Then, you will see the file and all other system files in that mount directory.
dism /Mount-Wim /wimfile:D:\sources\boot.wim /index:1 /MountDir:C:\Mounted_images\boot
Note that you must create a directory C:\Mounted_images\boot on your PC before running the command.
You can now edit the file C:\Mounted_images\boot\Windows\System32\startnet.cmd to append a new line:
D:\symantec\Ghost64.exe
This line instructs Windows PE to run the backup program D:\symantec\Ghost64.exe after initialization(the first line in startnet.cmd would be like winpeinit). You need to tweak the path name carefully, otherwise Windows PE may complain “cannot find the specified path name”. After Windows PE starts up, its system directory is typically mapped into X:, while the bootable USB drive itself is typically mapped to D:.
Then, you should unmount C:\Mounted_images\boot and commit the change:
dism /Unmount-Wim /MountDir:C:\Mounted_images\boot /commit
If you got error unmounting/mounting the directory, you can try:
dism /Unmount-Wim /MountDir:C:\Mounted_images\boot /discard
To avoid typing using a keyboard when doing backup in Windows PE later, you should create a file in D:\surfacebackup.GHO which can be selected in GUI of ghost as the destination image file name.
Now, you can plug out the USB key and plug it in your Surface and boot up Surface using the method discussed above. Ghost will back up the whole disk of Surface to D:\surfacebackup.GHO(and D:\surfa001.ghs, D:\surfa002.ghs,…. if the content to be backed up is too large to be saved in single file).
reference: https://serverfault.com/questions/85579/windows-pe-autorun-scripts