Windows 7 system uses multithreading to speed up file replication?

Source: Internet
Author: User
Tags file copy file size set time robocopy

Why can't you speed up file copy/Transfer in Windows 7 under Windows 7? You can use Robocopy to implement multithreaded file replication.

Often do file management operations friends, mention copy/paste operation, deep system download presumably many people will recall the original Vista very slow replication speed, not satisfied with the Windows system built-in copy function, because it is too turtle speed. So people use FastCopy, teracopy software to speed up replication, and Windows 7 then fixes the problem, but the effect does not seem to be ideal, but do you know that Windows 7 has built-in fast replication capabilities?

Solution:

If you want to copy a directory that contains multiple bulk files, you will need to use the RoboCopy command, which is a command line directory Replication command that has been part of the Windows Resource Kit since Windows NT 4.0, and then in Windows Vista, Windows 7 and Windows Server 2008 are built as standard features, and this tool not only replicates very quickly, but also supports the continuation of breakpoints, and can even support the timing of a copy at set time. Is this feature also upgraded in Windows 7? D? D can already support multithreading, which means that replication speeds can be greatly improved. And this feature creates two fully mirrored copies of the file structure without duplicating any unwanted duplicate files, while also allowing you to keep all relevant file information, including date and time stamps, secure access control lists (ACLs), and so on. For that n multiple small file directory replication can improve the speed of one order of magnitude, thousands of files 3 seconds to copy, and commonly used to copy and paste the way about 45 seconds.

For example, to copy all the files from disc F: to the CD directory on E disk, the rain forest wind system can run the following commands:

ROBOCOPY/S F:E:CD

Even if the disc is suddenly removed at this point, Robocopy will wait until the disc is put back into the CD and the copy will start automatically.

Robocopy also supports local area network copy, can even move the directory structure of the directory of the LAN server to the local, Robocopy support in timed operation, you can put the operation of copying to the evening, so as to avoid congestion LAN, causing inconvenience to others.

Let's take a look at the use of this command, as shown in the following illustration:

such as: RoBoCopy dir_from dir_to/e/mt:50/log:copy.log

where/e represents a subdirectory,/MT:50 is 50 threads (default 8 threads, maximum 128),/log is redirected output. More options are available with Robocopy/? view.

Command syntax: ROBOCOPY source destination [file [file] ...] [Options]

Source: Source Directory (drive: path or server share path)

Target: Destination directory (drive: path or server share path)

Files: Files to copy (name/wildcard: Default to "*.*")

To test the speed of the copied file, the following tests are done

You can see from the above figure in the case of 120 threads, replication size of a single file of 878.16MB, starting from 14:56:31, 14:57:06 end, a total of 35 seconds of time.

Path Studio (www.wzlu.com) It is suggested that in order to be able to test the number of threads in the selection can be faster copy files, the use of PowerShell scripts to test a batch of different threads in the case of copying the corresponding relationship between the time and the thread, and mapping it on the coordinates of the map, The PowerShell script for the test is as follows:

for ($i =128; $i? CLT 129 $i + +) {

robocopy/s c:cd c:testcd$i/mt: $i/log:log/copy$i.log

Remove-item C:testcd$i*.*

"$i," >>log/answ.txt.

(Get-content C:logcopy$i.log-totalcount 6) [-1] >>log/answ.txt

"," >>log/answ.txt

(Get-content C:logcopy$i.log-totalcount 10000) [-1] >>log/answ.txt}

The contents of the script output are formatted, imported into Excel in CSV format, and a line chart shows the series 1 line as shown in the following illustration:

There are 324 files in the target directory of the copy, a single file size between 1MB and 2MB, total file size 549MB, Compared to a single file with a size of 878.16MB above, the copy time is longer than before, because the number of files, need to be copied one after another for a long time, and after several experiments there will be errors, normalized as shown in the Yellow "linear (Series 1)" line in the figure, It is possible to see the same filegroup with different threads when the copy speed varies, and as the number of threads increases, the time of the copy decreases linearly.

In fact, Robocopy also has a lot of powerful ways to use, readers can use Robocopy/? command, or look at the detailed options for the RoboCopy command from the attachment at the end of this article, from which the reader will find a more powerful feature option.

Attached: detailed options for the RoboCopy command

Replication options

/S: Replicates subdirectories, but does not copy empty subdirectories.

/e: Copies subdirectories, including empty subdirectories.

/lev:n: Only the first n layers of the source tree are replicated.

/z: Copy files in restart mode.

/b: Copy files in Backup mode.

/ZB: use bootable mode; if access is denied, use Backup mode.

/efsraw: Copies all encrypted files in EFS RAW mode.

