Monday, April 11, 2011

How to compress and uncompress image file on linux?

■ Requirement : How to compress and uncompress image file
■ OS Environment : Linux[RHEL, Centos]
■ Application:gzip
■ Implementation Steps : 

.UNCOMPRESS :
uncompress the image and extract the archive into /tmp/initrd

$ gzip -dc < /tmp/initrd.img | cpio -idv ----- or ---- zcat -d image|cpio -idv ---- 2

COMPRESS :

a) Generate a list of files to be made into a new cpio archive.

$find . -depth -print | cpio -ovc > ../custom-initrd.cpio

b) gzip the cpio image:

$gzip -9 ../custom-initrd.cpio

No comments:

Post a Comment