Synology Drive Server Bestanden Geïndexeerd

Synology Drive Server Bestanden Geïndexeerd

Voer het volgende commando uit om het aantal geïndexeerde bestanden te vinden.

for v in `find /volume* -maxdepth 0`;do for cs in `find “$v/@synologydrive” -maxdepth 0`;do for v in `find “$cs/@sync/view” -name view-db.sqlite`;do sudo sqlite3 “$v” “select count(*) from node_table”;done;done;done|awk ‘{s+=$1} END {print “Total Count: “s}’

Synology SMB instelling

Synology SMB instellingen

 

SSH connection:

for example admin@server

sudo -i

vi /etc/samba/smb.conf

Under global section:

server signing=mandatory
client signing=mandatory

min protocol=SMB2
max protocol=SMB3

De SMB connectie met macOS wordt gecontroleerd met het volgende commando in een terminal sessie.

Biedt de SMB-server een shares aan;

smbutil lookup <servername>

Is een SMB verbinding aanwezig (smbfs);

mount

Welke versie SMB wordt gebruikt (SMB_version);

smbutil statshares -a

De SMB connectie met Windows 10 wordt gecontroleerd met het volgende commando in een terminal sessie.

net use

check welke versie SMB gebruikt wordt (SMB_version);

PowerShell:

Get-SmbConnection

Get-SmbConnection | Select-Object -Property *

 

Synology UPS NUT

Synology UPS NUT

Synology UPS NUT (network UPS Tools), door aan een Synology NAS een UPS te koppelen wordt voorkomen dat er dataverlies optreedt of hardware stuk gaat bij een stroomstoring. Daarnaast kunnen ook andere apparaten een seintje krijgen om uitgezet te worden bij een stroomstoring. Synology has implemented NUT: http://networkupstools.org

Synology UPS NUT

De gebruikte configuratie voor Synology UPS NUT:

Synology NAS connected via Dataport to APC Back-UPS ES 700.

Synology DSM 6.1 en 6.2

The configuration files on the Synology NAS  are found here:

/usr/syno/etc/ups, which you can access via a terminal

upsd.conf

upsd.users

ups.conf

After changing the file you can reload the configuration:

upsd -c reload

Settings via the Synology GUI
GUI, control panel, Hardware & Power, General

restart automatically after a power failure

GUI, control panel, Hardware & Power,UPS

Select Enable Network UPS Server, Permitted Disk Station Devices.

Select the devices who are allowed to connect.

To get UPS status information from another device and user:

you have to be in the upsd.users file and be in the list of permitted disk station devices, (control panel, Hardware & Power, UPS)

run the following command to check UPS information and status from another device:

upsc <name ups, see NAS /usr/syno/etc/ups/ups.conf>@<ip address NAS>

for example upsc ups@192.168.1.10

To change a value for example for testing:

upsrw -s battery.charge.low=<new value> -u <user, defined in upsd.conf NAS> -p <password user in upsd.conf> <name ups, see NAS /usr/syno/etc/ups/ups.conf>@<ip address NAS>

To install a nut client on a Mac:

I used Fink Project;  http://www.finkproject.org to install Fink Project.

To install nut on your Mac:

fink install nut

The configuration files:

/sw/etc/nut

upsmon.conf:

RUN_AS_USER root

MONITOR <name ups, see synology ups.conf>@<ip address> 1 <user, see synology upsd.users> <password, see synology upsd.users> slave

MINSUPPLIES 1

SHUTDOWNCMD "/sbin/shutdown -u -h +0"

NOTIFYCMD /sw/sbin/upssched

POLLFREQ 5

POLLFREQALERT 5

HOSTSYNC 15

DEADTIME 15

POWERDOWNFLAG /etc/killpower

NOTIFYFLAG ONLINE EXEC
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT EXEC
NOTIFYFLAG NOCOMM EXEC
NOTIFYFLAG COMMBAD IGNORE
NOTIFYFLAG COMMOK IGNORE
NOTIFYFLAG SHUTDOWN IGNORE
NOTIFYFLAG FSD EXEC
NOTIFYFLAG NOPARENT SYSLOG

RBWARNTIME 43200

NOCOMMWARNTIME 300

FINALDELAY 5

upssched.conf

CMDSCRIPT /sw/bin/upssched-cmd

PIPEFN /sw/var/run/ups/upssched/upssched.pipe

LOCKFN /sw/var/run/ups/upssched/upssched.lock

AT ONBATT <name ups, see synology ups.conf>@<ip address> EXECUTE on-battery

/sw/bin/upssched-cmd:

