graysky2 / anything-sync-daemon

Symlinks and syncs user specified dirs to RAM thus reducing HDD/SDD calls and speeding-up the system.
https://wiki.archlinux.org/index.php/Anything-sync-daemon
MIT License
349 stars 44 forks source link

asd work with psd? #36

Closed smallst closed 8 years ago

smallst commented 8 years ago

i use psd for profile sync and it works well, but although asd p output this:

Anything-sync-daemon v5.76 on Arch Linux

 Systemd service is currently active.
 Systemd resync service is currently active.
 Overlayfs v23 is currently active.

Asd will manage the following per /run/asd.conf settings:

 owner/group id:     smallst/1000
 target to manage:   /srv/http/
 sync target:        /srv/http/.-backup_asd
 tmpfs target:       /tmp/asd-smallst/srv/http/
 dir size:           522M
 overlayfs size:     0
 recovery dirs:      none

ls -a /tmp/asd-smallst/srv/http/ shows:

.  ..  -rw

and -rw directory is emtpy.

because overlayfs size is 0, i think asd not run correctly. does i think too much?

graysky2 commented 8 years ago

1) Stop asd 2) Remove the trailing slash you have in the WHAYTOSYNC array 3) Post the output of asd p

smallst commented 8 years ago

yes. after remove trailing slash, there are files in /tmp this is output now.

Anything-sync-daemon v5.76 on Arch Linux

 Systemd service is currently active.
 Systemd resync service is currently active.
 Overlayfs v23 is currently active.

Asd will manage the following per /run/asd.conf settings:

 owner/group id:     smallst/1000
 target to manage:   /srv/http
 sync target:        /srv/.http-backup_asd
 tmpfs target:       /tmp/asd-smallst/srv/http
 dir size:           522M
 overlayfs size:     0
 recovery dirs:      none
graysky2 commented 8 years ago

Please update to 5.77 (adds a check for this condition). Does asd now work as expected?

smallst commented 8 years ago

i want to say yes but.. i find localhost in browser get a 404-not found for index.html in /srv/http screenshot_2016-06-12_18-29-24

graysky2 commented 8 years ago

1) Stop asd 2) Try to browse

Does that work? I do not believe that /srv/http should be owned by your user... I believe that is root:root, no?

smallst commented 8 years ago

oh, so sorry for .. i chown /srv/http to myuser:http.. i know it is'n recommanded but i do it for convenient..

stop asd works well. but even i chown(-R) /srv/http to root:root or root:http , when i ([sudo] systemctl) start asd.service , there is 404-not found.. so sad..

graysky2 commented 8 years ago

Sorry, I didn't mean psd, I meant asd. In other words, stop asd. Try to browse, does it work? I think from your comments above the http server does work with asd disabled....

If I am correct, and that the http server does work with asd disabled. Try disabling the overlayfs mode and start asd. Does it work? Trying to figure out where the problem is:

1) With your http server? 2) With asd overlayfs + your http server 3) With asd (normal mode) + your http server

smallst commented 8 years ago

actually 3) asd(normal mode) + http server bring the problem. without asd i can visit my http server.

i use lighttpd (i think it is in http group?)

➜ smallst@ArchMiniQ /tmp > ps -ef |grep httpd                                                                                                                                      [19:12:03]
root      1684     1  0 18:33 ?        00:00:00 /usr/bin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
http      1687  1684  0 18:33 ?        00:00:00 /usr/bin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
smallst  13436  1500  0 19:14 pts/1    00:00:00 /usr/bin/grep httpd
graysky2 commented 8 years ago

So to summarize, your http server works under only 1 condition: 1) without asd

It does not work with asd under: 1) normal mode 2) overlayfs mode

Is this correct?

By contrast, I am using lighttpd with asd (normal mode) just fine :/

smallst commented 8 years ago

yes, only work without psd.

i think maybe it is caused by my mess permission. could i confirm that... /srv/http is root:http asd is start with systemctl lighttpd(1.4.39-2) is under Archlinux(x86_64 Linux 4.6.2-1-ARCH)

smallst commented 8 years ago

seems lighttpd cannot find symbolic link 'http'

it is so strange that i create a soft link in /srv/http/ (root:root , without asd) and server can find the link and follow it. but if i start asd and change my doc-root directory to /srv/, i will find there is no 'http' link anywhere.

i think i cannot solve it by myself. unless i know more about linux permission and httpd behavior.

anyway , thank you for response.

graysky2 commented 8 years ago

Again, I used the wrong term. Psd should have nothing to do with it. More likely, it is something to do with the symlink.

smallst commented 8 years ago

i think the problem is 'http' group has no permission to enter /tmp directory. but my /tmp 's permission is drwxrwxrwt . can't understand why http has no permission entering /tmp.. i think 't' only control the delete permission, or it also control the 'x' permission?

smallst commented 8 years ago

finally i change asd target directory to /run (just as psd)and everything is well.

will this cause any problem?

graysky2 commented 8 years ago

Is your /tmp setup in /etc/fstab or else where in a non-standard way or with non-standard settings?

smallst commented 8 years ago

no, i do nothing special for tmpfs or /tmp directory (if swap is related and it looks like this:

# /dev/sdb6
UUID=48465fe5-df20-40d8-8195-728903c3e8d5   none        swap        defaults    0 0

i think /tmp is setup by systemd

graysky2 commented 8 years ago

I am not sure what the problem could be ... I am using lighttpd with asd (not using overlayfs mode) and serving up basic content just fine. Do you have any special requirements with your server that might fail as a function of the permissions? Are any logs available that would help pin point the problem?

smallst commented 8 years ago

after one day testing i summarize some point:

1) with asd running, lighttpd (with php) not work. without php not work. lighttpd log shows /srv/http not found. 2) without asd running, create a symlink (replace /srv/http) can work almost everywhere except /tmp 3) change volatile = '/run' , and everything works well. (using overlayfs)

i guess maybe this is a point https://wiki.archlinux.org/index.php/Tmpfs#Opening_symlinks_in_tmpfs_as_root_fails