Tux

...making Linux just a little more fun!

Talkback:140/kapil.html

[ In reference to "Setting up an Encrypted Debian System" in LG#140 ]

Marius Pana [marius.pana at gmail.com]


Sat, 28 Mar 2009 11:12:10 +0200

There seems to be issues with the cpio (copy command) as it will copy /prov over! for example /proc has 0 disk space used in my / root filesystem. In /tmp/target it now has 4.8GB?! and the cpio operation fails with a no space on device error. I am about to try and change the option to cpio / find and see if I cant get it to work.

Regards,

Marius


Top    Back


Kapil Hari Paranjape [kapil at imsc.res.in]


Sat, 28 Mar 2009 17:20:06 +0530

Hello,

On Sat, 28 Mar 2009, Marius Pana wrote:

> There seems to be issues with the cpio (copy command) as it will copy /prov
> over! for example /proc has 0 disk space used in my / root filesystem.
>
> /tmp/target it now has 4.8GB?! and the cpio operation fails with a no space
> on device error. I am about to try and change the option to cpio / find and
> see if I cant get it to work.

Sorry for the error in the article! The fault is not 'cpio' but elsewhere.

I seem to have forgotten to put in a description of how to setup the source directory for the copying.

One way to avoid any such paths is to use '-prune' these paths. So the actual find command should have been something like

 find / -path '/tmp/target' -prune \
     -o -path '/proc'       -prune \
     -o -path '/sys'        -prune \
  -o -print 

A few more paths should be pruned as well.

A much simpler solution is to create the source directory as follows

  mkdir /tmp/source
  mount --bind / /tmp/source
  mount --bind /boot /tmp/source/boot
  etc.

This way you choose each sub-mount that you want to copy. After that you run change directory to /tmp/source before running the 'cpio'.

A different solution is to use the '-xdev' option to 'find' which will skip all the sub-mounts. You will then have to copy over the '/boot' file system by a separate command.

Hope this clarifies.

Regards,

Kapil. --


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Sat, 28 Mar 2009 08:59:53 -0400

On Sat, Mar 28, 2009 at 11:12:10AM +0200, Marius Pana wrote:

>    There seems to be issues with the cpio (copy command) as it will copy
>    /prov over! for example /proc has 0 disk space used in my / root
>    filesystem. In /tmp/target it now has 4.8GB?! and the cpio operation fails
>    with a no space on device error. I am about to try and change the option
>    to cpio / find and see if I cant get it to work.

The standard magic invocation for 'cpio' used for system backup (after you've burned the sacrificial chicken, of course) is

find / -path /proc -prune -o -print0 | cpio -o -0 [other options] > out_file.cpio

...for reasons that you have now discovered. :)

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * https://LinuxGazette.NET *


Top    Back