Mail Archives: cygwin/2005/05/03/11:56:26
Matthias Bertschy wrote:
> Cliff Hones wrote:
>
>> Matthias Bertschy wrote:
>>
>>> Hello,
>>>
>>> Cygwin version: 1.5.12
>>> Windows XP Professional: Ver 5.1 Build 2600 Service Pack 2
>>>
>>> I am trying to use Cygwin's dd command as a post Windows XP install
>>> command to restore our custom GRUB to the MBR after an unattended
>>> installation.
>>> 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)
>>>
>>> After reading:
>>> http://sourceware.org/ml/cygwin/2001-01/msg00193.html
>>> I decided to try the following:
>>> mount -s -b -f //./physicaldrive0 /dev/hd00
>>> dd if=boot.MBR of=/dev/hd00 bs=446 count=1
>>> --> dd: opening '/dev/hd00': Invalid argument
>>> (even if I change the device /dev/xxx name, I get the same output)
>>>
>>> I even tried directly:
>>> dd if=boot.MBR of=//./physicaldrive0 bs=446 count=1
>>> --> dd: opening '//./physicaldrive0': Invalid argument
>>>
>>> After so many unefficient tries, I decided to read from it, just to see:
>>> dd if=//./physicaldrive0 bs=446 count=1
>>> --> dd: reading '//./physicaldrive0': Is a directory
>>> 0+0 records out
>>> 0+0 records in
>>>
>>> So here is the:
>>> QUESTION1: Does anyone know how to write into MBR from Windows XP
>>> using Cygwin's dd ?
>>> QUESTION2: I am doing somathing wrong since dd sees
>>> //./physicaldrive0 as a directory ?
>>>
>>> Any help would be appreciated.
>>
>> Using /dev/sda should work.
>>
>> -- Cliff
>>
> Hello Cliff,
>
> Thanks for your help... However, if you read carefully the beginning of
> the mail, that's the first thing I tried:
>
> 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 don't really understand why there is "No space left on device"... the
> same command under Linux works like a charm.
>
> If anyone else has got an idea?
I gave it a quick test with bs=512 and it works fine. It seems you can't
write partial sectors - which is perfectly reasonable, as if allowed
the driver would have to read the sector, update part and then write back.
So I suggest you try the following:
dd if=/dev/sda of=bootsect bs=512 count=1
dd if=boot.MBR of=bootsect bs=1 count=446
dd if=bootsect of=/dev/sda bs=512 count=1
-- Cliff
--
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/
- Raw text -