Thursday 29 June 2017

Restore the Clonezilla image on disk



1.  Boot the machine via Clonezilla live

In this example, the machine has 2 disks, 1st disk's name is sda (device name in GNU/Linux), 2nd disk's device name is sdb. We already have a Clonezilla image in sdb, the image name is called "utopic-x86-20150218":
root@debian:~# ls -alFh /home/partimag/
total 32K
drwxr-xr-x 6 root root 4.0K Feb 18 04:18 ./
drwxr-xr-x 4 root root   80 Feb 18 06:54 ../
drwxr-xr-x 2 root root 4.0K Feb 18 03:51 Docs/
drwx------ 2 root root  16K Feb 18 03:50 lost+found/
drwxr-xr-x 2 root root 4.0K Feb 18 03:51 Photos/
drwxr-xr-x 2 root root 4.0K Feb 18 04:19 utopic-x86-20150218/
and its contents are:
root@debian:~# ls -alFh /home/partimag/utopic-x86-20150218/
total 426M
drwxr-xr-x 2 root root 4.0K Feb 18 04:19 ./
drwxr-xr-x 6 root root 4.0K Feb 18 04:18 ../
-rw-r--r-- 1 root root  833 Feb 18 04:18 blkdev.list
-rw-r--r-- 1 root root  500 Feb 18 04:18 blkid.list
-rw-r--r-- 1 root root 5.8K Feb 18 04:19 clonezilla-img
-rw-r--r-- 1 root root  174 Feb 18 04:18 dev-fs.list
-rw-r--r-- 1 root root    4 Feb 18 04:18 disk
-rw-r--r-- 1 root root 144K Feb 18 04:18 Info-dmi.txt
-rw-r--r-- 1 root root  38K Feb 18 04:18 Info-lshw.txt
-rw-r--r-- 1 root root 4.6K Feb 18 04:18 Info-lspci.txt
-rw-r--r-- 1 root root  172 Feb 18 04:18 Info-packages.txt
-rw-r--r-- 1 root root   82 Feb 18 04:19 Info-saved-by-cmd.txt
-rw-r--r-- 1 root root   10 Feb 18 04:18 parts
-rw------- 1 root root 424M Feb 18 04:18 sda1.ext4-ptcl-img.gz.aa
-rw------- 1 root root 696K Feb 18 04:18 sda5.ext4-ptcl-img.gz.aa
-rw-r--r-- 1 root root   36 Feb 18 04:18 sda-chs.sf
-rw-r--r-- 1 root root 1.0M Feb 18 04:18 sda-hidden-data-after-mbr
-rw-r--r-- 1 root root  512 Feb 18 04:18 sda-mbr
-rw-r--r-- 1 root root  456 Feb 18 04:18 sda-pt.parted
-rw-r--r-- 1 root root  413 Feb 18 04:18 sda-pt.parted.compact
-rw-r--r-- 1 root root  361 Feb 18 04:18 sda-pt.sf
-rw-r--r-- 1 root root   53 Feb 18 04:18 swappt-sda6.info
Now the image "utopic-x86-20150218" will be restored to disk sda.
Once you have the bootable Clonezilla Live CD/DVD or USB flash drive, you can boot the machine you want to clone via Clonezilla live. Remember to use the Clonezilla live CD or USB flash drive to boot the machine. For example, if you have Clonezilla Live in USB flash drive, you have to boot it via USB device (Ex. USB-HDD or USB-ZIP). If necessary, you can set the first boot priority in the BIOS as USB-HDD or USB-ZIP so that it can boot Clonezilla Live from your USB flash drive.
Here we take CD as an example. You can either set CD as first boot priority in machine's BIOS like this:
 
  
Or by pressing a hotkey (e.g. Esc or F9) when you boot the machine, you will see the boot menu of BIOS like this:
 
Check your motherboard manual for more details about how to boot your machine via CD.
 

      Here is a screenshot of Clonezilla Live boot menu




The first one is the default mode for Clonezilla Live. It will default to frame buffer mode with a resolution of 1024x768.
There are more modes which you can choose in the 2nd choice "Other modes of Clonezilla live", e.g. 800X600 or 640x480 one if you want, as shown here
  

