Unix Hosting News & Commentary
My Top 3

I have been using cpio many times and never settled on my favorite combination between operating system, hard drive block size, and best options to use. So I think its about time I dedicate some space to recording down my personal preferences so I do not have to keep reading the manual page once every blue moon while holding my elbow at a 45 degree angle.

Making the archive

Today, I decided to use this method for archiving a directory for transportation to another server:

find /path/to/start -type f | cpio -ovcBO /path/to/archive.cpio

This says to find the files in the path of /path/to/start and look for only the file type of “file” (as opposed to block, character, directories, named pipes, symbolic links, sockets or doors) and then send that list off to cpio that says to:

  • -o accept incoming from the find command
  • -v be verbose and tell us what file it is reading
  • -c use the new SRV4 portable format
  • -B set the I/O block size to BLOCK-SIZE * 512 bytes
  • -O save to the archive file of

    I think this would be nice to bzip up as well to save time in transferring, but I will save that for a later update of this article.

    Error messages

    If you receive this error message:

    truncating inode number

    I have found that using the -c option will help allow for being compatible with your system.

    Restoring

    To restore your cpio archive, use the following:

    cpio -ivcI

  1. No user reviews yet.


Leave a Reply





Blogroll