How to Mount Clonezilla images and extract files to modify file system

There are time where you want to a single file from existing Clonezilla image, so restoring the image on a machine is a pain and waste of time.
if you can mount the image and do your modifications to the file system,
Clonezilla uses part clone as backup utility, so the image you see in "images" folder is gzip of poartclone image.
So here is the process 
  • first decompress it
  • restore it to raw format so that we can mount it as a normal drive and access file system in it.
ubuntu@clonezilla:/tmp> cat sda2.ext4-ptcl-img.gz.aa |gzip  -d > sda2.ext4-ptcl-img
unzipped image is  a cloned image by part clone so we can't mount as it is, lets restore it into raw image using part clone utility's restore mode
ubuntu@clonezilla:/tmp> sudo partclone.restore -s sda2.ext4-ptcl-img -o sda2.ext4-ptcl-img_restore --restore_raw_file
Partclone v0.2.73 http://partclone.org
Starting to restore image (sda2.ext4-ptcl-img) to device (sda2.ext4-ptcl-img_restore)
Calculating bitmap... Please wait... done!
File system:  EXTFS
Device size:    2.0 GB = 491008 Blocks
Space in use: 899.6 MB = 219622 Blocks
Free Space:     1.1 GB = 271386 Blocks
Block size:   4096 Byte
Elapsed: 00:00:32, Remaining: 00:00:00, Completed: 100.00%, Rate:   1.69GB/min,
current block:     490667, total block:     491008, Complete: 100.00%
Total Time: 00:00:32, Ave. Rate:    1.7GB/min, 100.00% completed!
Syncing... OK!
Partclone successfully restored the image (sda2.ext4-ptcl-img) to the device (sda2.ext4-ptcl-img_restore)
Cloned successfully.
image is restored , you can mount it now and see the files inside it.
ubuntu@clonezilla:/tmp> sudo mount -o loop -t ext4 sda2.ext4-ptcl-img_restore /media/
ubuntu@clonezilla:/tmp> cd /media/
If you have followed the procedure without any mistakes you would see a file system inside the mount point
ubuntu@clonezilla:/tmp> ls
bin  boot  dev  etc  home  initrd.img  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var  vmlinuz
gil ...

Post a Comment