Firefox 16, a treat for developers http://t.co/cnd27CzT
CPIO command to backup and restore in Linux
The cpio command is one of the most commonly used Linux back up tools.
The cpio command has two unusual features. Unlike tar , in which the files to back up are typed in as part of the command, cpio reads the files to work with from the standard input (in other words, the screen). This feature means that cpio must be used as part of a multiple command or with a redirection pipe.
cpio must always be used with one of three flags. Flags are options that set the mode in which the command runs. Only one flag can be used at a time, and it must come before any other options. In addition, the choice of flags limits the options that can be used. Each flag also has a gnu option that can used in its place. The gnu option gives a convenient name for each flag: extract, create, and pass- through. (definition from debianhelp.uk)
- Download and install CPIO in Linux debian/ubuntu
$sudo apt-get install cpio
Download and install CPIO in Fedora/centos/RHEL
#yum install cpio -y
How to use cpio commands :
Lets give some examples to explain you the use of cpio commands.
Backup :
For example, we have to backup directory /home/unixmen1
-go to this directory
[root@localhost pirat9]# cd /home/unixmen1/
see the content of this directory :
[root@localhost unixmen1]# ls -altr
total 16
drwxr-xr-x. 5 root root 4096 2009-08-12 09:05 ..
-rw-r–r– 1 root root 0 2009-08-12 09:05 unixmen_com.file
drwxr-xr-x 2 root root 4096 2009-08-12 09:05 directory1
drwxr-xr-x 2 root root 4096 2009-08-12 09:05 directory6
-rw-r–r– 1 root root 0 2009-08-12 09:06 fileX
drwxr-xr-x 4 root root 4096 2009-08-12 09:06 .
-rw-r–r– 1 root root 0 2009-08-12 09:06 logo.GIF
[root@localhost unixmen1]#
now we will backup this directory and copy the backup file to /opt directory
[root@localhost unixmen1]# find . -print | cpio -ocv > /opt/backup.cpio
.
./directory6
./directory1
./logo.GIF
./fileX
./unixmen_net.file
2 blocks
[root@localhost unixmen1]# ls -altr /opt
total 16
drwxr-xr-x 7 root root 4096 2009-07-01 09:38 omni
drwxr-xr-x. 25 root root 4096 2009-08-11 03:16 ..
drwxr-xr-x 3 root root 4096 2009-08-12 09:10 .
-rw-r–r– 1 root root 1024 2009-08-12 09:10 backup.cpio
lets remove some file from /home/unixmen1 to check the backup
[root@localhost unixmen1]# ls
directory1 directory6 fileX logo.GIF unixmen_net.file
[root@localhost unixmen1]# rm -f logo.GIF unixmen_com.file
[root@localhost unixmen1]# ls
directory1 directory6 fileX
Restore :
Now we want to restore the directry .
[root@localhost unixmen1]# cpio -icuvd < /opt/backup.cpio
.
directory6
directory1
logo.GIF
fileX
unixmen_net.file
2 blocks
check if the files are back. with
[root@localhost unixmen1]# ls -altr
total 16
drwxr-xr-x. 5 root root 4096 2009-08-12 09:05 ..
drwxr-xr-x 2 root root 4096 2009-08-12 09:05 directory1
drwxr-xr-x 2 root root 4096 2009-08-12 09:05 directory6
-rw-r–r– 1 root root 0 2009-08-12 09:12 unixmen_com.file
-rw-r–r– 1 root root 0 2009-08-12 09:12 logo.GIF
-rw-r–r– 1 root root 0 2009-08-12 09:12 fileX
drwxr-xr-x 4 root root 4096 2009-08-12 09:12 .
Congratulation , your files are back :) .
Like us on Facebook
This week Top Posts 
Top Things to do After Installing Ubuntu 13.04 ‘Raring Ringtail’ : Ubuntu 13.04 Raring Ringtail final is almost out. The final release it scheduled for release on Apri...0 comment(s) |
Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comment(s) |
Howto: Upgrade to Ubuntu 13.04 Raring Ringtail from 12.04, 12,10 | Desktop & Server : Updated 05-04-2013: Ubuntu 13.04 Raring Ringtail will be released Soon, If you have ubuntu 12,10, 12...0 comment(s) |
Install and Configure Samba share in Ubuntu 13.04 Raring Ringtail , 12.10, 12.04| Howto : Updated 05-04-2013: One of the most asked features for Samba is a graphical user interface to help w...0 comment(s) |
How to use Remote Desktop in Ubuntu : Sometimes, we need to access our computer from other locations when we’re not at home and such. This...0 comment(s) |
Configure conky-Lua in Ubuntu (12.10 & 13.04 Raring Ringtail), Fedora, debian and LinuxMint | Howto Conky : Updated 05-04-2013: Conky is a free, light-weight system monitor for X, that displays any informatio...0 comment(s) |
Recent Posts
- Setup Backup server using rsnapshot on RHEL / CentOS / Ubuntu / Debian
- How to disable/change default PDF viewer in Mozilla Firefox
- Dictionaries in Python
- How to Install uTorrent Client on Ubuntu/Debian/Linux Mint
- Lists in Python
- Argument Handling in Python
- Setup your own Wikipedia like website using MediaWiki
- Administer your Server using Ajenti Server Manager
- “Brand New” Unixmen Forum is Now Live!
- How To: Disable or Enable Guest Account in Ubuntu 13.04
Recent Comments



















Ladi Oyekanmi
| #
Could you please assist in step by step on how to install nagios on solaris
Adhraa
| #
Greate tutorial :)
pigmej
| #
Just one thing:
What about pep8 in your python code ? How can you give ‘tutorials’ on quite popular website, of such a bad quality ?
Amit Rai
| #
I just renamed shared.xml and it logged in and created a new shared.xml.
DB Griffin
| #
Larry Page is not being completely honest! The manner in which the PRISM program/project works does not need access from company administrators or owners, so called “direct access”; the access to the information is already there. These tech company CEOs take for granted the actual intelligence of most end users of their products. All it takes is a little digging and reading to go from ignorant to informed on these things especially on exactly how the internet works/functions in the U.S.A. I find Larry Page’s remarks just as laughable as Al Gore’s claim to “inventing” the internet/world wide web!
If you, as an end user, are reading this post; I challenge you to research these matters yourself. It really is quite simple with all the “information sites” that exist on the web today ie Wikipedia, & other online encyclopedias that actually list source material, as well as highly respected tech sites and blogs that also list their source material. Be warned: this is only the tip of the iceberg and these tech CEOs know and understand this; they are scrambling in attempt to perform DAMAGE CONTROL to save the company and what little trust thay have left from their products end users/consumers.
Am I a skeptic? I believe someone has to be or needs to be at this point in time! If your not just a little skeptical of the government, tech companies, and the people that are in charge of these agencies and companies; you need to be, even if just a little skeptic. For your own personal protection and security! I know I was a part of this community for over 14 years!