Home >Backend Development >PHP Tutorial >On the Linux platform, is there any software that can create virtual files that point to multiple files to avoid duplication of space?
Running platform: CentOS
Requirements: similar to this
/opt/virtual.file
points to: /opt/1.file
/opt/2.file
/opt/3.file
First of all, I know the merge command, but this will create a new file and take up space
What I want is to access /opt/virtual.file
, which is equivalent to the system dynamically merging these three files into one and accessing them as one
This requirement is not a request to merge js/css using nginx_http_concat
In order to ensure stability when uploading files, upload them separately according to 5M/block. Although you can also use a program to merge these blocks, is there any software that allows the system to make virtual files and point to these blocks? No need to merge
Running platform: CentOS
Requirements: similar to this
/opt/virtual.file
points to: /opt/1.file
/opt/2.file
/opt/3.file
First of all, I know the merge command, but this will create a new file and take up space
What I want is to access /opt/virtual.file
, which is equivalent to the system dynamically merging these three files into one and accessing them as one
This requirement is not a request to merge js/css using nginx_http_concat
In order to ensure stability when uploading files, upload them separately according to 5M/block. Although you can also use a program to merge these blocks, is there any software that allows the system to make virtual files and point to these blocks? No need to merge
This must be implemented using fuse, and written by a master: https://github.com/schlaile/c...
Install and compile concatfs
<code>yum install fuse fuse-devel git clone https://github.com/schlaile/concatfs.git cd concatfs/src gcc -Wall concatfs.c `pkg-config fuse --cflags --libs` -o concatfs cp ./concatfs /bin</code>
Start a directory using mounting method
Original directory: /opt/www/website/
It contains files index.html
test.html
Create a directory to be mountedmkdir /opt/www/website_mnt
Execute concatfs /opt/www/website/ /opt/www/website_mnt
No error is reported and it is already running in the background
Create a special filename containing -concat-
As long as -concat- is included, it will be specially parsed by concatfs
<code>vim /opt/www/website/1-concat-.txt</code>
Content
<code>index.html test.html</code>
Note that the end column also needs to have a carriage return character LF, otherwise the last file will not be loaded
Now visit /opt/www/website_mnt/1-concat-.txt
and the data after merging these two files will be returned
It is equivalent to the two files being dynamically merged, but in fact they are not merged physically
Note It is the website_mnt/1-concat-.txt
directory
Access the original directory website/1-concat-.txt
It is still the original file
PS: There is no test of writing /opt/www/website_mnt/1-concat-.txt