I'm backing up a folder from one NAS to another using a unix script using
. Its a lot of files and takes several days to complete. Most of the files don't change from week to week. Is there a command that would be quicker?
Also note, the backup needs to be ready-to-use in an instant- not in an archive or something that would need to be extracted or anything.
Last edited by Stellaman1977; 06-07-2018 at 03:10 PM..
Reason: Added one more sentance
We're not going to improve "several days" into "instant" no matter what the means. Further, any program which creates files does largely does the same thing as cp.
Parellizing is usually a non-starter. The bottleneck you're already hitting would get worse.
Speeding it up, then, is a matter of improving or bypassing the connection to your NAS.
The holdup is very likely protocol latency multiplied by thousands of tiny files. If that's handled locally on your NAS, it will be much faster. You say "no archive", but that's still my answer. You don't have to wait for it to transfer, or even store it after all, the whole point of a UNIX tarball is you can extract it on the fly. You can transfer it over a network pipe of some sort and extract it while it's still being transferred.
Something like:
Change tar -tf to tar -xf once you've tested and see that it does what you want.
Last edited by Corona688; 06-07-2018 at 07:49 PM..
I think that I get the question as you've described it quite clearly. Different people will have different solutions but this is what I would do.
(Obviously, if the (original) copy takes several hours then users could be modifying files during that time so you need somehow to cope with that.)
Do the first copy using find piped to cpio and create a timestamp of the event:
NOTE: The <destination directory> MUST already exist before the command is run otherwise it will fail, so create it manually if need be.
After the first copy, select only files that have changed since the last copy by using the -newer switch on find:
Note that we create the timestamp (timenow) before we start to copy because users might modify files whilst the copy is executing.
This way files that have not changed since before the very start of the last copy will not be copied again. The incremental copies will therefore be much quicker than a full copy. If the job fails to complete then the timelastcopy will not get updated so these files will get selected again on the next run.
Hope that helps and I hope I've explained that clear enough. If not, post back your questions.
This is clearly NOT an alternative to a command. So it may not meet your needs.
What file system? ZFS, EXT4...?
Some file systems support snapshots, so you backup from the snapshot. If you create a snapshot at time T, then run your backup against the time T snap at T + 10 days, you still get what was there at time T. No corruption.
You can also clone a file system to a different name, filesysA -> filesysB, then backup filesysB at your leisure.
You can get snapshot and clone worthy filesystems for Linux and Solaris. I do not know about HP or AIX.
This User Gave Thanks to jim mcnamara For This Post:
Ubuntu, Bash 4.3.48
Hi,
I have 2 files and I want to join them (line by line if the start of the lines is the same, like a ID)
INPUT FILE 1 (tab delimited)
aa_12_12_v_c aaa,asf,afgas,eg
bb_12_43_a_d dad,ada,adaf,afa
cc_56_75_d_f asd,thh,ert,rtertet
INPUT FILE 2 (tab delimited)... (4 Replies)
is there a different way to do the following:
curl -k -H "Content-Type:application/json" -X POST -d'{"api_token": "33blah526c-6bla71-441b-491b-0blahca08"}' https://10.10.10.10/api/1.4/auth/session -c /tmp/myhost01.myhost.com
im seeking to use a different method because i'm running into TLS... (1 Reply)
Hi All,
We have few scripts where we are using grep -w option to do exact matching of the pattern. This works fine on most of our servers.
But I have encounter a very old HP-UX System(HP-UX B.11.00) where grep -w option is not available.
This is causing my scripts to fail. I need to change... (7 Replies)
Hi All,
I am trying to select 30 days older files under current directory ,but not from subdirectory using below command.
find <Dir> -type f -mtime + 30
This command selecting all the files from current directory and also from sub directory .
I read some documention through internet ,... (1 Reply)
hi,
I need alternative command for topas to check cpu %, i tried with ps but their is lot of diffference between the outputs of two commands...
Thanks (3 Replies)
Hi,
I was looking for a command which would help sending files parallely to remote server , and lftp is the closest option I could got. Unfortunately when I checked the AIX machine I work on does not has lftp installed.
Is there any alternative perl script (or something like that) which I can... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Ok, Im back with another small problem. I created a script (the one posted in the last thread). After some help from some members here all is good. The problem is I made it... (4 Replies)
Hi all,
I am using linux box ...i dont find the manual entry of sar command through
man sar ...it is in unix not in linux although i have to check the cpu utilization and paging...any alternative of sar command..
Thanks
Vijay Sahu (1 Reply)
Hi friends,I am new to unix and this is really a dummy question.but please help me out.
How to simulate head command without using head command???
also tail command too,also more command.
it is given as a homework to do....please tell me how to do (2 Replies)