[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Backup problem using "cp"



On 5/7/18 9:28 AM, 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. 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.)


Have a nice day :)

Thomas


There is a program called rsnapshot that uses rsync for the actual work of copying but has a config file where you can supply exclude directories (like /media).  I just run "rsnapshot hourly" to copy my root file system before an apt upgrade command just in case a major problem occurs with the update.  The /proc /sys and /dev directories are not copied since they are "mounted" system directories.  rsnapshot uses hard links between backups so only the changed files are actually copied.  The number of versions to keep is configured in /etc/rsnapshot.conf.

In using your cp command, rsync or rsnapshot it is very important that the destination filesystem be able to handle hard links and all the file attributes of a linux file system.  So make sure that at least there is an ext3 or ext4 type file system on the destination drive.  If you are not sure what file system is in use for the backup destination just run the mount command (as root) without any arguments and it will print out all the mounted file systems and types.  I get this line for my /home directory:

/dev/md2 on /home type ext4 (rw,relatime,data="">

If I plug in a flash drive and have the system mount it I get (all one line):

/dev/sdg1 on /media/bob/3A78-573B type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

Notice the type vfat which is NOT what you want to see on the destination file system.

--


...Bob

Reply to: