Change ossn_data storage folder location

Mokona Modoki Posted in Performance and Scalability 4 years ago

Hi there

I am running OSSN in a LAMP server on raspbian (raspberry pi). The ossndata folder I indicated during the installation is currently located in the home folder, that is to say on the SD card of the raspberry pi which has little storage space. I wish to move ossndata to a larger hard drive mounted on the raspberry pi. I have tried to replace ossn_data by a symlink pointing to a folder with the same name and same permission on the hard drive (my apache site.conf file allows followsymlinks) but images appear broken on the web site, even in new posts. I am not sure what I am missing. I have tried to find a solution on the discussion threads here but could not find enough details to solve my problem, so any help is appreciated :)

Replies
Indonesian Arsalan Shah Replied 4 years ago

@Zman yes agree

German Michael Zülsdorff Replied 4 years ago

maybe it would help to mount that different filesystem with option uid=[id of apache] to make it accessable right from the beginning?
just a guess, i have no environment to verify ...

@Arsalan
then it would make sense to improve the installer to verify the accessability of the data directory BEFORE the installation continues

Indonesian Arsalan Shah Replied 4 years ago

This is how it must work as you seems ignored the installation guidelines and failed or forgot to make the directories ownership to apache user.

gb Mokona Modoki Replied 4 years ago

@~Z~ Man
Hi, thanks for your prompt reply
OK so I tried to replicate the issue this morning (I had reverted my settings to the previous working config) and I still does not work with the symlink.

I have found a workaround though, by mounting the hard drive directly in ossn_data then issuing the two following commands. Now everything works smoothly :) This should be safe, right ?

$ chown -R www-data:www-data ossn_data 
$ chmod -R 755 ossn_data

For the sake of completeness, and only if you have time to investigate the matter, here is the tail of my error_log file when I replicated the symlink issue

[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "mkdir(): File exists" in file /var/www/html/[MYSITE]/classes/OssnFile.php (line 207)
[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "exif_read_data(phpfZYuzr): File not supported" in file /var/www/[MYSITE]/classes/OssnFile.php (line 452)
[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "file_put_contents(/home/pi/ossn_data/object/24/ossnwall/images/097be7f95fb090e4b080cd147d271112.png): failed to open stream: Permission denied" in file /var/www/html/n[MYSITE]/classes/OssnFile.php (line 229)
[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "filesize(): stat failed for /home/pi/ossn_data/user/3/profile/photo/smaller_dce0b7527c297b5ece8bb6e04456c3d3.jpg" in file /var/www/html/[MYSITE]/components/OssnProfile/ossn_com.php (line 312)
[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "readfile(/home/pi/ossn_data/user/3/profile/photo/smaller_dce0b7527c297b5ece8bb6e04456c3d3.jpg): failed to open stream: Permission denied" in file /var/www/html/[MYSITE]/components/OssnProfile/ossn_com.php (line 319)
[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "filesize(): stat failed for /home/pi/ossn_data/user/3/profile/photo/small_dce0b7527c297b5ece8bb6e04456c3d3.jpg" in file /var/www/html/[MYSITE]/components/OssnProfile/ossn_com.php (line 312)
[27-Jun-2020 12:29:03 Europe/London] PHP WARNING: 2020-06-27 12:29:03 (BST): "readfile(/home/pi/ossn_data/user/3/profile/photo/small_dce0b7527c297b5ece8bb6e04456c3d3.jpg): failed to open stream: Permission denied" in file /var/www/[MYSITE]/components/OssnProfile/ossn_com.php (line 319)
German Michael Zülsdorff Replied 4 years ago

@Mokona
I remember I reported issues with copying data across different filesystems already at the times of Ossn 3.x. But I don't know whether the involved code has been changed in the meantime.

You could do us a favor and turn on Error Reporting from your Ossn admin backend and provide your error_log file to get an idea where things go wrong.

gb Mokona Modoki Replied 4 years ago

Hi Evindu Shavinda,

Thanks for your reply. My setup in new so I can still reinstall easily if I really must (no contents yet) but I would rather avoid that ;)

lk Evindu Shavinda Replied 4 years ago

I am not an expert. But sometimes you have to reinstall OSSN