[Fwd: Re: impossible to restore MBR using dd]

Matthias Bertschy matthias@echotech.ch
Tue May 3 17:11:00 GMT 2005



-------- Original Message --------
Subject: 	Re: impossible to restore MBR using dd
Date: 	Tue, 03 May 2005 19:10:20 +0200
From: 	Matthias Bertschy <matthias@echotech.ch>
To: 	Eric Blake <ericblake@comcast.net>
References: 
<050320051554.17789.42779EC1000829600000457D22007358340A050E040D0C079D0A@comcast.net> 




Hello Blake,

Eric Blake wrote:

>>Hello,
>>
>>Cygwin version: 1.5.12
>>    
>>
>
>Can't you upgrade?  coreutils-5.3.0-5 is out, and requires a newer version of cygwin.  Perhaps with the latest versions you may pick up a bug fix along the way that helps solve your problem.  Also, see http://cygwin.com/problems.html to give us more information so we can help you better.
>
>  
>
As suggested, I have upgraded to the latest cygwin. Unfortunately, it 
doesn't change the results :-(

>>For safety reasons, I would like to restore only the first 446 bytes of 
>>the MBR to keep the existing partition table.
>>
>>The command line to use would normally be:
>>    dd if=boot.MBR of=/dev/sda bs=446 count=1
>>-->    dd: writing '/dev/sda': No space left on device
>>          1+0 records out
>>          0+0 records in
>>(I also tried with bs=512 and I get the same output)
>>    
>>
>
>Hmm - writing just 446 bytes to raw devices is not very safe.  /dev/sda is a block-special device for a reason, and writing anything more or less than a full block at a time on a block-special device is not guaranteed to work.  Maybe that is your problem?  Also, according to `stat /dev/sda', the IO block size of an NTFS raw device is 1024, so even bs=512 may be equally dangerous.
>
>  
>
Maybe I should recall you that on Linux, we can safely write 446 bytes 
blocks to a raw device. Indeed, the command dd if=boot.MBR of=/dev/sda 
bs=446 count=1 works under Linux.
I also don't understand why you are using NTSF raw devices to access the 
MBR... after all the MBR isn't formatted at all !

I think I will fill a bug report for the dd command under Cygwin. Could 
you point me where to do it?
(or maybe for Cygwin's ability to access raw devices)

>  
>
>>PS: If I do only:
>>    dd if=//./physicaldrive0
>>--> dd is wrinting things on the command line.
>>
>>    
>>
>
>That's to be expected.  The of= flag is necessary to tell dd to put the output in the named (device) file, rather than on stdout.
>  
>
I know :-) that was just to point out that without any bs parameter, the 
dd command works.

>--
>Eric Blake
>cygwin coreutils maintainer
>
>
>  
>
Matthias



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list