Synology SMB connection with shared folder

Synology SMB Connections

Synology NAS DSM 6.1 with Active Directory (AD) installed on the NAS. Users in AD and Synology NAS users. On the NAS is SMB v1 disabled 

Connect from Ubuntu 16.04 LTS (Latest Stable Version) Gnome desktop 

from the terminal: 

as root:

sudo su -

mount -t cifs //<ip address or DNS name Synology NAS>/<Share> /mnt (or other mount point) -o username=<AD user or NAS user>,vers=<2.1 or 3.0> 

To start within Gnome GUI from terminal:

as root:

nautilus 

or as user: 

sudo mount -t cifs //<ip address or DNS name Synology NAS>/<Share> /mnt (or other mount point) -o username=<AD user or NAS user>,vers=<2.1 or 3.0> 

To start within Gnome GUI from terminal:

sudo nautilus

Connect from Centos 7

from the terminal: 

as root:

sudo su - or su - 

mount -t cifs //<ip address or DNS name Synology NAS>/share -o,user=<AD user or NAS user,domain=<AD netbios domain or other name for NAS users>,vers=<2.1 or 3.0> /mnt (or other mount point)

To start within Gnome GUI from terminal:

as root:

nautilus 

or as user: 

sudo mount -t cifs //<ip address or DNS name Synology NAS>/share -o,user=<AD user or NAS user,domain=<AD netbios domain or other name for NAS users>,vers=<2.1 or 3.0> /mnt (or other mount point)

To start within Gnome GUI from terminal:

sudo nautilus

OpenVPN configuration Synology VPN server

Client configuration settings: 

remote <dns or ip address>  1194

# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)

redirect-gateway def1

When the local network of the OpenVPN client is the same as the local network of the OpenVPN server than you can add the following line to the ovpn configuration file.

route <ip address> 

for example both networks have the same local network: 192.168.1.0/24 and traffic is not sent inside the VPN tunnel you can add to reach 192.168.1.10 on the local network of the VPN server 

route 192.168.1.10 

When you have problems with DNS for example with the DNS servers of Ziggo who only allow queries from their own network. You can change your DNS settings to the nameservers of Google. Name servers are 8.8.8.8 and 8.8.4.4 

Warning message in the log file: 

WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.

You see this message when you connect with a standard OpenVPN server from Synology and is showed because of the way Synology implemented their OpenVPN server. 

Synology DNS server and dnsmasq

When stopping the DNS server running on the Synology NAS  I notice that port 53 is still open. 

Running netstat -anp  on the Synology NAS reveals dnsmasq to have port 53 open. 

Stopping the DCHP server in control panel stops dnsmasq from running on port 53. 

 

Synology best settings for Quick Connect

Use a public DNS server (For example Google DNS servers):

Control Panel, Network, General, Select Manually configure DNS server, Preferred DNS server: 8.8.8.8, Alternative DNS server: 8.8.4.4

Turn off IPv6:

Control Panel, Network, Network Interface, Select connected LAN interface, edit, IPv6, IPv6 setup off

Manual IP Address:

Control Panel, Network, Network Interface, Select connected LAN interface, edit,IPv4, use manual configuration. Don't fill in a DNS server. Fill in IP address, Subnet Mask, Gateway. If configurable uncheck jumbo frame option. 

Time:

Control Panel, Regional Options, Synchronize with NTP server: 

For example  Server address: pool.ntp.org 

Check correct local time. 

Synology parity consistency check

start ssh session with Synology NAS.

as root:

cat /proc/mdstat 

Use at own risk:

Tips to speed up RAID rebuilding: 

To see current limits, enter:
# sysctl dev.raid.speed_limit_min
# sysctl dev.raid.speed_limit_max

Changing /proc/sys/dev/raid/speed_limit_min from the default value of 1000 to 50000 and 100000.

echo value > /proc/sys/dev/raid/speed_limit_min or 

