Fastest Backup Copy Method

(Ακολουθεί Ελληνική μετάφραση)

resources_bitrate_1.pngSo, how do you keep copies of your valuable data? Some people use specialised software, such as Norton Ghost. Others use the infamous Robocopy (i should dedicate a post to that some day). Some simply copy their valuable folders fromt their original location to the backup drive. And of course some people never backup their data. Which, as we all know, is what drives them to becoming backup paranoids a little later on, obsessed with keeping backup versions of their data all the time. Most of them fall in the first category of people, using software such us Ghost or Backup and Recover or any other piece of software.

I’m not going to evaluate these applications. Not on this post anyway. Here, what we’re going to examine, is the possibility to speed up the Copy process from one location to another. Lets for example assume that we intent to keep bacup copies of our Mail folder (i’m using this example so that I can use my own folder to evaluate the hypothesis).

One way to achive this is by getting ourselves an external hard drive, plug it into the USB port of our machine and copy the folder from the original location to the backup location. Simple, easy and accurate. You end up with a 1:1 copy of your data which, in case you lose your original folder (format, hard drive failure, mistaken erasure, etc), is readily available in the exact same format as the original. You only need to copy it back to the expected location and there you have it; good as new.

One thing that you must have noticed if you’ve ever done anything like this, is the dreaded amount of time this operation requires. You must be thinking to yourself now, how can you speed up an operation that is only limited by computer resources, without changing the resources…

Well here’s the thing. What if you change the operation in such a way that it utilises more of the already available resources? Okay, I may be a bit vague so, lets try putting the scenario in numbers.

SCENARIO.
1. Say for example that we have a folder of files and folders of which, the mean size is less than 400KB. This is a sensible scenario since we’re talking about backing up email. Text email would be tiny and the exceptionally large (thanks to attachements) email would just marginally raise the mean size. It would still hold true if we were talking about photos (okay not digital camera photos which could even be as large as 5MBs. downloaded jpgs would still be small though), settings (setting files are way smaller than that) and other folders of way too many tiny files.
2. We’re copying/moving (makes no difference) the folder from its original location (say for example c:\users\iamtheuser\appdata\local\opera\opera\mail) to an external USB hard drive (for example d: ).
3. I’m right clicking on the original folder, selecting “copy” and then I’m clicking on “paste” on the external hard drive. It’s the easy, simple and logical way to do it. Unfortunately it suffers from one tiny little issue.
4. A 1.5GB folder (that’s my mail folder yeah, it’s a beast) copied over to a USB hard drive this way, will take exactly 1 hour and 10 minutes .

WHY IS IT SO SLOW.
You may be thinking now that I’m miscalculating something. I’m afraid I’ve got my calculations right. This is because of the file sizes. You see, no matter what kind of a beast of a machine you’ve set up, you will always be limited by the fact that the files are so small that the system completes the copy process before getting any chance to utilise its resources to the full. This means that the constant process of “open original file / create new file / copy data from original to target / close original file / create endOfFile at the target fiel and cloe / verify data has been copied correctly / start over” is such, that it limits the copy process to about 200-400KB/s. Also, if you have other applications messing up with your copy process (like for example a virus scanner that will test the data from the original file before allowing the system to start copying it by following the aformentioned process), it could prove even slower than that. A USB2 connection allows theoretical speeds up to 60MBs per second. Don’t expect to see that number any time soon but you could easily expect a 20-25MB/s transfer rate when writing onto a USB drive.

SOLUTION.
It’s not exactly a solution but it could prove useful when you’re trying to copy/move a number of such folders before a format or whatever. The solution is this: Instead of simply copying a folder like the ones we discussed (don’t try it for folders of large files, I’m telling you straight now you’re gonna hate teh moment you decided to go on with that option), save the entire root folder into a compressed file with no compression enabled and then, copy/move THAT file to your backup location. Back to our experiment:
1. I’m selecting the root folder, use 7zip to compress it into an uncompressed file (use the STORE option for that) and I sit back and wait for the operation to complete. It takes precisely 3.03 minutes to store the entire 1.5GB folder into a 1.5GB file.
2. I right click on the 1.5GB file, select “copy” and I “paste” that to my external USB hard drive. Because of the fact that it is now a single file (as opposed to the earlier case of 16.378 files and 1.828 folders), I only waited for a mere 45 seconds for my file to copy to its destination. This is because I do not expect the system to open up and close a large number of files, the system does not scan a huge amount of files, etc. Everything happens just once, which allows the system to reach its maximum speed of 26MB/s when writing onto my external USB drive.

I know it sounds strange but it does work. Never wait for those copy processes any more. Store into a compressed file with no compression applied and then more the compressed file to the intented destination. Since it’s a backup file, you can even leave it there as a compressed file. If you wish to uncompress it however, granted, it will take some time but, believe me when I say, it will never require a full hour to complete. You’ve saved time either way you do it.

Greek version follows.

