I have a directory called my_projects_linux
inside the Ubuntu file system, which contains all my work from many years. The directory contains files, subdirectories and so on.
For backup purposes, I occasionally copy this directory and all its contents to external hard drive.
Hence, the contents of my external drive look like:
/mounted_drive/my_projects_linux
/mounted_drive/my_projects_windows # the same idea to backup Windows work
Hence, what I am looking is a command which:
Would work as
cp /home/my_projects_linux /mounted_drive/my_projects_linux
It should replace old files, subdirectories, files inside subdirectories, etc. in the external disk by the new content from my PC.
Be fast. It should only copy modified files or those that have been newly created. Given that the size of
my_projects_linux
is >50 GB, copying everything takes more than an hour, which is too slow. In reality often only a few MB have changed since last backup, so theoretically a copy can be made much faster.
How to do that?
I googled that cp with the -u
flag could possibly match my needs. Would that work (e.g. would it correctly handle subdirectories of subdirectories)?
Also, is storing file system on an external disk an appropriate way of doing a backup, or is there a fancier way? For example, using a cloud? Note that the fancier way should be simple, as otherwise it will not outweigh the ease of executing one shell command.
rsync
is already mentioned and its particular feature of skipping a specific list is being discussed. Here I'm just asking how to backup files. I have not heard about rsync at the moment this question was posted. So although related, I don't think this question is a duplicate. – mercury0114 Mar 31 '16 at 14:13rclone
: http://rclone.org/ --- it's likersync
but works with (some) cloud. Works ok with google drive. Once setup, it's just one command. – Rmano Mar 31 '16 at 14:30rsync
here is an analogy to a queue in my opinion... – mercury0114 Mar 31 '16 at 15:35