The choice, "Default settings, KMS" is for you to use KMS (Kernel Mode Setting) for your graphics card. If you have some problem to use the framebuffer mode of your graphics card, you can try it.
The choice, "Clonezilla live (To RAM. Boot media can be removed later)", is the same function with the 1st one except when Clonezilla live booting finishes, all the necessary files are copied to memory. Therefore you can remove the boot media (CD or USB flash drive) then.
If you do not need Chinese or Japanese environment or if your computer experiences problems in the framebuffer mode, you can choose the one "Clonezilla Live (no framebuffer)" to clone in the English environment.
The choice, "Clonezilla live (failsafe mode)", is for something goes wrong when you are not be able to boot your machine, such as ACPI of your machine is not supported in the kernel.
If you want to boot local OS in your harddrive, you can choose the one "Local operating system in harddrive (if available)". This is an extra function in the boot media that has nothing to do with Clonezilla Live.
The choice, "FreeDOS", allows you to boot your machine into Free DOS. This is an extra function in the boot media that has nothing to do with Clonezilla Live.
The choice, "Memory test using Memtest86+," is for memory testing using Memtest86+. This is an extra function in the boot media that has nothing to do with Clonezilla Live.
The choice, "Network boot via iPXE" is used to perform a network boot via iPXE. If your computer does not have a PXE network, you can use this to do boot from a network. This is an extra function in the boot media that has nothing to do with Clonezilla Live

3.       Here we choose 800x600 mode, after pressing Enter, you will see Debian Linux booting process



4.       Choose language



5.       Choose keyboard layout


The default keyboard layout is US keybaord, therefore if you are using US keyboard, just press enter (i.e. use the option "Don't touch keymap").
If you want to change keymap, you can either choose "Select keymap from arch list" or "Select keymap from full list".
///NOTE/// There is a bug when choosing French keymap in "Select keymap from arch list", so use "Select keymap from full list" to change keymap if you are using French keyboard.
 


6.       Choose "Start Clonezilla



7.       Choose "device-image" option


Pay attention to the hints, too. You might need that:
///Hint! From now on, if multiple choices are available, you have to press space key to mark your selection. A star sign (*) will be shown when the selection is done///

8.       Choose "local_dev" option to assign sdb1 as the image home



There are other options, e.g. sshfs, samba or nfs, you can use when network is available. This is very useful when 2nd local disk is not available.
Since we choose "local_dev" option, we can use 2nd disk or USB flash drive to save 1st disk's image. If using USB flash drive as repository, inster USB flash drive and wait a few secs.




9.       Select sdb1 as image repository, then choose "restore disk" option
 


If you are not familiar with the disk or partition name in GNU/Linux, read the hints:
'The partition name is the device name in GNU/Linux. The first partition in the first disk is "sda1", the 2nd partition in the first disk is "sda2", the first partition in the second disk is "sdb1" or "sdb1"... If the system you want to save is MS windows, normally C: is sda1, and D: could be sda2, or sda5...



Then Clonezilla shows you the disk usage report:
 
  

Here we choose "Beginner" mode:


If you choose "Expert" mode, you will have some chances to choose advanced parameters, e.g. imaging program, compression program, etc.. You can see more details here.
 

Now you can select "restoredisk" option



10.       Select image name and target disk

Choose the Clonezilla live image as source image:


Select the target disk "sda" we want to restore :


Clonezilla will prompt us the command to restore the image. This command is very useful when you want to create a customized Clonezilla live:




Before starting to restore the disk image to disk sda, Clonezilla will ask you to confirm that TWICE



11.       Clonezilla is restoring disk image on 2nd disk (sdb) to 1st disk (sda)
 


Clonezilla now is restoring the selected disk image to 1st disk (sda). The job is done by restoring:
  • MBR (by dd), and Boot loader (by grub)
  • Partition table (by sfdisk).
Data on every partition or LV (logical volume) (by partimage, ntfsclone, partclone or dd. It depends on the image of each partition or LV.)




When everything is done, Clonezilla will prompt you if you want to run it again,
  1. 'Stay in this console (console 1), enter command line prompt' 
  2. 'Run command "exit" or "logout"  

Then you can choose to:
  • Poweroff
  • Reboot
  • Enter command line prompt
  • Start over (image repository /home/partimag, if mounted, will be umounted)
  • Start over (keep image repository /home/partimag mounted)




Here we choose Poweroff, then when the shutdown process is done, it will ask you to remove the disk and close the try (if any) then press ENTER.


That's all. The 1st disk (sda) is ready to be used.