How to package large files (tar + split) and volumes in linux

Source: Internet
Author: User
In Linux, it is common to use the tar command to package and compress files. However, the Linux file system has a limit on the file size. that is to say, a file cannot exceed 2 GB. if the content of the compressed package is large, the final result will exceed 2 GB, so what should we do? Or...
In Linux, it is common to use the tar command to package and compress files. However, the Linux file system has a limit on the file size. that is to say, a file cannot exceed 2 GB. if the content of the compressed package is large, the final result will exceed 2 GB, so what should we do? Or if the compressed package needs to be backed up through a CD, and the size of each CD is only 700 MB, how should we store it? The solution is to split the final compressed package according to the specified size, which requires the split command. For example: to package and compress the logs directory and split it into multiple 1 m files, run the following command: tar cjf-logs/| split-B 1 m-logs.tar. after bz www.2cto.com is complete, the following files will be generated:-rw-r-1 httpd nobody 1048576 Oct 5 logs.tar.bz2. aa-rw-r-1 httpd nobody 1048576 Oct 5 :37 logs.tar.bz2. AB-rw-r-1 httpd nobody 1048576 Oct 5 :37 logs.tar.bz2. ac-rw-r-1 httpd nobody 1048576 Oct 5 logs.tar.bz2. ad-rw-r-1 httpd nobody 1048576 Oct 5 :38 logs.tar.bz2. a E-rw-r-1 httpd nobody 829440 Oct 5 logs.tar.bz2. af here I will explain some of the commands. The red part of the compressed and split command line is the corresponding I/O file name parameter, where-indicates the standard input or output. .. The two then connect their standard input and output through the pipeline. Linux split command function description: Cut files. Syntax: split [-- help] [-- version] [- <行数> ] [-B <字节> ] [-C <字节> ] [-L <行数> ] [File to be cut] [output file name] www.2cto.com supplement: split can cut the file into smaller files, by default every 1000 lines into a small file. Parameters :- <行数> Or-l <行数> Specify the number of rows to be split into a small file. -B <字节> Specify the number of words to be cut into a small file. Supported units: m, k-C <字节> Similar to the-B parameter, the integrity of each line is maintained whenever possible during cutting. -- Help: displays help. -- Version: displays the version information. [Output file name] sets the prefix file name of the cut file. split will automatically add a number after the prefix file name. Example: split-B 100 m filename author yeshuqiang
Related Article

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.