Making *.img to backup a Windows partition


Results 1 to 8 of 8

Thread: Making *.img to backup a Windows partition

  1. #1
    Join Date
    Jan 2003
    Location
    Zurich, Switzerland
    Posts
    2,657

    Making *.img to backup a Windows partition

    Hello everyone,

    Parcival reporting back into the wonderful world of Linux; my 1337 skills are sort of rusted in, however, so please bear with me.

    So, here is my question:
    What exactly allows me to create a custom tailored *.img file to backup the contents of a partition?

    This is my problem:
    My wife wants me to backup some Windows NTFS partitions on her working computer so she can use them on a different computer.

    This is my solution attempt:
    1. Boot the Gentoo based System Rescue CD.
    2. dd the contents of the data partitions into *.img files on an external usb drive.
    3. dd the contents of the *.img files onto the new computer.


    So far that worked, but there's one annoying problem: one partition on the work computer is 50GB big, but contains only 8GB of data. It would be really nice if I could just dd out those 8GB of "real data" instead of having a 50GB *.img file that is mostly empty. Likewise, it would be cool if there's an easy way to match the contents of the *.img file to the size of the new partition. The new data partition is 100GB big so it would be cool if my backup were automatically scaled to that size so I don't have an 8GB partition and an additional 92GB partition.

    Thanks in advance,

    Parcival

    "What can be said at all can be said clearly, and what we cannot talk about we must pass over in silence."

    Tractatus Logico-Philosophicus by Ludwig Wittgenstein (1889-1951)

  2. #2
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Parcival,

    Nice to hear from you. I am on holiday in the Far East.

    I think you can "resize" the 50Gb partition into a 8Gb before cloning it out by dd. This involves a bit of work/time especially if you want to expand the source partition back to the original size. Gaprted is the resizing tool I used normally. However if the MS system is a Vista or Win7 its resising function within the "Disk Management" is better as it is faster.

    Think backup programs like rysnc, which gives you a size based on files, can do NTFS partition with some loss of file attributes according to this site. dd will not be used though.

    Apparently Cloneziller is a variation of dd that can skip the empty spaces and hence faster but the partition size would not be changed. Not use it before myself.

    For all the trouble I would just use a USB hard disk with a formatted NTFS partition to do drag and drop the folders from the computer. If the partition is a system related, which can prevent intervention of its system files, I would use a Linux terminal with ordinary copying tools like tar or cp. Most Linux distros are equipped with the NTSF-3g that can read and write NTFS partitions reliably.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  3. #3
    Join Date
    Apr 2003
    Location
    UK
    Posts
    1,180
    You can use ntfsclone which only copies the actual data to its image files, the downside to using this is you won't be able to mount the image files with the loopback device. When restoring it will restore the filesystem to its original size, so if you want to copy it to a smaller partition, then you'll have to resize it before making the image, if you are copying it to a bigger partition then you can do a resize after restoring it. You can use ntfsresize to do the resizing, which is what Gparted uses.

  4. #4
    Join Date
    Jul 2002
    Location
    Vladivostok, Russia
    Posts
    9,053
    DriveiImage-XML might be what your looking for. I've used it and its very straight-forward. No resizing. Can be run inside Windows.
    HERE
    Last edited by JohnT; 07-21-2009 at 07:32 PM.
    "I was pulled over for speeding today. The officer said, "Don't you know
    the speed limit is 55 miles an hour?" And I said, "Yes, but I wasn't going
    to be out that long."

    How To Ask Questions The Smart Way
    COME VISIT ME IN RUSSIA NOW!!

  5. #5
    Join Date
    Jan 2003
    Location
    Zurich, Switzerland
    Posts
    2,657
    Thank you for all your helpful advice. I will try it and tell you how it went.

    "What can be said at all can be said clearly, and what we cannot talk about we must pass over in silence."

    Tractatus Logico-Philosophicus by Ludwig Wittgenstein (1889-1951)

  6. #6
    Join Date
    Jan 2007
    Posts
    280
    Welcome back, Parcival.

    Quote Originally Posted by Parcival
    It would be really nice if I could just dd out those 8GB of "real data" instead of having a 50GB *.img file that is mostly empty.
    Why not issue this:

    Code:
    cat /dev/zero > tempfile && rm tempfile
    The file, tempfile, needs to be created in the partition that you wish to back up. This will fill up the unused space on that partition with zeros, making it highly compressible. Now, you could issue this and create a compressed image of the same.

    Code:
    dd if=/dev/sdX ibs=4096 | lzma -vz9 > image.img.lzma conv=noerror
    To restore, issue this:

    Code:
    dd if=image.img.lzma | lzma -dv | dd of=/dev/sdX
    Also, I'd recommend that you use dcfldd instead of dd. It provides a graphical progress indicator, which, IMO, is pretty useful.
    Last edited by i845_; 07-25-2009 at 05:57 PM.

  7. #7
    Join Date
    Jul 2002
    Location
    Vladivostok, Russia
    Posts
    9,053
    I would like to know if you were successful in retrieving your image from the external USB drive using "dd"?
    "I was pulled over for speeding today. The officer said, "Don't you know
    the speed limit is 55 miles an hour?" And I said, "Yes, but I wasn't going
    to be out that long."

    How To Ask Questions The Smart Way
    COME VISIT ME IN RUSSIA NOW!!

  8. #8
    Join Date
    Mar 2007
    Location
    An American in England
    Posts
    24
    I fully recommend fog. I have also heard good things about ping

Posting Permissions

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