Web lists-archives.com

Re: Backup problem using "cp"




On Mon 07 May 2018 at 15:28:14 (+0200), Thomas Schmitt wrote:
> Hi,
> 
> Richard Owlett wrote:
> > My goal was to copy root and its sub-directory to a directory on another
> > physical device.
> 
> Well understood.
> In a slightly different scenario (backup on Blu-ray) i do this several
> times per day.
> 
> But i would not dare to give the whole root tree as input to any copying
> program or backup archiver.

I've cloned live systems in the past by writing:

# cd /
# find -xdev -path './lost+found' -prune -o -print | cpio -vdamp /mnt

(omitting v to make it quieter).

> Not only because of the risk of stepping on my
> own foot but also because there are several trees which do not deserve
> backup or could even make trouble when being fully read.
> 
> In my root directory that would be: /dev /mnt /proc /run /sys
> E.g. because of
>   $ ls -l /proc/kcore
>   -r-------- 1 root root 140737477877760 May  7 15:22 /proc/kcore
> 
> (Somebody else shall try whether it's really readable and what comes out.
>  The announced size is nearly 128 TiB.)

The -xdev (or cp -x) deals with those.

Cheers,
David.