case $1 in
upsgone)
logger -t upssched-cmd "The UPS has been gone for awhile"
;;

on-battery)
osascript -e 'tell app "System Events" to display dialog "Power failure. Save your work" giving up after 20 buttons {"OK"} default button 1 with icon caution'
;;

*)
logger -t upssched-cmd "Unrecognized command: $1"
;;
esac

To start upsmon manually: 

sudo upsmon -D (/sw/sbin/upsmon)

-D       Raise the debugging level. upsmon will run in the foreground and

prints information on stdout about the monitoring process. Use this

multiple times for more details.

upsmon -c stop ( stop monitoring and exit)

upsmon -c reload ( reread upsmon.conf) 

To start upsmon automatically on a macOS Sierra :

/Library/LaunchDaemons

-rw-r--r--   1 root  wheel   org.networkupstools.upsmon.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.networkupstools.upsmon</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/sw/sbin/upsmon</string>
<string>-D</string> <!-- "-D" keeps upsmon from going into the background -->
</array>
<key>KeepAlive</key>
<true/>
<key>SuccessfulExit</key>
<false/> <!-- Do not respawn at shutdown time -->
</dict>
</plist>

To load manually:

sudo launchctl load /Library/LaunchDaemons/org.networkupstools.upsmon.plist

system.log:

com.apple.xpc.launchd[1] (org.networkupstools.upsmon): Unknown key for Boolean: SuccessfulExit
com.apple.xpc.launchd[1] (org.networkupstools.upsmon): This service is defined to be constantly running and is inherently inefficient.

To see if it is running:

sudo launchctl list|fgrep -v com.app

PID     Status  Label

<PID> 0 org.networkupstools.upsmon

ps -ef |grep upsmon

0 88 1 0 9:52AM 0:00.01 /sw/sbin/upsmon -D
0 167 88 0 9:52AM  0:00.50 /sw/sbin/upsmon -D

To install a nut client on Linux CentOS 6.9 :

Download the binary package of Feodora EPEL6, nut-client

Install on Linux machine with rpm command:

for example: rpm -ivh nut-client-2.6.5-2.el6.x86_64.rpm

make a user nutmon and at to group nut:

adduser nutmon

passwd nutmon

usermod -a -G nut nutmon

groups nut

Config files:

/etc/ups/

check nut group read rights upsmon.conf

upsmon.conf:

RUN_AS_USER nutmon

MONITOR <name ups, see synology ups.conf>@<ip address> 1 <user, see synology upsd.users> <password, see synology upsd.users> slave

MINSUPPLIES 1

SHUTDOWNCMD "/sbin/shutdown -h +0"

POLLFREQ 5

POLLFREQALERT 5

HOSTSYNC 15

DEADTIME 15

POWERDOWNFLAG /etc/killpower

RBWARNTIME 43200

NOCOMMWARNTIME 300

FINALDELAY 5

To run upsmon at startup:

chkconfig --list ups

chkconfig ups on

to check upsmon running:

service ups status

ps -ef |grep upsmon:

root          2271     1    0 Jul08 ?          00:00:00 /usr/sbin/upsmon

nutmon    2273  2271  0 Jul08 ?          00:00:09 /usr/sbin/upsmon

To start en stop upsmon:

service ups start

service ups stop

The nut client on Ubuntu 20.04 :

Check permission on Synology NAS to connect to network UPS server

Synology GUI, control panel, Hardware & Power,UPS

Select Enable Network UPS Server, Permitted Disk Station Devices.

Select the devices which are allowed to connect.

On Linux computer via the terminal.

  • Sudo apt install nut-client
  • Check permission on Synology NAS to connect to network UPS server

sudo upsc <user>@<synology server>

for example upsc ups@192.168.1.10

  • sudo adduser nutmon
  • sudo usermod -a -G nut nutmon
  • cd /etc/nut
  • sudo vi upsmon.conf:

RUN_AS_USER nutmon

MONITOR <name UPS>@<synology nas server> 1 <user> <password> slave

"slave" means this system shuts down immediately when power goes critical.

<powervalue> is an integer - the number of power supplies that this UPS

# feeds on this system.  Most computers only have one power supply, so this

# is normally set to 1.  You need a pretty big or special box to have any

# other value here.

For example:

MONITOR ups@192.168.1.10 1 monuser password slave

MINSUPPLIES 1

SHUTDOWNCMD "/sbin/shutdown -h +0"

POLLFREQ 5

POLLFREQALERT 5

HOSTSYNC 15

DEADTIME 15

POWERDOWNFLAG /etc/killpower

