You are not logged in.
Hello,
i wrote a little backup-script using cp to copy all the files and directories. It works, but its extremely slow.
Is there a faster way to do this?
Greetings,
marcel
Last edited by Asbestbrezel (2017-12-17 13:32:00)
Offline
How could we know. You haven't shown us the script. Rsync is generally preferred to cp for this purpose - but not due to speed concerns.
What part is slow? If it's I/O bound then the only way to speed it up would be to get faster disks or connections to the disks (or maybe compress the data before transfer, but this all depends on many things you've not shared here).
Last edited by Trilby (2017-12-17 12:48:10)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
#!/bin/bash
mkdir BACKUP_$(date +%d_%m_%Y)
cd BACKUP_$(date +%d_%m_%Y)
mkdir foo
cp /foo1 ./foo
cp /foo2 ./
cp /foo3 ./
cp /foo4 ./
cp -r /foo5 ./
cp -r /foo6 ./
Its very simple, not even a script. Normally it should be executed on the same SSD, the files are on. So read and write has the same disk as destination.
So basically the question is, is there a faster way to copy, then cp?
Last edited by Asbestbrezel (2017-12-17 12:59:36)
Offline
I have no idea why you'd feel the need to obfuscate the content of that script. That really disinclines me from even bothering to continue - which I wont after this post. But to answer your direct question, no there is not a faster way to cp than cp. And to even answer the question you're not asking but probably should be asking, yes there is a much faster way to acheive what it looks like you are trying to do: incrememental backups with rsync.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Yes try incremential (--delete) backup with rsync, in any case you'll win processing time by not recopying the source files unchanged.
Offline
Thank you, sir. This answers my question.
Offline