Web lists-archives.com

Re: Backup problem using "cp"




On 08/05/18 00:55, David Griffith wrote:
> On May 7, 2018 4:31:16 AM PDT, Richard Owlett <rowlett@xxxxxxxxxxx> wrote:
>> On 05/06/2018 10:11 AM, Thomas Schmitt wrote:
>>> 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
>>
>> I get:
>> richard@debian-jan13:~$ stat / | fgrep Device
>> Device: 80eh/2062d	Inode: 2           Links: 22
>> richard@debian-jan13:~$ stat /media | fgrep Device
>> Device: 80eh/2062d	Inode: 131073      Links: 5
>> richard@debian-jan13:~$
>>
>> I gather that "cp" is then an inappropriate tool.
>>
>> "tar" is inappropriate for my preferences - I was attempting to use
>> "cp" 
>> as there would be multiple files &/or directories as input *and*
>> output.
>>
>> I suspect long term I want "rsync" [ *MUCH* reading to do! ]
> 
> 
> You will indeed want rsync.  Essentially, "rsync -av [--delete] <source> <destination> will serve most of your backup needs.
> 

I habitually include -x in there as well, which I suspect will be needed
here.

And for my uses, I always make sure there are trailing slashes on both
source and destination.

Richard


Attachment: signature.asc
Description: OpenPGP digital signature