/copy: Copy Tags:: The contents of the file to be copied (default is/copy:dat). (Copy tag: d= data, a= property, t= timestamp). (s= security =ntfs acl,o= owner information, u= Audit information).

/dcopy:t: Copy directory timestamp.

/SEC: Copy the file with security (equivalent to/copy:dats).

/copyall: Copy all file information (equivalent to/copy:datsou).

/nocopy: Do not copy any file information (used with/purge).

/secfix: Fixes file security for all files, even skipped files.

/timfix: Fix all file time for files, even skipped files.

/purge: Deletes target files/directories that no longer exist in the source.

/mir: Mirrored directory tree (equivalent to/e and/purge).

/mov: Move the file (removed from the source after copying).

/move: Move files and directories (removed from the source after replication).

/a+:[rashcnet]: Adds the given property to the copied file.

/a-:[rashcnet]: Deletes the given property from the copy file.

/create: Create only a directory tree and a zero-length file.

/fat: Creates the destination file using only the 8.3 FAT file name.

/256: Turn off the Super Long path (> 256 characters) support.

/mon:n: monitoring source, running again when more than n changes are found.

/MOT:M: monitor source; If changed, run again in M-minute time.

/RH:HHMM-HHMM: Run hours-the time at which new replicas can be started.

/PF: Checks the running hours based on each file (instead of each step).

/ipg:n: Space between packages (MS) to free up bandwidth on a low-speed line.

/SL: Copy the symbolic link against the target.

/MT[:N]: Multithreading using n Threads (the default value is 8). n must be at least 1, but not greater than 128. This option is not compatible with the/IPG and/efsraw options. REDIRECT Output with the/log option for optimal performance.

File Selection Options

/A: Only files with archived attribute sets are copied.

/M: Copy only files with archive attributes and reset the archive properties.

/ia:[rashcneto]: Contains only files with any given set of attributes.

/xa:[rashcneto]: Excludes files with any given set of properties.

/XF file [file] ... : Excludes files that match a given name/path/wildcard character.

/XD directory [Directory] ... : Excludes directories that match the given name/path.

/XC: Excludes files that have changed.

/XN: Exclude newer files.

/xo: Exclude older files.

/XX: Eliminates unnecessary files and directories.

/XL: Excludes orphaned files and directories.

/IS: Contains the same file.

/IT: Contains the adjusted file.

/MAX:N: Maximum file size-excludes files larger than n bytes.

/MIN:N: Minimum file size-excludes files that are less than n bytes.

/MAXAGE:N: Maximum file presence time-excludes files older than n days/dates.

/minage:n: Shortest file existence time-excludes files that are later than n days/dates.

/MAXLAD:N: Maximum Last access date-excludes files that have not been used since N.

/MINLAD:N: Minimum last access date-files that have been used since n have been excluded. (If n <1900 then n = n days, Else n = YYYYMMDD date).

/XJ: Eliminates the junction point. (usually included by default).

/fft: Assume FAT file time (2 seconds granularity).

/DST: Make up for a 1-hour DST time lag.

/XJD: Excludes the junction point of the directory.

/XJF: Excludes the junction point of the file.

Retry options

/R:N: Retry number of failed replicas: default is 1 million.

/w:n: Two wait time between retries: default is 30 seconds.

/reg: Save the/r:n and/w:n in the registry as default settings.

/TBD: Wait to define the share name (retry error 67).

Logging options

/L: List only-do not copy, add timestamp, or delete any files.

/x: report all the extra files, not just the selected files.

/V: Generate verbose output, showing skipped files.

/ts: Contains the timestamp of the source file in the output.

/FP: Contains the full path name of the file in the output.

/bytes: Print size in bytes.

/ns: No Size-no file size is logged.

/NC: No categories-no record of file categories.

/NFL: No file list-file name not logged.

/ndl: No directory List-directory name not logged.

/NP: No progress-does not show percent copied.

/eta: Displays the expected arrival time of the copied file.

/log: File: Output status to log file (overwrite existing log).

/log+: File: Outputs the status to the log file (attached to an existing log).

/unilog: File: Output status to log file in UNICODE (overwrite existing log).

/unilog+: File: Prints the status to the log file (attached to an existing log) in UNICODE mode.

/tee: Output to console window and log file.

/NJS: No Job summary.

/unicode: Output status in UNICODE mode.

Job Options

/job: Job Name: Extracts parameters from a named job file.

/save: Job Name: Saves the parameter to the named job file.

/quit: Exit after processing the command line (to view parameters).

/NOSD: Source directory not specified.

/nodd: Destination directory not specified.

/if: Contains the following files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.