RBWARNTIME 43200

NOCOMMWARNTIME 300

FINALDELAY 5

  • sudo vi nut.conf

MODE=netclient

  • sudo systemctl enable nut-client
  • sudo systemctl start nut-client
  • sudo systemctl status nut-client

 

Heeft u hulp nodig. Klik hier voor contact met Diktio Solutions.

Synology Terminal Commando

Synology Terminal Commando

Synology Terminal Commando laat meerdere commando's zien die uitgevoerd kunnen worden na het maken van een ssh verbinding met de Synology NAS. Ssh moet wel eerst ingeschakeld worden op de Synology NAS om verbinding te kunnen maken.

Synology Terminal Commando

 

 

 

 

 

 

 

start terminal via ssh

ssh user@host

sudo -i

Geef nogmaals het wachtwoord op, hierna kunnen commando's uitgevoerd worden.

Check Network traffic and Bandwidth on Synology NAS.

synogear install

iftop

Synology Terminal commando check open port en programma:

netstat -natpu

-a, --all                display all sockets (default: connected)

-n, --numeric        don't resolve names

-p, --programs      display PID/Program name for sockets

-t                         display only TCP connections

-u.                       display only UDP connections

Synology check network performance

ifconfig

ethtool -S eth0

ethtool -g eth0

netstat -s -p TCP

Synology display activity like pid, processor, memory and

htop

Synology geheugengebruik

free -h

Check Space Usage

cd /volume1

du -h -d1

 

Synology reset Twee-factor Authenticatie

Synology reset 2FA met SSH ingeschakeld

Synology reset 2FA legt uit hoe 2FA te resetten als SSH nog steeds ingeschakeld is. De commando’s worden uitgevoerd via een terminal sessie en SSH moet ingeschakeld zijn op de Synology NAS. In het geval dat er 1 administrator op de NAS is en 2FA moet gereset worden omdat alle 5 emergency codes verbruikt zijn is het nog mogelijk 2FA te resetten als SSH ingeschakeld is.

Synology terminal session

You have to make sure that SSH is enabled on the Synology NAS. This can be done from the control panel under Terminal & SNMP. For Windows you can use PuTTY to connect via SSH.

Zorg dat SSH is ingeschakeld op de Synology NAS. Dit kan in control panel onder Terminal & SNMP. Voor Windows kan je gebruik maken van PuTTY om een SSH verbinding te maken.

Terminal command:

ssh <admin user>@server

sudo -i

cd /usr/syno/etc/preference/

choose the user which 2FA you want to reset.

cd <user>

rm google_authenticator

 

Synology rsync synchronisatie terminal

Synology rsync synchronisatie terminal

Synology rsync synchronisation terminal explains the steps to synchronise two shared folders via the rsync protocol. The rsync commando's are executed in a terminal session that's why SSH must be enabled on the Synology NAS. Be careful running the terminal commands because files and folders can be deleted, running the commands is at your own risk. 

 

Synology rsync synchronisation terminal

Synology rsync synchronisation terminal access

You have to make sure that SSH is enabled on the Synology NAS. This can be done from the control panel under Terminal & SNMP. For Windows you can use PuTTY to connect via SSH.

Terminal command:

ssh <admin user>@server

sudo -i

Turn on rsync on the Synology NAS-servers

To turn on rsync on the Synology NAS open control panel, file services, enable rsync service. Both Synology NAS-servers should have the rsync service running otherwise the Synology rsync synchronisation terminal commands don't run.

Identify both folders for Synology rsync synchronisation

Choose which folder on the source Synology NAS you want to synchronise to the other Synology NAS server which will be the destination. When the folder on the destination doesn't exits it will be created but not seen in the control panel as a shared folder. You can make it a shared folder afterwards and the synchronised data will not be overwritten. It is also possible to create first the shared folder on the destination NAS before the synchronisation. The advantage here is that the folder is created with the correct settings like permissions.

Hyper Backup and the difference with Synology rsync synchronisation terminal commands

With Hyper Backup you can create a rsync copy (single-version). The disadvantage from this way is that a subfolders are created under the destination shared folder and not directly inside the shared destination folder. The rsync job will create a backup folder and is not suitable for this purpose.

Shared Folder Sync and the difference with Synology rsync synchronisation terminal commands

When you have already on the destination, shared folders with identical names as the source shared folders, the folders at destination will be renamed! When the folders don't exists on the destination the will be created. When you already have a shared folder on the destination and the data is quit large, deleting the folder will take more time than to synchronise only the differences. After the creating of the shared folder at the destination you cannot access the files without changing the permissions. Also changing the files/folders at the destination after changing the permissions will not result in synchronising the source folders to the destination, running a full synchronisation does the job.

