Synology - midenok/hardware GitHub Wiki
Paths and binaries info
/volumeX/@appstore/*
: package homes/volumeX/@appstore/DownloadStation/bin/synobttool
: this one starts transmission
/.noroot
When exists boot into network install mode (firmware reinstall web interface).
touch /.noroot
reboot
/etc
System-wide Unix configuration. Originally copy of /etc.defaults
, meant to override /etc.defaults
.
/etc.defaults
Meant to be template for /etc
but in practice sometimes is used instead of /etc
. F.ex. rc.subr
is loaded from /etc
in one script and from /etc.defaults
in other scripts.
/etc.defaults/rc.subr
Subroutines library like MkSwapRaid()
, etc. These can be tweaked f.ex. to change how swap is mounted.
Swap setup and system auto-resync between drives
By default swap is built as Raid-1 from partition 2 of each harddrive (see SYNOTurnOnSwap()
, MkSwapRaid()
).
Apply patched rc.subr to enable Raid-0 for swap. If any of the drive was pulled out the bootup falls back to Raid-1 instead. Note that in Raid-0 mode swap size is 2 times bigger (4 Gb) than in Raid-1 (2 Gb).
The patch also re-adds pulled out drives to system volume (/dev/md0). The drives are resynced quickly enough. When resync is in progress it is not good to pull out active drive (the one with the source of the synced data).
Superblock endianness problem
System volume (Raid-1 /dev/md0 -> /dev/sda[12]) has superblock version 0.9. This old superblock version has machine-dependent endianness. When you try to mount DSM on little-endian you get:
mdadm -E -e0 /dev/sde1
mdadm: No super block found on /dev/sde1 (Expected magic a92b4efc, got fc4e2ba9)
Synology bootup process depends on 0.9 superblock. If you convert it to 1.2 it just won't boot (maybe because Synology depends on initrd location address).
You can convert endianness with:
mdadm --assemble -Ubyteorder /dev/md0 /dev/sdd1 /dev/sde1
but make sure preferred minor stays the same! In my case on Synology it was 0, so after -U it must be 0, otherwise DSM won't boot!
To fix preferred minor:
mdadm -AUsuper-minor /dev/md0 /dev/sdd1 /dev/sde1
PostgreSQL databases
$ /usr/bin/psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+----------+-----------+---------+-------+-----------------------
download | postgres | SQL_ASCII | C | C |
mediaserver | postgres | SQL_ASCII | C | C |
photo | postgres | SQL_ASCII | C | C |
postgres | postgres | SQL_ASCII | C | C |
synolog | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | postgres=CTc/postgres+
| | | | | =c/postgres
video_metadata | postgres | SQL_ASCII | C | C |
(8 rows)
Download station location of default save folder
$ /usr/bin/psql download
psql (9.3.3)
Type "help" for help.
download=# \d
List of relations
Schema | Name | Type | Owner
--------+----------------------------+----------+----------
public | download_queue | table | postgres
public | download_queue_task_id_seq | sequence | postgres
public | rss_feed | table | postgres
public | rss_feed_id_seq | sequence | postgres
public | rss_filter | table | postgres
public | rss_filter_id_seq | sequence | postgres
public | rss_item | table | postgres
public | rss_item_id_seq | sequence | postgres
public | sysconf | table | postgres
public | user_setting | table | postgres
(10 rows)
download=# select * from user_setting;
username | uid | share_folder | user_disabled | delete_watchtorrent | watchfolder | enable_watchffolder
----------+------+--------------------+---------------+---------------------+-------------+---------------------
admin | 1024 | share2/learn/music | f | f | | f
(1 row)
download=#
Leds off at night (works on DS211j)
How to install optware-devel
How to install IPKG or Install Entware
Since this bug, you need to replace wget
with wget-ssl
by hand:
ipkg install libidn
ipkg download wget-ssl
ipkg remove wget
ipkg install wget-ssl_*.ipk
ipkg install optware-devel
Reindexing dir
Usually indexing is done automatically when you work in Web interface or via windows share. But it won't work if you do changes from shell. In nutshell, what you have to do is just run the command:
synoindex -A "`pwd`"
from the dir you made changes. If dir was already indexed, it is enough to run:
synoindex -R "`pwd`"
Check file /var/spool/syno_indexing_queue
for mistakes. You can
killall synoindexd
killall synoindexscand
to forcefully stop current indexing (they will be restarted and start reading syno_indexing_queue
again).
How to use XFS on a Synology NAS device
After returning from a trip to Israel and Jordan last month, I have discovered that my home server's motherboard is dead. After considering different options, I have realized that I really only need the server to host my RAID1 hard disks, where I store all my photos and other content.
So that's how I got my Synology DS212J NAS , which is an Linux-powered device with low level access in case it is needed. Now the problem was, how to get my 2 HDDs running in that box with preserving all the data.
Unfortunately, the first install of the box requires wiping of the data on the HDD. Fortunately, I have RAID1 setup with two exact copies of all the data, so I decided to sacrifice one of the disks to install the firmware and later insert the second one and copy the data over.
Now, the problem was that my data was on a XFS partition, which DS212J doesn't support by default - it uses EXT4 for its partitions.
Fortunately, Synology is kind enough to provide an SDK which makes it possible to build missing kernel modules and enable more features on the device.
Here is how to do it:
- Enable terminal access in the web interface of the device - then you can login to the box using **ssh [email protected] ** r whatever name/IP you have given it
- Go to http://sourceforge.net/projects/dsgpl/ - click Files
- Download the DSM tool chains (gcc ARM cross compiler) for your firmware (currently 3.2 ) - for DS212 it is in the Marvell 88F628x , if you have another model use either /proc/cpuinfo or dmesg to find out your CPU type
- Download the **Synology NAS GPL Source ** also from sourceforge - this is a huge archive that includes source code of all the kernels that Synology uses (check your kernel version with uname -a , mine uses 2.6.32)
- Extract both archives to **/usr/local ** (or at least link there) ** ** - this is important, because kernel Makefile already points to a cross compiler from the tool chain that should be located there
- **cd /usr/local/source/linux-2.6.32 ** (from the GPL source archive)
- Copy the correct kernel config for your device - Syology kernel configs are located in synoconfigs , so for DS212J do this: cp synoconfigs/88f6281 .config
- **make menuconfig ** to use kernel's menu-based configuration utility (ensure that you have libncurses installed for it to work)
- In the menu, locate the needed additional drivers (File Systems -> XFS in my case), and press M to enable module compilation
- Exit and make modules
- This will compile the required .ko files. XFS driver was in **fs/xfs/xfs.ko ** after compilation was completed, but **modinfo fs/xfs/xfs.ko ** also told me that xfs.ko depends on the exportfs.ko as well.
- I needed to copy both modules to the device, xfs.ko and fs/exportfs/exportfs.ko to make it work, otherwise kernel refused to load the xfs module. To copy the files, use either FTP (enable from the web interface) or the web interface itself. It doesn't matter where you put them.
- Login to the device with ssh [email protected] again (note, you need to be root, not admin)
- Go to the directory where you uploaded the .ko files ( cd /volume1/public in my case)
- Load the modules: insmod exportfs.ko , then **insmod xfs.ko ** - if it doesn't complain, then you have XFS support enabled (or whatever other driver you needed to load)
- Then create a directory anywhere and mount your second HDD to it, then copy the files with cp r rsync. Example: **mount -t xfs /dev/hda storage ** - look which name did you HDD receive. Mine was hda, because I have installed the firmare to hdb before. Check mount without the arguments on where you firmware is located. Also, my disk didn't have a partition table, only a single partition starting in MBR, that's why I used /dev/hda there and not /dev/hda1 or something. Use parted /dev/hda for more info which partitions you have.
- Rsync is a great way to copy the files then, eg rsync -arv storage/ /volume1/ - this will preserve all file attributes
- When copying is complete, add the second HDD to the Synology RAID using the web interface
Note: fortunately I didn't have to replace the stock kernel fully on the device. It was enough to load these two new modules. However at first, when loading of only **xfs.ko ** failed due to missing symbols, I already thought that I need to do that, and I have even tried with no help (before discovering that I actually need to load exportfs.ko).
FYI: Synology's kernel is located in the flash memory, not on the HDD as the rest of the system. The devices with flash partitions are /dev/mtd* , with /dev/mtd0 being the boot loader (don't touch this one - it provides the ability to install the rest of the firmare with Synology Assistant over the network) and /dev/mtd1 being the uImage of the kernel.
If you still need to replace the kernel, you may try to **make uImage ** of the kernel (make sure you have **uboot ** installed for this to work - this is what Synology uses), copy tyhe **uImage ** file to the device and then **cat uImage > /dev/mtd1 ** - but do it at your own risk, I am not sure whether will Synology Assistant work if you flash the wrong kernel and reboot. I guess it should, but I haven't tested it :-)
Hopefully it will be useful for someone - the same way you can add support for Apple/Mac HFS filesystem, ReiserFS or others.