|
|
Correct procedure for saving/restoring the master boot record (mbr)?
This is in the "Is this all there is/is this OK?" category.
I did (as root):
1) dd if=/dev/hda of=/some/file/not/onhda1/mbr.bin ibs=512 count=1
2) dd if=/dev/zero of=/dev/hda count=32767
3) dd if=/some/file/not/onhda1/mbr.bin of=/dev/hda
4) (ntfsclone command to restore filesystem to /dev/hda1)
And, as far as I can tell, everything is fine. Machines boots into
Windows as before. Is this all OK? And, in particular, is there any
more "built-in" way to do it? Perhaps a way to do a DOS "fdisk /mbr"
from Linux?
Note that this was all just testing; no actual data was harmed in the
performance of this test.
|
|
0
|
|
|
|
Reply
|
gazelle2 (1306)
|
4/5/2007 5:28:16 PM |
|
On 2007-04-05, Kenny McCormack <gazelle@xmission.xmission.com> wrote:
> This is in the "Is this all there is/is this OK?" category.
>
> I did (as root):
>
> 1) dd if=/dev/hda of=/some/file/not/onhda1/mbr.bin ibs=512 count=1
> 2) dd if=/dev/zero of=/dev/hda count=32767
> 3) dd if=/some/file/not/onhda1/mbr.bin of=/dev/hda
I just use "lilo -s [file]" to save a copy of the old boot record and
"lilo -u [file]" to restore it.
--
John (john@os2.dhs.org)
|
|
0
|
|
|
|
Reply
|
john2845 (623)
|
4/5/2007 11:50:54 PM
|
|
In article <slrnf1b2r0.gi2.john@vector.os2.dhs.org>,
John Thompson <JohnThompson@new.rr.com> wrote:
>On 2007-04-05, Kenny McCormack <gazelle@xmission.xmission.com> wrote:
>
>> This is in the "Is this all there is/is this OK?" category.
>>
>> I did (as root):
>>
>> 1) dd if=/dev/hda of=/some/file/not/onhda1/mbr.bin ibs=512 count=1
>> 2) dd if=/dev/zero of=/dev/hda count=32767
>> 3) dd if=/some/file/not/onhda1/mbr.bin of=/dev/hda
>
>I just use "lilo -s [file]" to save a copy of the old boot record and
>"lilo -u [file]" to restore it.
That might work, too. But is there anything wrong with my method?
|
|
0
|
|
|
|
Reply
|
gazelle2 (1306)
|
4/7/2007 12:26:57 PM
|
|
In article <slrnf1b2r0.gi2.j[58]...@vector.os2.dhs.org>,
John Thompson <JohnThomp[59]...@new.rr.com> wrote:
>On 2007-04-05, Kenny McCormack <gaze[60]...@xmission.xmission.com>
wrote:
> >> This is in the "Is this all there is/is this OK?" category.
>
> >> I did (as root):
>
> >> 1) dd if=/dev/hda of=/some/file/not/onhda1/mbr.bin ibs=512 count=1
> >> 2) dd if=/dev/zero of=/dev/hda count=32767
> >> 3) dd if=/some/file/not/onhda1/mbr.bin of=/dev/hda
>
> >I just use "lilo -s [file]" to save a copy of the old boot record and
> >"lilo -u [file]" to restore it.
> That might work, too. But is there anything wrong with my method?
I too prefer using dd, because it is more general.
If you also use mc, which does/shows 'everything', you can see the file
being written, its name, size, date ..permission; and even the contents
also in hex.
Save mbr ==>
dd if=/dev/hda1 of=./<fileIDnot used on current dir> ibs=512 count=1
will save 512 * 1 = the first 512 bytes of /dev/hda1
I'm not sure if /dev/hda is good enough.
That's why it's best to have eg. mc to SEE what's happening.
The last 2 bytes of the 512 block must be hex 55 AA.
This is part of the check.
Here's a typical ending - the last 16 bytes.
0001f0: 79 20 74 6f 20 72 65 74 72 79 0d 0a 00 00 55 aa
Restore mbr ==>
dd if=./<the saved file> of=/dev/hda1
??! what's:
dd if=/dev/zero of=/dev/hda count=32767
all about ?
This would wipe the first 32767bytes, before restoring the mbr.
If I was at a linux box now I'd try the lilo way, and hope to
find where lilo had saved it; then use dd and compare the 2 files;
of course using mc.
NB. see about hda vs. hda1
== Chris Glur.
|
|
0
|
|
|
|
Reply
|
news7585 (170)
|
4/10/2007 4:04:32 AM
|
|
|
3 Replies
31 Views
(page loaded in 0.084 seconds)
|
|
|
|
|
|
|
|
|