Restoring a big partition to a smaller partition with Clonezilla

22,072

since you have the 600gb empty you can mount your current HD and copy its files to the 600gb !
or you can make a new backup using dd+gzip and you will have chance to restore your hard drive without problems of loosing space.

if you want to do that from your current runing os :

mount your current hd (since it is an ext4 it can be mounted on different places).

sudo mkdir ~/bk/{0,1}
sudo mount /dev/SRC_HD ~/bk/0
sudo mount /dev/DST_HD ~/bk/1
sudo copy -arxp ~/bk/0/* ~/bk/1/

now you will make some changes if you want to boot with 600gb

use blkid to get HDs UIDs

SRC_HDUUID="7ahzj19f-a2b2-4f24-bb01-4ca7bc9fed3a"
DST_HDUUID="7aaeb19f-a2b2-4f24-ffc1-4ca7bc9fed3a"

sudo grep "$SRC_HDUUID" /etc /boot -rl | while read f
do
    sed -i "s/$SRC_HDUUID/$DST_HDUUID/g" $f
done

sudo umount -fl ~/bk/*

update the grub in your current os it

sudo update-grub

reboot into your fresh copy inside $DST_HD and then wipe your SRC_HD or any.

if you want to do that from a live os with gzip dd gunzip :

backup again your SRC_HD to a raw image

dd if=/dev/SRC_HD | gzip -c  > /inside/your600/image.img

restore it from the raw image

gunzip -c /inside/your600/image.img | dd of=/dev/SRC_HD

but before restoring it it's good to wash your SRC_HD

washing a hard drive is creating a file inside th hard drive filled up with zero, and removing that file!

sudo dd if=/dev/zero of=/where/hardrive/mountd/zero

acoording to the hd size it will take some time and it will stop with a 'disk full' mesage !

sudo rm /where/hardrive/mountd/zero
Share:
22,072

Related videos on Youtube

Noir
Author by

Noir

Updated on September 18, 2022

Comments

  • Noir
    Noir over 1 year

    Some time ago I created a backup of an EXT4 partition with Clonezilla. Now the HDD crashed and I lost some important data.

    The size of the image of the partition is 50GB. I tried to restore this image to a 200GB HDD but it turned out that the size of the original partition was 500GB. Since I don't have a 500GB HDD for dumping available I figured out how to force Clonezilla to ignore it by passing -C to partclone. But while recovering it stopped with the error target seek ERROR:Invalid argument.

    I could imagine that the data on the partition is fragmented so that the actual bitmap doesn't fit. Is there a workaround for this? I have a HDD with about 600GB available but I don't like touching the partition table or such. Ideally would be a way to restore it to a mountable image. (ISO or such)