8

I am trying to restore an image that was taken with clonezilla. It was taken from a Windows 7 machine and was broken up into multiple files of the following format..

sda1.ntfs-ptcl-img.gz.a* (where * goes from a-k)

I have searched online for methods of restoring these images and the most frequently used is as follows:

sudo cat /dir-to-images/sdb1.ntfs-ptcl-img.gz.* | sudo gzip -d -c | sudo partclone.restore -C -s - -O /dir-to-new-image/hda1.img

However, when I try this:

sudo cat sda1.ntfs-ptcl-img.gz.a* | sudo gzip -d -c | sudo partclone.restore -C -s - -o partclone-restore.img

I get the following error:

Partclone v0.2.70 http://partclone.org
Starting to restore image (-) to device (partclone-restore.img)
device (partclone-restore.img) is mounted at 
error exit
Partclone fail, please check /var/log/partclone.log !

So, let's look at partclone.log...

Partclone v0.2.70 http://partclone.org
Starting to restore image (-) to device (partclone-restore.img)
device (partclone-restore.img) is mounted at
error exit

Same exact error..am I missing something here? Can anyone point me in the right direction?

I am using Ubuntu 12.04

4
  • That error suggests the .img file is mounted. If so, unmount it and try again.
    – Panther
    Apr 22, 2014 at 19:24
  • that is the output file though...it dosen't exist yet
    – Bubo
    Apr 22, 2014 at 19:29
  • try running those commands as root ( sudo -i )
    – Panther
    Apr 22, 2014 at 20:12
  • 1
    Tried that as well, got the same exact output. Not quite sure what is happening here
    – Bubo
    Apr 22, 2014 at 20:16

4 Answers 4

12

I ran into the same issue. While dogonthehorizon's answer might give you the desired results in the end, you would also have to deal with fixing dependency issues when trying to install an older build of partclone.

Instead, stop using partclone.restore, it is considered deprecated. Use partclone.ext4 as the maintained alternative in combination with the options --restore --restore_raw_file (short notations: -r -W) instead. Here 'ext4' should be replaced with the appropriate file system ('ext3', 'ext4', 'ntfs', etc).

I have not experienced any incompatibilities this way, where I restored a version 0.2.58 ext4 file system clone with version 0.2.78.

With the example of the OP:

sudo cat /dir-to-images/sdb1.ntfs-ptcl-img.gz.* | sudo gzip -d -c | sudo partclone.restore -C -s - -O /dir-to-new-image/hda1.img

You would get the following when not using partclone.restore any longer but partclone.ntfs for ntfs instead:

sudo cat /dir-to-images/sdb1.ntfs-ptcl-img.gz.* | sudo gzip -d -c | sudo partclone.ntfs -C -r -W -s - -O /dir-to-new-image/hda1.img

Or the following for an ext4 file system backup:

sudo cat /dir-to-images/sdb1.ext4-ptcl-img.gz.* | sudo gzip -d -c | sudo partclone.ext4 -C -r -W -s - -O /dir-to-new-image/hda1.img

Notice the file system indications ('ntfs' and 'ext4') in the original .gz files.

2
  • 1
    I can't stress enough how important it is to keep reading down the page on stack exchange network's pages. this solution is far better than the accepted answer. @Bubo we would all benefit if you accept this answer instead. Nov 25, 2020 at 15:29
  • The flag -W should be emphasized again and again. Mar 5, 2021 at 8:12
6

TL;DR: install partclone 0.2.58 from source and attempt the partclone step again.

I stumbled upon this question while attempting to do something similar on my Arch-Linux machine. I approached the problem a little differently than you did but I'm hoping that my solution will at least get you on the right track.

I first unpacked the compressed backup that I had made with a previous version of Clonezilla:

cat sda4.ext4-ptcl-img.gz.a* | gzip -d -c > sda4.img

I then attempted to restore this file using partclone with the following command:

partclone.extfs -r -s sda4.img -o sda4-restored.img --restore_raw_file

Things should be familiar up to this point; all I've done here is split the process you attempted into two commands. Now, I ran into the same issues you did with these commands and it appears to be an issue with the version of partclone that we are using.

It appears that both Partclone v0.2.70 and Partclone v0.2.69 are not compatible with the back-ups I had made with Clonezilla v3.5.1.

However, installing an old version of Partclone, namely Partclone v0.2.58, allowed me to restore the backup image I had created using the same command as above. Since partclone had no prepared images for Arch-Linux it was necessary for me to compile from source, however running Ubuntu 12.04 you may be able to finagle the .deb files provided at this partclone mirror: http://partclone.nchc.org.tw/download/stable/0.2.58/.

The steps I followed to compile 0.2.58 we're pretty Arch-Linux specific, but I'd be happy to share this process with you if you still need some help.

Cheers!

0
2

In another forum I found a simple solution.

You have to create the file that you are writing to!

e.g.

touch sda4-restored.img

Please note that you will have to use the -C / dont check size .. unless you create a file that has the same or more size than your partition.

Original post:

https://bbs.archlinux.org/viewtopic.php?id=179929

1
  • Thank you, this worked for me on Ubuntu 15.10 using partclone 0.2.78. Mar 17, 2016 at 11:24
1

i was getting an error when trying to loop mount an image i restored using partclone.restore. my original backup was created with clonezilla, i backed up a partition to an image.

EXT4-fs (loop0): bad geometry: block count 14648437 exceeds size of device (14215168 blocks)

so i used the following command to truncate it

truncate -o -s 14648437 sda2.img

you'll need sudo IF the img is owned by root and or in a folder owned by root. CAREFUL though because truncating an image may result in file loss but remember, you still have the original clonezilla backups so it's ok if you mess up the partclone.restore created .img file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .