On linux, is there any software that can make virtual files point to multiple files to avoid occupying space repeatedly?

Source: Internet
Author: User
Running platform: CentOS requirement: Similar to optvirtual. file: opt1.fileopt2. fileopt3.file first, I know the merge command, but this will create a new file and occupy space. what I want is to access optvirtual. file, equivalent to system motion... running platform: CentOS

Requirement: similar

/opt/virtual.filePoint:/opt/1.file /opt/2.file /opt/3.file

First, I know the merge command, but this will create a new file and occupy space.

What I want is access/opt/virtual.fileIs equivalent to dynamically merging these three files into one as one for access.

This requirement is not a request to merge js/css in nginx_http_concat.

This is because files are separated by 5 MB/block to ensure stability during File Uploading. although these blocks can also be merged using programs, there is no software for the system to make virtual files, point to these parts, so you don't need to merge them.

Reply content:

Running platform: CentOS

Requirement: similar

/opt/virtual.filePoint:/opt/1.file /opt/2.file /opt/3.file

First, I know the merge command, but this will create a new file and occupy space.

What I want is access/opt/virtual.fileIs equivalent to dynamically merging these three files into one as one for access.

This requirement is not a request to merge js/css in nginx_http_concat.

This is because files are separated by 5 MB/block to ensure stability during File Uploading. although these blocks can also be merged using programs, there is no software for the system to make virtual files, point to these parts, so you don't need to merge them.

This must be achieved using fuse, as well as written by the great God: https://github.com/schlaile/c...

  1. Install and compile concatfs

    yum install fuse fuse-develgit clone https://github.com/schlaile/concatfs.gitcd concatfs/srcgcc -Wall concatfs.c `pkg-config fuse --cflags --libs` -o concatfscp ./concatfs /bin
  2. Start a directory by attaching
    Original Directory:
    /opt/www/website/
    Contains files
    index.html test.html
    Create a directory to be mounted
    mkdir /opt/www/website_mnt
    Run
    concatfs /opt/www/website/ /opt/www/website_mnt
    If no error is reported, it is already running in the background.

  3. Create a special file name including-concat-

    If-concat-is included, it will be specially parsed by concatfs.

    vim /opt/www/website/1-concat-.txt

    Content

    index.htmltest.html

    Note that the ending column also requires a carriage return character LF, otherwise the last file will not be loaded.

  4. Access Now/opt/www/website_mnt/1-concat-.txtThe merged data of these two files is returned.
    These two files are dynamically merged, but they are not physically merged.
    Note:website_mnt/1-concat-.txtDirectory
    Accesswebsite/1-concat-.txtStill the original file

  5. PS: No test writes/opt/www/website_mnt/1-concat-.txtStatus

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.