Web lists-archives.com

Re: Backup problem using "cp"




Hi,

Richard Owlett wrote:
> Thought I was doing that by specifying -x.

Either cp -x has a bug or the target directory is not in a different
filesystem than "/" and not a mount point of such a filesystem.

Check the device numbers of "/" and "/media/richard/MISC...".
E.g. like this

  $ stat / | fgrep Device
  Device: 803h/2051d      Inode: 2           Links: 25
  $ stat /bkp | fgrep Device
  Device: 814h/2068d      Inode: 2           Links: 7

Here "/bkp" has a different device number (2068) than "/" (2051).
So it (its inode, to be exacting) is in a different filesystem.

As contrast see a directory in the same filesystem as "/":

  $ stat /home | fgrep Device
  Device: 803h/2051d      Inode: 2228225     Links: 60


> Any way to accomplish that without explicitly listing all directories except
> /media ?

If it is indeed a bug with cp -x, then you could use some archiver like
"tar" which has options to exclude a file.

Totally untested fantasy:

  $ tar cf - --exclude=/media / | (cd /media/.../dev_sda14 ; tar xf - )

Get inspiration from googling "tar pipe for copying".


Have a nice day :)

Thomas