Disk images

Daniel Carrera daniel.carrera at zmsl.com
Fri Apr 14 08:19:09 UTC 2006


Gary W. Swearingen wrote:
>>dd if=/dev/hda of=/dev/hdb count=1 bs=446 # copy boot loader in MBR
>>mount /dev/hda /mnt/source && mount /dev/hdb /mnt/dest
>>cp --archive /mnt/source/* /mnt/dest/
>>
>>What am I missing?
> 
> Well, first off, your "cp" will miss top-level ".*" files.

No, Ubuntu doesn't have any.

> If I assume that your new disk's partition tables are good for that
> disk,

Yes.

> then that sequence won't copy the parts of the grub bootloader
> in the second sector, etc.

Hmm... I didn't realize that grub took up more than the first sector. 
How about this:

1. dd if=/dev/hda of=/dev/hdb count=1 bs=16k
2. sfdisk and fdisk to fix the partition table.
3. cp files.

Will step (2) wreck grub again?


> A case, which you should be aware of, but I doubt if you have, is that
> an IBM/MSFT DOS-style MBR tries to boot from a bootloader in a primary
> partition's boot code (partition boot record and more).

Yeah, I noticed fdisk giving me a warning about that. When I overwrite 
the entire MBR and fdisk stops being able to edit the partition table it 
says what you just wrote (among other things).

>>The first *track*? Why that much? That would include much more than the MBR. Plus, it would include the partition
>>table. What am I missing?
> 
> Probably nothing, here.  It just feels good to wipe the first track
> where grub and viruses tend to hide, but I guess it's unneeded.

If I must overwrite more than the first 446 bytes for Grub, then I might 
as well overwrite the first track and then fix the partition table.

Best,
Daniel.
-- 
      /\/`) http://opendocumentfellowship.org
     /\/_/
    /\/_/   A life? Sounds great!
    \/_/    Do you know where I could download one?
    /




More information about the ubuntu-users mailing list