Linux platform, there is no software can make virtual files to point to multiple files, avoid duplication of space?

Source: Internet
Author: User
Operating platform: CentOS

Requirements: Like this

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

First, I know the merge command, but this creates a new file and takes up space

What I want is access /opt/virtual.file , equivalent to the system dynamically merging these three files into one as one to access

This requirement is not a request to merge Js/css with Nginx_http_concat

Because when uploading the file in order to ensure stability, according to the case of 5m/block upload, although you can also use the program to merge these blocks, but there is no software can let the system do virtual files, point to these tiles, so you can not merge

Reply content:

Operating platform: CentOS

Requirements: Like this

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

First, I know the merge command, but this creates a new file and takes up space

What I want is access /opt/virtual.file , equivalent to the system dynamically merging these three files into one as one to access

This requirement is not a request to merge Js/css with Nginx_http_concat

Because when uploading the file in order to ensure stability, according to the case of 5m/block upload, although you can also use the program to merge these blocks, but there is no software can let the system do virtual files, point to these tiles, so you can not merge

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

  1. Install the compilation 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. To start a directory by using Mount mode
    Original directory:
    /opt/www/website/
    Contains files inside
    index.htmltest.html
    Create a directory to mount
    mkdir /opt/www/website_mnt
    Perform
    concatfs /opt/www/website/ /opt/www/website_mnt
    It's running in the background without an error.

  3. Create a special file name that contains-concat-

    As long as the inclusion of-concat-will be CONCATFS special parsing

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

    Content

    index.htmltest.html

    Note that the end column also needs a carriage return LF, otherwise the last file will not load

  4. Now /opt/www/website_mnt/1-concat-.txt the access will return the data after the merging of these two files
    The equivalent of these two files are dynamically merged, actually not physically merged
    Note is the website_mnt/1-concat-.txt directory
    Access to the original directory website/1-concat-.txt is still the original file

  5. PS: There is no test write /opt/www/website_mnt/1-concat-.txt case

  • 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.