Results 1 to 10 of 12

Thread: Creating .iso from block device & restoring to disk

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Location
    Pacific Northwest
    Beans
    82
    Distro
    Ubuntu

    Creating .iso from block device & restoring to disk

    Hi, I have some print controllers that I want to be able to restore easily and one way to do it is to use a disk image. Basically I have a 20GB laptop IDE drive with 3 separate FAT16 partitions and I want to make an image of the entire disk with the 3 file systems contained in one iso. Then I want to be able to use that image to make duplicates of the original disk. The boot record and everything needs to be copied exactly, I have used partimage before and it doesn't do exactly as I need because it will only allow me to do one partition at a time. I have the drive connected to a USB adapter and it shows as 'sda' for the device with 'sda1' 'sda2' and 'sda3' as the partitions. I'm guessing I can create an iso with mkfs or rsync or something but I'm not sure how. Also I am not sure how to put the image on a disk properly once I have acquired the image. What is the best way to accomplish this task? Thanks. =)

  2. #2
    Join Date
    Sep 2009
    Location
    Denmark
    Beans
    726
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Creating .iso from block device & restoring to disk

    dd if=/dev/sda of=somefilename.img

    To duplicate:

    dd if=somefilename.img of=/dev/sda
    What? I'm not allowed to say fsck? Then how is i supposed to help people fix their filesystems?

  3. #3
    Join Date
    Mar 2010
    Location
    Pacific Northwest
    Beans
    82
    Distro
    Ubuntu

    Re: Creating .iso from block device & restoring to disk

    That worked perfectly, thank you. Is there a way to compress this data or ignore blank spaces while it is being written? The disk across all three partitions only contains about 250MB of data with a bunch of extra space for the end user to store scan jobs and reprint data on. It has 2 1GB partitions as 'IP-511' and 'BACKUP' for OS and recovery and a 16GB partion 'DATA' for the user. When I make the image it comes out as a ~20GB file when there is really only 250MB of data.

    I checked out the man page for the dd command, thanks again for pointing out such a useful tool.
    Last edited by RyanRahl; November 12th, 2010 at 06:34 PM. Reason: bad punctuation

  4. #4
    Join Date
    Sep 2009
    Location
    Denmark
    Beans
    726
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Creating .iso from block device & restoring to disk

    First, mount each partition and do a

    dd if=/dev/zero of=/path/to/filesystem/alotofzeroes

    Let it run until it stops after complaining the filesystem is full. Delete the file afterwards. Now, all the free space is made up of easily compressable zeroes, instead of old, abandoned data. FAT has a file size limit, i think it's 2 gb, so for the 16 gb partition, you need to repeat without deleting the files undtil the filesystem is completely full. Now make a new image and compress it with

    bzip2 --best somefilename.img

    The outputfile will be somefilename.img.bz2 and it will be a lot smaller than the original.
    What? I'm not allowed to say fsck? Then how is i supposed to help people fix their filesystems?

  5. #5
    Join Date
    Mar 2010
    Location
    Pacific Northwest
    Beans
    82
    Distro
    Ubuntu

    Re: Creating .iso from block device & restoring to disk

    Quote Originally Posted by Fafler View Post
    First, mount each partition and do a

    dd if=/dev/zero of=/path/to/filesystem/alotofzeroes

    Let it run until it stops after complaining the filesystem is full. Delete the file afterwards. Now, all the free space is made up of easily compressable zeroes, instead of old, abandoned data. FAT has a file size limit, i think it's 2 gb, so for the 16 gb partition, you need to repeat without deleting the files undtil the filesystem is completely full.
    I did this and now it is telling me all the partitions are of an unrecognized type and I cannot mount any of them. It seemed to do exactly as you said but I could not find the output file. I'm trying to figure out what I did wrong and possibly repair these partitions.

  6. #6
    Join Date
    Sep 2009
    Location
    Denmark
    Beans
    726
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Creating .iso from block device & restoring to disk

    Exactly what did you write?
    What? I'm not allowed to say fsck? Then how is i supposed to help people fix their filesystems?

Tags for this Thread

Bookmarks

Posting Permissions

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