Synology rsync synchronisation terminal commands

Let me start by saying to be careful how you proceed with the following commands because they will overwrite and delete files and folder!  So test first and check if the command is doing as expected.

Run the following Synology rsync synchronisation terminal commands at your own risk and first test before usage!!!!

Name Source Synology NAS server: server01

Name Destination Synology NAS server: server02

Shared folder on server01: test test

Shared folder on server02: test test

start terminal session on server01 or server02:

Terminal command:

ssh <admin user>@<servername>

sudo -i

command is run from server01 or server02:

Assumed volume1

Purpose: make source shared folder the same on the destination NAS.

Delete files/folders within the destination shared folder to make sure that the destination shared folder is the same as the source shared folder.

Running the Synology rsync synchronisation terminal command

Run the following Synology rsync synchronisation terminal commands at your own risk and first test before usage!!!!

from server 02:

rsync -avhz --delete <admin user>@server01:"'/volume1/test test/'" "/volume1/test test/"

from server 01:

rsync -avhz --delete "/volume1/test test/" <admin user>@server02:"'/volume1/test test/'"

-a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)

-v, --verbose               increase verbosity

-h human readable

-z, --compress              compress file data during the transfer

-r, --recursive             recurse into directories

-l, --links                 copy symlinks as symlinks

-p, --perms                 preserve permissions

-t, --times                 preserve modification times

-o, --owner                 preserve owner (super-user only)

-g, --group                 preserve group

     --devices               preserve device files (super-user only)

     --specials              preserve special files

-D                          same as --devices --specials

--delete delete files in the destination.

Synology scp command

Synology scp command

Synology scp command via the terminal explains the steps to secure copy a folder to another NAS folder via the scp command. The scp command is executed in a terminal session that's why SSH must be enabled on the Synology NAS. Be careful running the terminal commands because files and folders can be deleted, running the commands is at your own risk. 

 

Synology scp command

Synology scp command terminal access

You have to make sure that SSH is enabled on the Synology NAS. This can be done from the control panel under Terminal & SNMP. For Windows you can use PuTTY to connect via SSH.

Terminal command:

ssh <admin user>@server

sudo -i

Identify both folders:

Choose which folder on the source Synology NAS you want to copy to the other Synology NAS server which will be the destination. If the destination folder doesn't exists you can create it before the copy.

Synology scp command

Let me start by saying to be careful how you proceed with the following commands because they will overwrite and delete files and folder!  So test first and check if the command is doing as expected.

Run the following scp command at your own risk and first test before usage!!!!

Name Source Synology NAS server: server01

Name Destination Synology NAS server: server02

Shared folder on server01: test test

Shared folder on server02: test test

start terminal session on server02:

Terminal command:

ssh <admin user>@server01

sudo -i

command is run from server01:

Assumed volume1

Purpose: make source shared folder the same on the destination NAS.

Secure copy files/folders within the source shared folder to the destination folder. Also copy hidden files.

Running the Synology scp command

Run the following scp command at your own risk and first test before usage!!!!

cd /volume1

pwd

scp -rp  test\ test/.  <admin user>@server02:"'/volume1/test test/'"

-r      Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal

-p     Preserves modification times, access times, and modes from the original file.

.       Will copy also hidden files.

Synology connectie aanpassen

Synology change connection

Synology change connection shows how to change the connection without a new synchronisation. Sometimes you cannot change the connection because it is grayed out and you have to unlink first and make a new connection.

 

Synology change connection

 

Synology change connection settings Cloud Station ShareSync:

 

1. Use Chrome to login DSM and launch Cloud Station ShareSync to start editing the connection of the task.

2. Enable the Developer Tools:

3. Go to the Console tab:

4. Input the following command and hit enter:

document.querySelector(“.syno-dscc-create-wizard input[name=address]”).disabled = false;

5. Now it’s possible to edit the server address even it’s still greyed out:

 

6. Once it’s done, click on “Apply” to confirm and Cloud Station ShareSync would start connecting to the newly specified server address:

 

 

Synology Hulpprogramma

Synology Hulpprogramma’s

Synology utilities gives a list of applications which are handy to be used with Synology.

Synology Utilities

WinMerge

WinMerge is Open Source and is a tool for comparing folders and files.

For the link to the website click here.

TLPD

TLPD (Too Long Paths Detector) is a tool to tackle the path name too long issue.

For the link to the website click here.

Teracopy

Is a tool for advanced copy of files

For the link to the website click here.