Η Ελληνική έκδοση θα είναι σαφώς συντομότερη. Σχολιάζουμε το πρόβλημα της αναμονής για τη δημιουργία αντιγράφων ασφαλείας όταν τα αντιγραφόμενα αρχεία είναι πολλά σε πλήθος και μικρά σε μέγεθος δημιουργώντας ένα μεγάλο σε μέγεθος φάκελο. Μια τέτοια περίπτωση θα ήταν ο φάκελος με τα email, ή φωτογραφίες jpg μικρού μεγέθους ή οποιοσδήποτε φάκελος του οποίου τα περιεχόμενα δεν ξεπερνούν κατά μέσο όρο τα 400KBs.

ΠΡΟΒΛΗΜΑ.
Το πρόβλημα που παρατηρείται σε μια τέτοια περίπτωση είναι πως κατά την αντιγραφή του φακέλου αυτού σε μια εξωτερική μονάδα USB, η ταχύτητα αντιγραφής δε θα φτάσει ποτέ το μέγιστο ρυθμό της καθώς περιορίζεται από την εξής ακολουθία:
1. άνοιγμα πρωτοτύπου αρχείου
2. δημιουργία αντίγραφου
3. αντιγραφή δεδομένων
4. κλείσιμο πρωτοτύπου αρχείου
5. δημιουργία endOfFile στο αντίγραφο αρχείο και κλείσιμο αρχείου
6. επαλήθευη αντιγραφής
7. επανεκκίνηση διαδικασίας

Στην περίπτωση που έχουμε ενεργό και κάποιο antivirus, η διαδικασία επιβαρύνεται από τη λειτουργία του καθώς θα πρέπει να ελέγχει το κάθε αρχείο ξεχωριστά πριν επιτρέψει στο σύστημα να ξεκινήσει την προαναφερθείσα διαδικασία.

Για ένα φάκελο της τάξης των 1.5GB (αποτελούμενο από 16.378 αρχεία και πάνω από 1.000 υποφακέλους), η αντιγραφή του σε εξωτερικό δίσκο μέσω USB χρειάζεται περίπου μία ώρα και δέκα λεπτά (01:10), καθώς αυτή εκτελείται με το φαντασμαγορικό ρυθμό των κατά μέσο όρο 250KB/s.

ΛΥΣΗ.
Η λύση στο συγκεκριμένο πρόβλημα είναι να χρησιμοποιήσουμε ένα πρόγραμμα συμπίεσης για να συμπιέσουμε τον αρχικό φάκελο σε ένα μόνο αρχείο συμπίεσης με το ποσοστό συμπίεσης όμως ρυθμισμένο στο απόλυτο μηδέν. Αν χρησιμοποιήσουμε για παράδειγμα το 7zip, η επιλογή που ψάχνουμε ονομάζεται STORE. Αυτό που κάνουμε δημιουργεί ένα αρχείο με το ίδιο μέγεθος (1.5GB) αλλά κερδίζουμε από άποψη χρόνου με τον εξής τρόπο. Η δημιουργία του συγκεκριμένου αρχείου θα πάρει περίπου 3 λεπτά σε ένα σύγχρονο μηχάνημα (3.03 λεπτά ακριβώς πήρε στο δικό μου). Η μεταφορά του 1.5 αρχείου, παρότι είναι ακριβώς το ίδιο μέγεθος με πριν, θα πάρει μόλις 45 δευτερόλεπτα για να ολοκληρωθεί, από την αρχική του τοποθεσία και στον ίδιο εξωτερικό δίσκο που χρησιμοποιήσαμε και νωρίτερα! Μία ώρα και δέκα λεπτά εναντίον κάτι λιγότερο των τεσσάρων λεπτών. Τα συμπεράσματα τα αφήνω σε σας.

Αν τώρα πιστεύετε πως ο τρόπος που προτείνω είναι χαζός γιατί μετά ξεμένετε με ένα συμπιεσμένο αρχείο, έχω να επισημάνω μονάχα τα παρακάτω:
1. εφόσον κρατάμε αντίγραφο ασφαλείας, θα μπορούσαμε ακόμα και συμπιεσμένο να το κρατήσουμε αλλά μιας και αυτό είναι χαζό σαν επιχείρημα.
2. η αποσυμπίεση του αρχείου δε θα πάρει πάνω από 5-10 λεπτά στον εξωτερικό δίσκο. Αν υποθέσουμε πως θέλουμε να μεταφέρουμε τα αρχικά αρχεία πίσω στον εσωτερικό δίσκο, αντιγράφουμε το συμπιεσμένο αρχείο στον εσωτερικό δίσκο όπου και το αποσυμπιέζουμε. Στη χειρότερη περίπτωση να πάρει 4 λεπτά να αποσυμπιεστεί. Στο σύνολο έχουμε κερδίσει κάτι λιγότερο από μία ώρα με αυτόν τον τρόπο.

Καλές αντιγραφές και μη ξεχνάτε, τα αντίγραφα ασφαλείας σώζουν! Το ίδιο και ο Χριστός αλλά αυτό είναι άλλη μεγάλη συζήτηση.

Powered by Zoundry Raven

Technorati : , , , , , , , , , , , ,
Del.icio.us : , , , , , , , , , , , ,
Zooomr : , , , , , , , , , , , ,
Flickr : , , , , , , , , , , , ,

MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.