Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all, I need to have a tool to clone the content of a hd into another one, maybe larger than the original but sharing the same structure (boot, swap, ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2

    Cloning an hd by scripts

    Hi all,
    I need to have a tool to clone the content of a hd into another one, maybe larger than the original but sharing the same structure (boot, swap, root).
    I wrote a backup script that creates 3 files:
    - hda1_root.tar.gz (by tar)
    - hda3_boot.tar.gz (by tar)
    - hda_mbr (by dd)

    The restore script does partitions (boot, swap, root) and formats them (ext2, swap, ext3): then writes the files on the new partitions and writes 446 bytes from the hda_mbr file in /dev/sda to avoid to overwrite partition data (that should be different in size from the original).

    If I boot from the hd I receive only 'GRUB' print.

    I run the scripts booting from a live distro on a bootable usb key (rescueSystemCd).

    Someone told me to chroot in the restored hd and run 'grub-install'.
    I've done this, but now the PC starts and it stops in the grub's mini-shell, waiting for commands.
    If I type the command line i have in the grub.conf, the system starts correctly.

    Why the grub (1.95) is not able to start reading grub.conf ??

    The live distro refers the hd as 'sda' (and partitions as 'sdaX') but the restored distro refers as 'hda' (and partitions as 'hdaX') ...
    'grub-install' runs a command that regenerates the 'device.map' file: running from the live distro it writes 'sda' name but the restored distro knows 'hda' name !?!?!

    BTW: the basic question is:
    Should not be sufficient to restore mbr data to boot ??

    Thanks
    ----
    SteM

  2. #2
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2
    Found !!!

    grub 1.95 is a GRUB2 release !!
    This version searches for grub.cfg and not grub.conf (i had in /boot/grub)
    This was why the grub stopped in the mini-shell !

    I wrote a new grub.cfg (it has a different format and device enumeration) and my PC starts correctly !

    Now my question is:
    is it possible to avoid to chroot and grub-install on the cloned hd ?
    (Maybe it is needed 'cause the hd should be different from the hd source ??)

    Thanks !!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...