how to create image file from hd

Help
sarikan
2006-01-27
2013-05-09
  • sarikan
    sarikan
    2006-01-27

    hi,
    I have a working fedora core 3 installation with oracle and x and everything. It has been a real work to do it, but it works very well at the moment. However, it'd be much better for me if i had an image file instead of a three partition setup that i can only transfer to other machines by messing up their partitions.
    How can i convert these existing partitions in my hd to image files for colinux so that i can copy them simply
    Any help will be appreciated a lot
    Best Regards
    Seref Arikan

     
    • Danny Staple
      Danny Staple
      2006-01-27

      I would recommend looking up and using the tool "dd" as a starting point. There will be furthar information in the manual for it - "man dd", or on the colinux wiki.

       
    • sarikan
      sarikan
      2006-01-30

      hmm, dd was the first option that i've thought of, but i could not be sure if colinux could successfully use the image created with dd
      how are the existing images created? is there any link for a howto?
      Best Regards
      Seref Arikan

       
    • Henry N.
      Henry N.
      2006-01-30

      You can use dd or simple copy.

      Method dd:
        dd if=/dev/hda1 of=/Dest/file.img
        fsck /Dest/file.img
      This will copy complete first partion from your harddisk in a file.  hda1 in the sample should replace with your rootfs device.  Destination should be a place, where not is under hda1, for sample a FAT32 partion or NFS mounted server.  You can do this in running system, but it's better to make the copy, if the source partion is not mounted or is Read Only mounted.  If you do this in running system, go into lowest runlevel without GUI and stop mostly daemons you can.

      Method copy:
        dd if=/dev/zero of=/Dest/file.img bs=1k count=2k
        mkfs.ext3 /Dest/file.img
        mount -o loop /Dest/file.img /mnt
        sync
        cp -a -x /* /mnt
        sync
        umount /mnt
      This creates an empty 2GB file, formats it, and with cp you should copy all files into the image.  The cp source is only a sample here.  Please use perhaps some wildcards, or select directories /bin, /usr and /dev in separate steps.  The problem: Do not copy the destionation "file.img" self recursive.

      The file.img can directly use as cobd.

      Henry