General NAS-Central Forums

Welcome to the NAS community
It is currently Fri Jul 21, 2017 8:42 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Jun 02, 2017 9:31 am 
Offline

Joined: Fri Jun 02, 2017 9:03 am
Posts: 4
I'm using a NSAA325 v1 (FW4.81) with Entware. After installing Syncthing, I've noticed my disks are not spinning down anymore after 45mins of inactivity. Syncthings is configured to sync once every week; I'm using it as a sort of backup setup (I know it's not a great tool for that, but anyway).

I suspect Syncthing is writing to a logfile every few minutes, which resets the inactivity timer for the disks. I've raised this issue with the Syncthing forum a while ago, and they suggested to move the config folder with logs and databases to another volume, for instance a USB stick and create a symlink, see https://forum.syncthing.net/t/syncthing-prevents-idle-spindown-of-disks-on-nas/8481

I've formatted a USB stick on my NSA325 (EXT4), copied the content of /i-data/md0/admin/Pulse to a folder on the USB stick which seems to be mounted under /e-data/<somelongGUID>/ and created a symlink at the original location, pointing to the location on the USB stick. I've verified correct access to the folder. However, Syncthing somehow refuses to autostart after a reboot after that. If I change it back, it works again (verified with 'ps' to find the process). If I start it manually, by specifyning the path (Syncthing -home="<pathtoUSB>" it works, but it I get a warning about it not running it under system credentials because of security.

I've also extracted the contents of the Syncthing zpkg and found the location of the install/startup script, which - I believe - is located in /usr/local/zy-pkgs/etc/init.d/Pulse I tried to modify the PKG_HOME=/i-data/md0/admin/Pulse variable to point to the location on USB stick but that doesn't work.

So, does anybody how to modify (the path to) Syncthing to write it's contents to the USB-stick?


Top
 Profile  
 
PostPosted: Fri Jun 02, 2017 2:44 pm 
Offline

Joined: Sun Apr 29, 2012 5:24 pm
Posts: 2289
Would you mind to paste output of:
Code:
ls -la /i-data/md0/admin/Pulse


Top
 Profile  
 
PostPosted: Fri Jun 02, 2017 3:56 pm 
Offline

Joined: Fri Jun 02, 2017 9:03 am
Posts: 4
Sure:
Code:
~ $ ls -la /i-data/md0/admin/Pulse
drwx------    4 admin    root          4096 Jun  2 10:42 .
drwxrwxrwx    6 root     root          4096 Nov 20  2016 ..
drwx------    2 admin    everyone      4096 Jun  1 17:03 Sync
-rw-rw-rw-    1 admin    everyone      1415 Apr 17 14:09 cert.pem
-rw-------    1 admin    everyone      3842 Jun  1 17:23 config.xml
-rw-------    1 admin    everyone      2813 May 30 15:35 config.xml.v19
-rw-------    1 admin    everyone       396 Jun  2 10:42 csrftokens.txt
-rw-rw-rw-    1 admin    everyone      1407 Apr 17 14:11 https-cert.pem
-rw-------    1 admin    everyone      2455 Apr 17 14:11 https-key.pem
drwxr-xr-x    2 admin    everyone      4096 Jun  1 19:53 index-v0.14.0.db
-rw-------    1 admin    everyone      2455 Apr 17 14:09 key.pem
-rw-rw-rw-    1 admin    everyone    248051 Jun  2 17:43 lastlog


Top
 Profile  
 
PostPosted: Fri Jun 02, 2017 4:29 pm 
Offline

Joined: Sun Apr 29, 2012 5:24 pm
Posts: 2289
Maybe I am blind right now, but I don't see symlink here like /i-data/md0/admin/Pulse -> /e-data/<somelongGUID>/Pulse.
Quote:
I've formatted a USB stick on my NSA325 (EXT4),
Using NAS admin WEB UI? Which file system for USB? EXT4 also?
Quote:
copied the content of /i-data/md0/admin/Pulse
Make sure that all of your copied content has the same owner as in original location.


Top
 Profile  
 
PostPosted: Sat Jun 03, 2017 10:44 am 
Offline

Joined: Fri Jun 02, 2017 9:03 am
Posts: 4
barmalej2 wrote:
Maybe I am blind right now, but I don't see symlink here like /i-data/md0/admin/Pulse -> /e-data/<somelongGUID>/Pulse.
Hi Barmalej2, really appreciate your efforts! Rest assured; you're not blind ;-) Before possting the original question I reverted everything to it's original state; so the symlink isn't there.
Quote:
Using NAS admin WEB UI? Which file system for USB? EXT4 also?
Yes, Ext4 on the USB stick; yes, formatted though the webgui of the NAS.
I've tried to recreate the situation as described in the original post.

In its's original state, the following instances of Syncthing are running (partial output of 'ps' :
Code:
...
 3843 admin     781m S    /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999
...
 3951 admin     782m S    /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999
...
I don't really think that 2 instances should be running, but perhaps that's a result of my tinkering.

Killed both processes, copied the contents of '/i-data/md0/admin/Pulse' to the USB stick:
Code:
/e-data/bdfbcd3a-e743-435a-a122-31e43039f44d/Pulse # ls -l
drwx------    2 admin    everyone      4096 Jun  3 11:54 Sync
-rw-r--r--    1 admin    everyone      1415 Jun  3 11:54 cert.pem
-rw-------    1 admin    everyone      3842 Jun  3 11:54 config.xml
-rw-------    1 admin    everyone      2813 Jun  3 11:54 config.xml.v19
-rw-------    1 admin    everyone       396 Jun  3 11:54 csrftokens.txt
-rw-r--r--    1 admin    everyone      1407 Jun  3 11:54 https-cert.pem
-rw-------    1 admin    everyone      2455 Jun  3 11:54 https-key.pem
drwxr-xr-x    2 admin    everyone      4096 Jun  3 11:54 index-v0.14.0.db
-rw-------    1 admin    everyone      2455 Jun  3 11:54 key.pem
-rw-r--r--    1 admin    everyone    424734 Jun  3 11:54 lastlog
/e-data/bdfbcd3a-e743-435a-a122-31e43039f44d/Pulse # cd /i-data/md0/admin/Pulse/
/i-data/4d0e2205/admin/Pulse # ls -l
drwx------    2 admin    everyone      4096 Jun  1 17:03 Sync
-rw-rw-rw-    1 admin    everyone      1415 Apr 17 14:09 cert.pem
-rw-------    1 admin    everyone      3842 Jun  1 17:23 config.xml
-rw-------    1 admin    everyone      2813 May 30 15:35 config.xml.v19
-rw-------    1 admin    everyone       396 Jun  2 10:42 csrftokens.txt
-rw-rw-rw-    1 admin    everyone      1407 Apr 17 14:11 https-cert.pem
-rw-------    1 admin    everyone      2455 Apr 17 14:11 https-key.pem
drwxr-xr-x    2 admin    everyone      4096 Jun  1 19:53 index-v0.14.0.db
-rw-------    1 admin    everyone      2455 Apr 17 14:09 key.pem
-rw-rw-rw-    1 admin    everyone    424734 Jun  3 11:51 lastlog
/i-data/4d0e2205/admin/Pulse #
After that, I renamed the Pulse folder at the original location to Pulse.old and created a symlink to the new location:
Code:
/i-data/4d0e2205/admin # ls
Pulse     download  zy-pkgs   zyfw
/i-data/4d0e2205/admin # mv Pulse Pulse.old
/i-data/4d0e2205/admin # ls -l
drwx------    4 admin    root          4096 Jun  2 10:42 Pulse.old
drwxrwxrwx    4 admin    everyone      4096 Nov 20  2016 download
drwxrwxrwx    3 root     root          4096 Jun  1 16:51 zy-pkgs
drwxrwxrwx    2 root     root          4096 Jun  1 16:56 zyfw
...
/i-data/4d0e2205/admin # ln -s /e-data/bdfbcd3a-e743-435a-a122-31e43039f44d/Pulse Pulse
/i-data/4d0e2205/admin # ls
Pulse      Pulse.old  download   zy-pkgs    zyfw
/i-data/4d0e2205/admin # ls -l
lrwxrwxrwx    1 root     root            50 Jun  3 12:09 Pulse -> /e-data/bdfbcd3a-e743-435a-a122-31e43039f44d/Pulse
drwx------    4 admin    root          4096 Jun  3 12:08 Pulse.old
drwxrwxrwx    4 admin    everyone      4096 Nov 20  2016 download
drwxrwxrwx    3 root     root          4096 Jun  1 16:51 zy-pkgs
drwxrwxrwx    2 root     root          4096 Jun  1 16:56 zyfw
/i-data/4d0e2205/admin # cd Pulse
/e-data/bdfbcd3a-e743-435a-a122-31e43039f44d/Pulse #

At this point, the symlink is owned by root. I keep switching between the 'admin' and 'root' with su because of permission stuff. You have probably noticed by now that I'm not really a Linux guru... :-)
From here, I can start Syncting via commandline as 'admin' pointing to the symlink:
Code:
/i-data/4d0e2205/admin # /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999
[monitor] 12:29:02 INFO: Starting syncthing
[72CNH] 12:29:02 INFO: syncthing v0.14.29 "Dysprosium Dragonfly" (go1.8.3 linux-arm) jenkins@build.syncthing.net 2017-05-18 05:47:51 UTC
[72CNH] 12:29:02 INFO: My ID: <snip!>
[72CNH] 12:29:04 INFO: Single thread SHA256 performance is 6.7 MB/s using minio/sha256-simd (5.0 MB/s using crypto/sha256).
[72CNH] 12:29:06 INFO: Hashing performance with weak hash is 5.11 MB/s
[72CNH] 12:29:08 INFO: Hashing performance without weak hash is 5.57 MB/s
[72CNH] 12:29:09 INFO: Weak hash enabled, as it has an acceptable performance impact.
...
[72CNH] 12:29:44 INFO: TCP listener ([::]:22000) starting
[72CNH] 12:29:45 INFO: c.S.listenerSupervisor: Failed service 'dynamic+https://relays.syncthing.net/endpoint' (1.000000 failures of 2.000000), restarting: true, error: "{dynamic+https://relays.syncthing.net/endpoint dynamic+https://relays.syncthing.net/endpoint} returned unexpectedly", stacktrace: [unknown stack trace]
[72CNH] 12:29:45 INFO: GUI and API listening on 192.168.1.10:9999
[72CNH] 12:29:45 INFO: Access the GUI via the following URL: http://192.168.1.10:9999/
...
[72CNH] 12:29:46 WARNING: Syncthing should not run as a privileged or system user. Please consider using a normal user account.
...
So, it appears the symlink is working. Opening up another terminal, I see 2 processes:
Code:
10942 root      781m S    /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999
10946 root      782m S    /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999
If I close the original terminal, Syncthing stops.


Last edited by CaptainKansloos on Sat Jun 03, 2017 10:52 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Jun 03, 2017 10:50 am 
Offline

Joined: Fri Jun 02, 2017 9:03 am
Posts: 4
Lo and behold! Did a reboot after posting the stuff above:
Code:
 3898 admin     781m S    /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999
...
 4003 admin     782m S    /usr/local/zy-pkgs/bin/syncthing -home=/i-data/md0/admin/Pulse -gui-address=http://192.168.1.10:9999

Suddenly, It appears to be working! I also see the timestamps are changing:
Code:
/e-data/bdfbcd3a-e743-435a-a122-31e43039f44d/Pulse $ ls -l
drwx------    2 admin    everyone      4096 Jun  3 09:54 Sync
-rw-r--r--    1 admin    everyone      1415 Jun  3 09:54 cert.pem
-rw-------    1 admin    everyone      3842 Jun  3 09:54 config.xml
-rw-------    1 admin    everyone      2813 Jun  3 09:54 config.xml.v19
-rw-------    1 admin    everyone        33 Jun  3 10:42 csrftokens.txt
-rw-r--r--    1 admin    everyone      1407 Jun  3 09:54 https-cert.pem
-rw-------    1 admin    everyone      2455 Jun  3 09:54 https-key.pem
drwxr-xr-x    2 admin    everyone      4096 Jun  3 10:40 index-v0.14.0.db
-rw-------    1 admin    everyone      2455 Jun  3 09:54 key.pem
-rw-r--r--    1 admin    everyone      5080 Jun  3 10:41 lastlog

Don't know what I did differently this time, but I'm happy with the result! Anyway, thank you for your time and efforts Barmalej2! Now, wait and see if this solves the original issue of the disks not spinning down anymore. Sure hope it helps!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 70 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group