GoodSync

Is a tool for File Backup and File Synchronization

For the link to the website click here.


Need to know more about Diktio Solutions & Synology

click here

Synology Terminal Mount Volume & Map

Synology Terminal Mount Volume & Map

Synology Terminal Mount Volume & Map shows commands you can execute via the terminal to mount volumes or encrypted shared folders. Always contact Synology support first for help and follow their directions and make sure you have a working backup. If you like to try it is on your own risk!

 

Synology Terminal Mount

 

Always contact Synology support first for help and make a working backup first. Use this steps on your own risk!

Synology Terminal Mount after a crashed volume:

after a crashed volume which is not recoverable from the GUI you can try to mount the volume as read-only in a terminal.

Make terminal ssh connection to Synology NAS.

cat /etc/fstab

fdisk -l

cat /proc/mdstat

mdadm --detail /dev/<mdX, check cat /proc/mdstat>

check md not listed. For example md9

use at own risk:

mdadm -A -R /dev/<md not listed> /dev/<disk not crashed> /dev/<disk not crashed>

-A, --assemble Assemble a pre-existing array

-R, --run Attempt to start the array even if fewer drives were given than are needed for a full array. Normally if not all drives are found and --scan is not used, then the array will be assembled but not started. With --run an attempt will be made to start it
anyway.

command should return the message "mdadm: /dev/<md not listed>  has been started with x drives."

lvm vgscan : take note of volume group name

vgchange -a y <volume group name, for example:vg1000>

-a, --activate

The command to mount the volume as read-only in order:

mount -o ro,noload /dev/<volume group name>/lv /volume1

volume group must exists on your system.

the volume should be reachable in the terminal session.

To see the data in DSM using File Station or Windows File Service (SMB)

synospace --map-file -d

synocheckshare

Synology Terminal Mount encrypted map:

Always contact Synology support first for help and make a working backup first. Use this steps on your own risk!

You need the password to decrypt the shared folder.

If you don't have the password but you have the key file, you can run the following command to retrieve the password, I used a Ubuntu Linux system with ecryptfs-utils installed.

printf "%s" "\$1\$5YN01o9y" | ecryptfs-unwrap-passphrase <keyfile.key>

 

Make terminal ssh connection to Synology NAS.

cd /volume<>

ls -al

check your folders, for example  an encrypted folder named encrypt

@encrypt@ and encrypt

If only @encrypt@ exits and not encrypt this could mean the @encrypt@ folder is not mounted on mount point encrypt.

check with ls command the ls

ls -al @encrypt@ and ls-al encrypt

mount

and check it encrypted folder is mounted ( for example):

when it is mounted it will show:

/volume1/@encrypt@ on /volume1/encrypt type ecryptfs (rw,relatime,ecryptfs_fnek_sig=<>,ecryptfs_sig=<>,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_unlink_sigs)

when encrypt is not mounted it will not show this line after the mount command.

to mount the @encrypt@ folder on mount point encrypt.

first check if encrypt folder exists.

if not exits run mkdir encrypt ( this directory wil be deleted after encrypting the folder from the GUI, the folder cannot be removed with the rm command)

to mount:

mount.ecryptfs \@encrypt\@/ encrypt/

Passphrase: <fill in the password used to encrypt the folder, without the password you cannot see your data>

Select cipher: 

 1) aes: blocksize = 16; min keysize = 16; max keysize = 32

 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56

 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24

 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32

 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32

 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16

Selection [aes]: select 1 aes

Select key bytes: 

 1) 16

 2) 32

 3) 24

Selection [16]: 2 (32)

Enable plaintext passthrough (y/n) [n]: n

Enable filename encryption (y/n) [n]: y

WARNING: Based on the contents of [/root/.ecryptfs/sig-cache.txt],

it looks like you have never mounted with this key 

before. This could mean that you have typed your 

passphrase wrong.

Would you like to proceed with the mount (yes/no)? : yes

Would you like to append sig [] to

[/root/.ecryptfs/sig-cache.txt] 

in order to avoid this warning in the future (yes/no)? : yes

Successfully appended new sig to user sig cache file

Mounted eCryptfs

run command, mount and check

/volume1/@encrypt@ on /volume1/encrypt type ecryptfs (rw,relatime,ecryptfs_fnek_sig=<>,ecryptfs_sig=<>,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_unlink_sigs)

cd  /volume1/encrypt

ls -al to check your data

you could use scp to copy your data to another device

To see the data in DSM using File Station or Windows File Service (SMB)

synospace --map-file -d

synocheckshare

 

 

1 2 3 4