Montag, 3. Februar 2014

Synology - change "RAID1 degraded" to "Basic"

On my DS211j I experimented with the disks (added a second disk, created RAID1 and removed second disk again) and at the end I had a degraded RAID1. I wanted to convert this degraded RAID1 back to Basic but it seems that the DSM web page doesn't allow you to do so. I have looked at the disk config before my experiments started and found that a Basic volume on DSM is already a RAID1, but with only one disk. The only difference to the old situation seems to be that now the RAID1 is registered with two disks instead of one.

So all you have to do is to tell mdadm that the RAID device of interest (/dev/md2 in my case = /volume1) is using only one disk instead of two:

mdadm --grow --raid-devices=1 --force /dev/md2
(Yes, it uses a "grow" command even it "shrinks" the number of disks!!)

Immediately after issuing this command the BEEP of the DS211j stopped and in the Storage Manager the volume was displayed as "Basic". Bingo!

Synology - Move packets from volume2 to volume1


I have a DS211j and currently two HDDs, both set to basic. Now I wanted to use two larger disks and use RAID1 for them. So from having two volumes (volume1 and volume2) I would only have one volume (volume1). One problem is that there are some packets and system services installed on volume2 (e.g. PostgreSQL, Mail Server etc.). These need to be moved to volume1 before I do the disk change. Unfortunately the DSM web page doesn't offer you any settings to move packets and system services from one volume to another. So I had to do it manually.

For PostgreSQL (which is used internally by the DSM for e.g. media indexing) the following was successful:


The information on which volume PostgreSQL resides seems to be in the symbolic link /var/services/pgsql. On my system it points to /volume2 ( /var/services/pgsql -> /volume2/@database/pgsql ). So all I had to do is to change that link.

Stop PostgreSQL:
/usr/syno/etc/rc.d/S20pgsql.sh stop

Copy all data from volume2 to volume1:
rsync -av /volume2/@database/pgsql /volume1/@database/

Disable the original link:
mv /var/services/pgsql /var/services/pgsql-vol2

Create the new link pointing to volume1:
ln -s /volume1/@database/pgsql /var/services/pgsql

Be sure that no one is using the data on volume2 any more (I had only pgsql inside /volume2/@database):
mv /volume2/@database /volume2/@database-deleteme

Restart PostgreSQL:
/usr/syno/etc/rc.d/S20pgsql.sh start


Still have some packets and system services on volume2. Need to look into each and find a way to move it to volume1.

For "printer/spool" (startup script: /usr/syno/etc/rc.d/S55cupsd.sh) the information which volume is used is retrieved as follows:
ds211j> /usr/syno/bin/servicetool --get-service-path printer
/volume2
ds211j>

But how gets the "servicetool" this information ??