How to Create and Restore Partition using Partimage

In doing the partimage it is very important to run an fsck before doing partimage otherwise partimage will bomb out if its not clean from the first part.

[root@server1 ~]# fsck -y /dev/sdd1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
/boot: recovering journal
/boot: clean, 35/28112 files, 16972/112420 blocks
 
 
[root@server1 ~]# fsck -y /dev/sdd3
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
/: recovering journal
Clearing orphaned inode 4325389 (uid=0, gid=0, mode=0100600, size=33554432)
/: clean, 125751/4980736 files, 2377162/4954044 blocks

Running the Partimage
– Image creation

[root@server1 ~]# partimage -B=0 -cod -f3 save /dev/sda1 /home/burnz/parted-images/serverdisk.part1
partimage: status: initializing the operation.
partimage: status: Saving partition to the image file...
partimage: status: reading partition properties
partimage: status: writing header
partimage: status: copying used data blocks
 
partimage: status: commiting buffer cache to disk.
[root@server1 ~]# partimage -B=0 -cod -f3 save /dev/sda3 /home/burnz/parted-images/serverdisk.part3
partimage: status: initializing the operation.
partimage: status: Saving partition to the image file...
partimage: status: reading partition properties
partimage: status: writing header
partimage: status: copying used data blocks
 
partimage: status: commiting buffer cache to disk.
 
# to check the content:
[root@server1 ~]# ls -l /home/burnz/parted-images/
total 3069888
-rw------- 1 root root    7095846 Dec  3 02:25 serverdisk.part1.000
-rw------- 1 root root 2136738512 Dec  3 02:31 serverdisk.part3.000
-rw------- 1 root root  996641576 Dec  3 02:36 serverdisk.part3.001

OR

partimage -B=0 -z0 -cod -V0 -M save /dev/sdd2 part2.img 
partimage -B=0 -cod -f3 save /dev/sdb1 c6178-154140.part1
partimage -B=0 -cod -f3 save /dev/sdb1 c6178-154140.part3

– Image restoration

[root@server2 burnz]# partimage restore -f3 -B=0 -cod /dev/sda1 /home/burnz/parted-images/serverdisk.part1.000
partimage: status: initializing the operation
partimage: status: Restoring partition from the image file...
partimage: status: reading partition informations
partimage: status: reading header
partimage: status: copying used data blocks
 
partimage: status: commiting buffer cache to disk.
[root@server2 burnz]# partimage restore -f3 -B=0 -cod /dev/sda3 /home/burnz/parted-images/serverdisk.part3.000
partimage: status: initializing the operation
partimage: status: Restoring partition from the image file...
partimage: status: reading partition informations
partimage: status: reading header
partimage: status: copying used data blocks
 
partimage: status: commiting buffer cache to disk.

OR

partimage restore -B=0 /dev/sda1 part1.img
partimage restore -B=0 /dev/sda3 part3.img

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-37138722-1’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();