sysctl -w dev.raid.speed_limit_min=value

Synology mount volume as read-only

Always contact Synology support first for help. If you like to try on your own risk: 

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 UPS NUT implementation

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

Synology DSM 6.1 

Synology has implemented NUT: http://networkupstools.org

The configuration files are found here 

/usr/syno/etc/ups:

upsd.conf 

upsd.users 

ups.conf

After changing the file you can reload the configuration:

upsd -c reload

Via the GUI, control panel, Hardware & Power, UPS and control panel, Hardware & Power, General you can configure also settings. 

control panel, Hardware & Power, General:

restart automatically after a power failure 

To get information from another source 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 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. 

fink install nut to install Nut client. 

Under /sw/etc/nut you can find the configuration files. 

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 

 

Synology check health info disks

Storage Manager, HDD/SDD

Select disk and expand information.

Check Status: Normal

Check S.M.A.R.T status: Normal 

Check Bad sector count: 0

Select disk and health info, overview

Disk Reconnection Count, Bad Sector Count and Disk Re-identification Count indicate the total quantity of events that have occurred on your disk or system.

Your data are still safely stored on the disk. Although these parameters provide early warning and information about disk health trends, they do not directly imply imminent disk failure.

Disk Reconnection Count display the sum of S.M.A.R.T. Attribute “UItraDMA CRC Error Count” and other interface issues detected by the system. If this parameter increases abruptly compared to general tendency, it may indicate that the disk or some hardware components are aging.

Select disk and health info, S.M.A.R.T test

Run Quick and Extended test. Check results. 

Select disk and health info, S.M.A.R.T info 

Use https://en.m.wikipedia.org/wiki/S.M.A.R.T. for reference 

check status: OK

Important attributes:

01 Read Error Rate:

(Vendor specific raw value.) Stores data related to the rate of hardware read errors that occurred when reading data from a disk surface. The raw value has different structure for different vendors and is often not meaningful as a decimal number.

If you see any non-zero raw values for ID 1 (for WD and Samsung disks) in the disk S.M.A.R.T. info, the disk is defective.

05 Reallocated Sectors Count : 0 

09 Power-on Hours:

Count of hours in power-on state. The raw value of this attribute shows total count of hours (or minutes, or seconds, depending on manufacturer) in power-on state.

By default, the total expected lifetime of a hard disk in perfect condition is defined as 5 years (running every day and night on all days). This is equal to 1825 days in 24/7 mode or 43800 hours.

10 Spin Retry Count: 0 

184 End-to-End error / IOEDC: 0

187 Reported Uncorrectable Errors: 0

188 Command Timeout: 0

196 Reallocation Event Count: 0

197 Current Pending Sector Count: 0

198 (Offline) Uncorrectable Sector Count: 0 

201 Soft Read Error Rate or TA Counter Detected: 

According to Synology Support:

If you see any non-zero raw values for ID 1 (for WD and Samsung disks) and ID 5/197/198 (for all disks) in the disk S.M.A.R.T. info, the disk is defective.

Synology terminal show S.M.A.R.T report

smartctl --scan

smartctl -a -d sat -T permissive /dev/sda

/dev/sda is the drive

-aPrints all SMART information about the disk.

-d satSpecifies device type. “Sat” is SCSI to ATA Translation (SAT) that is required with Synology.

 -T permissiveDefines tolerance type. “Permissive” tells to ignore failure(s) of mandatory SMART commands and is required with Synology.
 
The commando also shows Hardware disk information:
 
Model Family:     

Device Model:     

Serial Number:   

LU WWN Device Id:

Firmware Version: 80.00A80

User Capacity:    

Sector Sizes:     

Device is:       

ATA Version is:   

SATA Version is:  

Local Time is:    

SMART support is: 

SMART support is: 

 

To run a short S.M.A.R.T test: 

smartctl -d sat -t short /dev/sda

1 2 3