Jump to content

Need WinPE way to backup/restore MBR & a boot sector...


spinjector

Recommended Posts

Hi,

I have the Vista version of WinPE from the free/downloadable Windows AIK... I think it's version 2.1..?

I need a 32-bit command-line utility that I can use to back & restore both the MBR and the boot sector of a partition.

But here's the catch - its has to have command-line options so I can script it with batch files.

Ideally, I'd like a single EXE that can do everything that DISKPART does, plus the backup/restore of the MBR and partition boot sectors. BUT if I have to use separate programs, I'll make it happen...

Thanks.

Link to comment
Share on other sites


Additionally, if you use dsfo/dsfi (DSFOK package) you can use my batches:

http://www.boot-land.net/forums/?showtopic=3191

http://www.boot-land.net/forums/index.php?showtopic=5000

http://www.boot-land.net/forums/?showtopic=2362

for inspiration about the batches you need to write.

Another set of maybe useful utilities for more "advanced" chores is of course the findpart set of utilities: http://www.partitionsupport.com/utilities.htm

jaclaz

Link to comment
Share on other sites

What problems did you experience with diskpart and mbrwizard? I ask because both of these utilities have been invaluable in protecting and restoring my mbr.

They appear to be 16-bit programs. They won't run on WinPE 2.0 (which is based on Vista); it only supports 32-bit programs.

>EDIT...

Sorry I read that too fast. Actually I've been quite successful working with DISKPART. However, I'm working with both a custom MBR and custom boot sector/os, in addition to an NTFS partition that I would also like to be able to save/write since I'll already be doing the other two anyways.

Edited by spinjector
Link to comment
Share on other sites

Thanks, guys. dd.exe seems to be exactly what I need - if only I could get it to work. I'm trying to track the problem down now.

There seems to be something missing from my build of WinPE 2.0 that's needed by dd.exe. When I run 'dd --list' nothing happens. I've confirmed this is a problem by trying on another machine. If I try my WinPE it doesn't work, however if I try Hiren's Boot CD 10, it works fine. Hopefully this is simply something I left out of my build, because if it's a shortcoming of WinPE 2.0 and/or an incompatibility with dd.exe for Windows, I'm about ready to toss this system out the window and laugh evilly as it smashes on the street... =-)

I'll start a new post for this latest woe.

Thanks for pointing me to dd.exe.

If that doesn't work, I'll try dsfok. It looked way above my head when I first checked it out, but now that I have my head wrapped around dd.exe, maybe it'll make more sense now.

Link to comment
Share on other sites

If that doesn't work, I'll try dsfok. It looked way above my head when I first checked it out, but now that I have my head wrapped around dd.exe, maybe it'll make more sense now.

Actually it has a simplified sintax, look:

dd [bs=SIZE] [count=BLOCKS] [if=FILE] [of=FILE] [seek=BLOCKS] [skip=BLOCKS] [--size] [--list] [--progress]

semplified to:

dd [if=FILE] [skip=BLOCKS] [count=BLOCKS] [of=FILE]

TO copy the MBR of hard disk 1 (Second hard disk) to file C:\mymbr1.bin:

dd [bs=512] if=\\.\PhysicalDrive1 skip=0 count=1 of=C:\mymbr1.bin

Example of output:

C:\VSS>dd /?
rawwrite dd for windows version 0.5.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by the GPL. See copying.txt for details
Unknown command /?
dd [bs=SIZE] [count=BLOCKS] [if=FILE] [of=FILE] [seek=BLOCKS] [skip=BLOCKS] [--s
ize] [--list] [--progress]
SIZE and BLOCKS may have one of the following suffix:
k = 1024
M = 1048576
G = 1073741824
default block size (bs) is 512 bytes
skip specifies the starting offset of the input file (if)
seek specifies the starting offset of the output file (of)

C:\VSS>dd if=\\.\PhysicalDrive1 skip=0 count=1 of=C:\mymbr1.bin
rawwrite dd for windows version 0.5.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by the GPL. See copying.txt for details
1+0 records in
1+0 records out

The same using dsfo:

dsfo \\.\PhysicalDrive1 0 512 C:\mymbr1.bin

Example of output:

C:\VSS>dsfo
dsfo v1.03-CLI, Freeware - use at your own risk
(c)2005 Dariusz Stanislawek, http://freezip.cjb.net/freeware

Usage: dsfo source offset size destination

Note: null size is interpreted as max possible output
negative size is calculated on current file size
negative offset is calculated from end of file
use "$" as destination to check MD5 signature only

Example: dsfo c:\tmp\my.avi -50000 0 test.bin
dsfo \\.\d: 0 512 c:\0\partition-sectors.dat
dsfo \\.\PHYSICALDRIVE0 0 0 \\srv\shr\tmp\first.dsk
dsfo \\.\a: 0 0 "c:\tmp\floppy disk image.img"
dsfo \\.\e: 0 0 d:\CDROM_or_DVD_image.iso

C:\VSS>dsfo \\.\PhysicalDrive1 0 512 C:\mymbr1.bin
C:\mymbr1.bin - Existing file.

(dsfo, UNLIKE dd will NOT overwrite an existing file)

C:\VSS>del c:\mymbr1.bin

C:\VSS>dsfo \\.\PhysicalDrive1 0 512 C:\mymbr1.bin
OK, 512 bytes, 0.000s, MD5 = fc5ffca90519daa9c9c8d5dfeb7911a4

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...