Backup and Restore with cpio command
From w3cyberlearnings
Contents |
Backup and Restore with cpio
Use cpio command to do the back and restore.
Install
sophal@ubuntu:~$ sudo apt-get install cpio
Backup a directory
List Directory
sophal@ubuntu:~/test$ ls arr2.php array.php dd myfile
Backup
sophal@ubuntu:~/test$ find . -print | cpio -ocv > /home/sophal/backup123.cpio . ./.array.php.swp ./arr2.php ./myfile ./myfile/myfamily.txt ./dd ./array.php 12 blocks
check the backup file
sophal@ubuntu:~/test$ stat /home/sophal/backup123.cpio File: `/home/sophal/backup123.cpio' Size: 6144 Blocks: 16 IO Block: 4096 regular file Device: 801h/2049d Inode: 920364 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ sophal) Gid: ( 1000/ sophal) Access: 2012-06-28 10:58:05.764099462 -0500 Modify: 2012-06-28 10:58:06.304099462 -0500 Change: 2012-06-28 10:58:06.304099462 -0500
Restore
sophal@ubuntu:~/test$ cpio -icuvd < /home/sophal/backup123.cpio . .array.php.swp arr2.php myfile myfile/myfamily.txt dd array.php 12 blocks