0

I knew this is a quite simple question, but I'm new in using a quite big server with two 4TB HDDs and I want to learn a lot about it.

I've got a php script that runs as a cron. The script calls a shell command (aria2c) that downloads a file from a ftp-server and put the file into a specific folder on my server. This works fine since months. The files on the server have to be downloadable for users.

But now we mounted a second hdd to get more space for files. As I can see, the mounting was successful.

Two days ago the quota of HDD1 was reached and the script threw errors. Up to this time, I believed that the upload will automatically switch to hdd2. But this was wrong! Here my question arises. How can I upload files to HDD2 and make it downloadable for users.?

My upload command for aria2c is:

aria2c --ftp-user $username --ftp-passwd $password -c -p -t 100 -s 2 --max-connection-per-server 1 --max-download-limit $speedLimit --allow-overwrite=true --file-allocation none --summary-interval 0 ftp://$server/$remfile -o files/$remfile

2 Answers 2

0

As i can see in your command you download the file in directory named "files". I suppose that it is in your main HDD "/". Run a "df" command to see where your second HDD is mounted and change the output path to something like:

/media/HDD2/files/$remfile
1
  • Thanks for your help! I have found the disk1 directory . But I do not know how to access this directory out of my php script. Because the path points out of my website root dir.: disk1: /mnt/disk1 path of a test.php: /var/www/vhosts/xxx.de/httpdocs/test/test.php mnt and var are in the same root directory
    – MPe
    Nov 4, 2015 at 15:26
0

After going through a list of errors, I found a solution for my problem:

  1. the path to my second hdd is. /mnt/disk1 (thanks to NIZ for the hint)
  2. include this dir to the open_basedir in the php.ini like: [other dirs]:/mnt/disk1
  3. log in with shell and go to the mnt dir. Make the dir disk1 writable with e.g. sudo chmod 777 disk1
  4. write a test.txt with fopen("/mnt/disk1/text.txt");
  5. The test.txt file can now be downloaded with a download script that includes the absolute path "/mnt/disk1/test.txt"

I hope that I could helb anyone who is facing the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.