Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Symbolic link help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Symbolic link help

mobiboymobiboy Member
edited January 2015 in Help

Guys I have a dedicated server on which i host files, the files are hosted in path: /home/admin/public_html/files/

i have 2 HDD each of 3TB space, first hdd is full so i partitioned the 2nd HDD and mounted it to a newly created folder with path: /home/admin/public_html/files2/

now i am trying to link both the directories using symbolic link option but its not happening, when i am uploading a file in /home/admin/public_html/files2/ directory i cant access it from /home/admin/public_html/files/ directory please help

Comments

  • Why not mount to /home/admin/public_html/files2/ directly?.

  • @mustafaramadhan said:
    Why not mount to /home/admin/public_html/files2/ directly?.

    I guess u saying i should mount directly on /home/admin/public_html/files/ right? if i do so my previous uploaded files will not be shown, only the new uploaded files will show, i want both old and new files to be accessable from /home/admin/public_html/files2/

  • You probably should have set them up as a RAID when starting. You can mount the second drive as blah/blah/files2 and then use some fancy rewrites with the web server to check the second location if the file is not found in the first.

  • Also, 6 TB with no redundancy? You're living on the edge.

  • ^bro while setting up the server i was newbie, i didnt knew this would be so complicated in future, it thought there will be some simple way :(

  • JustAMacUserJustAMacUser Member
    edited January 2015

    I understand. My comment wasn't intended to offend.

    I'm not sure if there's a way to make an array (striped) out of two existing drives, but if there is I would think data loss is a significant risk. Even now, if the data is replaceable I would reconsider and go with 3 TB mirrored.

    Nevertheless, my original comment stands in that I think web server rewrites are your best bet. In Nginx you can use try_files and Apache mod_rewrite.

    Edit: Also, I know it seems a little confusing, but instead of symlinking the second drive, I would (as suggested in the other thread) actually just mount the volume where you need it (.../files2) using /etc/fstab.

  • mobiboymobiboy Member
    edited January 2015

    I need the volume in /home/admin/public_html/files/ not in /home/admin/public_html/files2/,but the confusion is that it will than not show my old uploaded files in /home/admin/public_html/files/ this directory, i need both old files as well as the files i am going to upload further. i have already mounted the 2nd drive to /home/admin/public_html/files2/ but am unable to access it from /home/admin/public_html/files/

  • probably you should not make more than one thread on the same topic... I commented on the other one already. you have to mount your new drive to an empty directory, so not as /home/admin/public_html/files2/ beside your old one, but maybe something within your old folder like /home/admin/public_html/files/2nd/

  • JustAMacUserJustAMacUser Member
    edited January 2015

    mobiboy said: I need the volume in /home/admin/public_html/files/ not in /home/admin/public_html/files2/,but the confusion is that it will than not show my old uploaded files in /home/admin/public_html/files/

    You're correct, but if you're using Apache you can use mod_rewrite to do a internal redirect to check an alternative location if the file doesn't exist.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/files/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^/files/(.*)$ /files2/$1 [L]
    </IfModule>
    

    If you're using Nginx you can use try_files:

    location ~ ^/files/(.*)$ {
        try_files $uri /files2/$1;
    }
    

    On the front-end the difference in drives would be invisible.

    Thanked by 2mobiboy Falzo
  • @JustAMacUser said:
    On the front-end the difference in drives would be invisible.

    +1 for this suggestion. easy to setup after all.

Sign In or Register to comment.