Menu

Restore only 1 partition from full disk image

Help
2009-06-05
2013-04-05
  • Antoine Savine

    Antoine Savine - 2009-06-05

    Hello.

    I saved an image of my entire disk (3 partitions) using dd (one of them was mac os).

    Now I need to restore only 1 partition onto free space on my hard disk.

    If I choose restore parts it does not work.

    Please help.

    With thanks.

    Antoine Savine from London (UK).

     
    • Steven Shiau

      Steven Shiau - 2009-06-06

      "If I choose restore parts it does not work."
      What are the error messages ?
      BTW, Clonezilla supports HFS+ if you choose "-q2" option (actually it's the default option on Clonezilla live 1.2.2-14 or later).

      Steven.

       
      • Antoine Savine

        Antoine Savine - 2009-06-06

        Dear Steven. I got it figured out. Thanks for your prompt answer and congrats on your great work. All the best. Ant1.

         
        • Steven Shiau

          Steven Shiau - 2009-06-08

          Antoine,
          Cool!

          Steven.

           
  • TonyWoode

    TonyWoode - 2011-11-08

    Hi

    The text in this thread is not visible - I've tried 2 different OS's and three different browsers to view - hence I assume it has disappeared from the source. I cannot find another post that easily and specifically addresses just this issue

    I too would like to restore only one partition from a full disk image - I'm interested simply in restoring individual partitions back to their original locations on the same HD

    My disk image includes win7, win xp and ubuntu (the latter of which CZ had to DD obviously because of the file system I chose when installing). It also includes XOSL (boot manager). It is most likely I will only want to restore the win7 image, but I have taken a full disk image so that I can restore the whole disk or other partitions if it becomes necessary

    Can you please detail how I restore a single partition from a whole disk image - am I right in thinking this cannot be achived through the CZ GUI?

     
  • Steven Shiau

    Steven Shiau - 2011-11-13

    "how I restore a single partition from a whole disk image" -> You mean you have an disk image and you would like to restore to a single partition? If so, it's very similar to this one:
    http://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/02_Restore_disk_image
    The only difference is to choose "restoreparts" instead of "restoredisk".
    i.e. A Clonezilla "disk image" could be used to restore some partitions.

    Steven.

     
  • TonyWoode

    TonyWoode - 2011-11-17

    Hi Steven

    Thanks v much for the reply. Yes I have taken a disk image of a single whole physical disk and may wish to restore only a single partition back to the original disk. and I recall reading on these forums previoulsy that in order to restore a single partition from the image required command line options. Whether my recollection is wrong or whether this has now been incorporated I don't know, but you've clearly said that by simply choosing the disk image as source but then requesting clonezilla to restore a partition from it this will work. Thanks

    Do you mind if I ask something related but additional? What if I wish to retore only the MBR, or perhaps just the MBR and the the hidden data after the mbr (ie: a similar case to the above really: I guess this is the other half of the question "what if just one part of my disk needs restoring and I don't want to roll back the other parts - and I have a conezilla disk image")

    Is this possible from the gui or can you recommend a likely command line?

    BTW the text above has reappeared, but it was worth adding to with info…

    thanks again

     
  • Steven Shiau

    Steven Shiau - 2011-11-24

    "What if I wish to retore only the MBR, or perhaps just the MBR and the the hidden data after the mbr (ie: a similar case to the above really: I guess this is the other half of the question "what if just one part of my disk needs restoring and I don't want to roll back the other parts - and I have a conezilla disk image") Is this possible from the gui or can you recommend a likely command line?" -> There is no UI for this. However, it's can be easily be done by "dd" command.
    Say, e.g.
    dd if=/home/partimag/$IMAGE/sda-mbr of=/dev/sda bs=512 count=1
    As for the hidden data, you have calculate the count number, it's somehow like:
    dd if=/home/partimag/$IMAGE/sda-hidden-data-after-mbr  of=/dev/sda seek=1 bs=512 count=$data_size

    Remember to replace the $IMAGE and $data_size with yours.

    Steven.

     
  • TonyWoode

    TonyWoode - 2011-11-26

    that's great info thanks very much indeed Steven

    I have these files in my image
    /home/partimage/$myimage2011-11-26-11-img/sda-mbr     the size of this file is always going to be 512 bytes
    and in my case for this image i have
    /home/partimage/$myimage2011-11-26-11-img/sda-hidden-data-after-mbr    and the size of this file is 1,048,064 bytes

    On an pre-4k disk the sector size is 512 bytes per sector - so if you had say a default xp install on a disk you'd generally find that the mbr would be 0.5k, the hidden data would be 31k, and xp would begin after that…so restoring the hidden data would be a case of
    dd if=/home/partimage/$my1k-per-sector-image2011-11-26-11-img/sda-hidden-data-after-mbr of=/dev/sda seek=1 bs=512 count=31

    but on a 4k-per-sector drive (http://en.wikipedia.org/wiki/Advanced_Format) an os like win7 will start its partition aligned, meaning you'll get a larger area of potential hidden data. But you want to calculate your block size (needed for $data_size above) in terms of 512 byte blocks in order that the seek=1 still easily starts after the MBR (since its just the number of bytes to write we're after) - so my case I divide my number of hidden-mbr bytes (1,048,064) by 512 to get 2047 blocks to write

    dd if=/home/partimage/$my4k-per-sector-image2011-11-26-11-img/sda-hidden-data-after-mbr of=/dev/sda seek=1 bs=512 count=2047

    only thing I'm not 100% on: how is DD able to write to just 1k to the first 4k block on an advanced format drive and then subsequntly leave that 1k alone and then write the remaining 3k of the hidden-data in that same block without touching the mbr its just written? I think its due to the tranlation of Advanced Format 512e:  the 4k sector is read to memory, added to and then written back each time….

    let me know if you think any of this is incorrect. Hope this helps someone

     
  • TonyWoode

    TonyWoode - 2011-11-26

    apologies - mistake in the above, and something else I don't get

    if the block size is 512bytes then the 'old' xp command for the hidden data restore would be:
    dd if=/home/partimage/$my1k-per-sector-image2011-11-26-11-img/sda-hidden-data-after-mbr of=/dev/sda seek=1 bs=512 count=62

    since the hidden data area is 31744 bytes = 31kb = 62 blocks/sectors
    however after seeking one block/sector  in (for the MBR) and then writing 62 sectors - the last sector written would be sector 63 - yet that's where the OS usually starts - surely if I use the filesize of the hidden-data-after-mbr file to work out the count then I have now written over the first sector of my OS partition?

     
  • TonyWoode

    TonyWoode - 2011-11-26

    nope that's fine the above is correct since 0-63 is 64 sectors - we write the MBR for one 512byte sector in sector 0 and then write the hidden data for sectors 1-62. We are then on sector 63 where the XP/old OS partition would begin

    And in the case of 'newer aligned OS' (which in my case here is NOT on an SSD ) (check in your own case the size of the file!!!) in my case if we write the MBR for sector 0's 512 bytes then write 2047 lots of 512bytes (1,048,064 bytes) we end up at 2048 lots of 512 bytes - or 2k in to the drive

     
  • Steven Shiau

    Steven Shiau - 2011-12-04

    OK, thanks for sharing that.

    Steven.

     

Log in to post a comment.