QNAP TS-212 – How to save RAID settings from telnet

Scenario = you have wrongly initialize a new HDD a single disk but you would like to be added as RAID1 disk.

QNap support team suggested to remove all partition and reboot NAS

This should be done connecting the second disk to a computer, delete volume and partition, and connect disk back into the NAS, which is quite boring.

Here is how to delete partition table from telnet:

  1. Open telnet
  2. Login as admin
  3. Check which disk is used as RAID to avoid a “wrong” delete
    mdadm –detail /dev/md0

    Number   Major   Minor   RaidDevice State
       0       0        0        0      removed
       1       8        3        1      active sync  /dev/sda3

  4. So we need to clean the /dev/sdb partitions
    fdisk -l /dev/sdb

    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1          66      530125   83  Linux
    /dev/sdb2              67         132      530142   83  Linux
    /dev/sdb3             133      121538   975193693   83  Linux
    /dev/sdb4          121539      121600      498012   83  Linux

     

  5. Dismount the volume before starting the work
    umount /dev/sdb3
  6. So we have 4 partition, type the follow to enter in fdisk mode
    fdisk /dev/sdb
  7. If you need help type “m”
  8. List all partition as above, type “p
    Command (m for help): p

    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1          66      530125   83  Linux
    /dev/sdb2              67         132      530142   83  Linux
    /dev/sdb3             133      121538   975193693   83  Linux
    /dev/sdb4          121539      121600      498012   83  Linux

  9. Press “p” to delete partitions and the number of partition to delete

    Command (m for help): d
    Partition number (1-4): 1

    Command (m for help): d
    Partition number (1-4): 2

    Command (m for help): d
    Partition number (1-4): 3

    Command (m for help): d
    Partition number (1-4): 4

  10. Print all partitions of the disk with “p"
    Command (m for help): p

    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System

  11. Save the changes with “w
  12. You need to save RAID settings information in the /etc/config/raidtab file
  13. The easy way to save RAID configuration is this:
    more /etc/config/raidtab
    cp /etc/config/raidtab /share/Public 
  14. Change raidtab file like this one

    raiddev /dev/md0
            raid-level      1
            nr-raid-disks   2
            nr-spare-disks  0
            chunk-size      4
            persistent-superblock   1
            device  /dev/sda3
            raid-disk       0
            device  /dev/sdb3
            raid-disk       1

  15. save and copy back to original location
    cp raidtab /etc/config
    more /etc/config/raidtab
  16. Change also /etc/storage.conf file
    Set it only for RAID volume and clear all reference for single volume

    [VOLUME 1]
    device name = /dev/md0
    raid level = 1
    raid disks = 1,0
    spare raid disks =
    status = 0
    record_time = Thu Jul 19 22:53:14 2012

    filesystem = 104
    [Global]
    Available Disk = 2

  17. Reboot the NAS & Check if RAID was rebuilt correctly

QNAP TS-212 How to rebuild RAID manually from telnet

Scenario = replace a disk in QNAP TS-212 with RAID 1 configuration active

RAID rebuild should start automatically, but some times it could happen you got stuck with 1 Single Disk + 1 Mirroring Disk Volume:

SingleDisk

According to the QNAP Support – How can I migrate from Single Disk to RAID 0/1 in TS-210/TS-212? , TS-210/TS-212 does not support Online RAID Level Migration. Therefore, please backup the data on the single disk to another location, install the second hard drive, and then recreate the new RAID 0/1 array (hard drive must be formatted).

The workaround is this:

  1. Telnet to NAS as Admin
  2. Check your current disk configuration for Disk #1 and Disk #2 =
    fdisk -l /dev/sda

    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1          66      530125   83  Linux
    /dev/sdb2              67         132      530142   83  Linux
    /dev/sdb3             133      121538   975193693   83  Linux
    /dev/sdb4          121539      121600      498012   83  Linux

    fdisk -l /dev/sdb

    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1          66      530125   83  Linux
    /dev/sda2              67         132      530142   83  Linux
    /dev/sda3             133      121538   975193693   83  Linux
    /dev/sda4          121539      121600      498012   83  Linux

  3. SDA is the first disk, SDB is the second disk
  4. Verify the current status of RAID with this command =
    mdadm –detail /dev/md0

    /dev/md0:
            Version : 00.90.03
      Creation Time : Thu Sep 22 21:50:34 2011
         Raid Level : raid1
         Array Size : 486817600 (464.27 GiB 498.50 GB)
      Used Dev Size : 486817600 (464.27 GiB 498.50 GB)
       Raid Devices : 2
      Total Devices : 1
    Preferred Minor : 0
        Persistence : Superblock is persistent

      Intent Bitmap : Internal

        Update Time : Thu Jul 19 01:13:58 2012
              State : active, degraded
    Active Devices : 1
    Working Devices : 1
    Failed Devices : 0
      Spare Devices : 0

               UUID : 72cc06ac:570e3bf8:427adef1:e13f1b03
             Events : 0.1879365

        Number   Major   Minor   RaidDevice State
           0       0        0        0      removed
           1       8        3        1      active sync  /dev/sda3

  5. As you can see the /dev/sda3 is working, so disk #1 is OK, but disk #2 is missing from RAID
  6. Check if Disk #2 /dev/sdb is mounted (it should be) =
    mount

    /proc on /proc type proc (rw)
    none on /dev/pts type devpts (rw,gid=5,mode=620)
    sysfs on /sys type sysfs (rw)
    tmpfs on /tmp type tmpfs (rw,size=32M)
    none on /proc/bus/usb type usbfs (rw)
    /dev/sda4 on /mnt/ext type ext3 (rw)
    /dev/md9 on /mnt/HDA_ROOT type ext3 (rw)
    /dev/md0 on /share/MD0_DATA type ext4 (rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,delalloc,noacl)
    tmpfs on /var/syslog_maildir type tmpfs (rw,size=8M)
    /dev/sdt1 on /share/external/sdt1 type ufsd (rw,iocharset=utf8,dmask=0000,fmask=0111,force)
    tmpfs on /.eaccelerator.tmp type tmpfs (rw,size=32M)
    /dev/sdb3 on /share/HDB_DATA type ext3 (rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,noacl)

  7. Dismount the /dev/sdb3 Disk #2 with this command =
    umount /dev/sdb3
  8. Add Disk #2 into the RAID /dev/md0 =
    mdadm /dev/md0 –add /dev/sdb3

    mdadm: added /dev/sdb3

  9. Check the RAID status and the rebuild should be started automatically =
    mdadm –detail /dev/md0

    /dev/md0:
            Version : 00.90.03
      Creation Time : Thu Sep 22 21:50:34 2011
         Raid Level : raid1
         Array Size : 486817600 (464.27 GiB 498.50 GB)
      Used Dev Size : 486817600 (464.27 GiB 498.50 GB)
       Raid Devices : 2
      Total Devices : 2
    Preferred Minor : 0
        Persistence : Superblock is persistent

      Intent Bitmap : Internal

        Update Time : Thu Jul 19 01:30:27 2012
              State : active, degraded, recovering
    Active Devices : 1
    Working Devices : 2
    Failed Devices : 0
      Spare Devices : 1

    Rebuild Status : 0% complete

               UUID : 72cc06ac:570e3bf8:427adef1:e13f1b03
             Events : 0.1879848

        Number   Major   Minor   RaidDevice State
           2       8       19        0      spare rebuilding   /dev/sdb3
           1       8        3        1      active sync   /dev/sda3

  10. Check the NAS site for the rebuild % progress

    image

  11. After the RAID rebuild complete, restart NAS to clean all previous mount point folder for sdb3

Transmission on GigaNAS – Best configuration

You could download the Transmission application from Embedded System website

If you got the following error connecting to the website:

403: Forbidden
Unauthorized IP Address.
Either disable the IP address whitelist or add your address to it.
If you’re editing settings.json, see the ‘rpc-whitelist’ and ‘rpc-whitelist-enabled’ entries.
If you’re still using ACLs, use a whitelist instead. See the transmission-daemon manpage for details.

You need to edit the configuration file.

There are 2 files that you could change.
The first one is the conf file which is located in “/usr/local/transmission/etc” folder

GigaNAS> cd /usr/local/transmission/etc

GigaNAS> ll
-rw-r–r–    1 root     root          323 Jun 19  2009 conf
drwxr-xr-x    6 root     root         4096 Feb  2 23:43 ..
drwxr-xr-x    2 root     root         4096 Feb  2 23:43 .

GigaNAS> cat conf
TRANSMISSION_WEB_DIR=”/usr/local/transmission/web/”
TRANSMISSION_CONFIGS=”/public/.transmission”
TRANSMISSION_DOWNDIR=”/public/Downloads”
TRANSMISSION_ALLOWED=”192.168.*.*,127.0.0.*”
TRANSMISSION_DOWN_SPEED=”100″
TRANSMISSION_UP_SPEED=”50″
TRANSMISSION_MAX_PEERS=”120″
TRANSMISSION_MAX_TORRENT=”60″
TRANSMISSION_PORT=”5000″

This file contains default path and settings loaded automatically at every reboot.

During the installation of the package, another configuration file settings.json should be created in “/mnt/md1/public/.transmission” (replace “md1” if you aren’t using RAID).
If the configuration file is not there, create a new Text file from Notepad and add the content manually as reported below, then restart the NAS.

GigaNAS> cd /mnt/md1/public/.transmission

GigaNAS> ll
-rwxrw-r–    1 admin    users        1566 Feb  5 01:56 settings.json
-rw-r–r–    1 admin    users         133 Feb  5 01:51 stats.json
drwxr-xr-x    2 admin    users        4096 Feb  2 23:50 blocklists
drwxr-xr-x    2 admin    users        4096 Feb  7 09:12 torrents
drwxr-xr-x    2 admin    users        4096 Feb  7 09:12 resume
-rw-r–r–    1 admin    users           5 Feb  5 01:52 transmission.pid

GigaNAS> cat settings.json
{
    “alt-speed-down”: 50,
    “alt-speed-enabled”: false,
    “alt-speed-time-begin”: 540,
    “alt-speed-time-day”: 127,
    “alt-speed-time-enabled”: false,
    “alt-speed-time-end”: 1020,
    “alt-speed-up”: 50,
    “bind-address-ipv4”: “0.0.0.0”,
    “bind-address-ipv6”: “::”,
    “blocklist-enabled”: false,
    “dht-enabled”: true,
    “download-dir”: “\/mnt\/md1\/public\/Downloads”,  <<<=== Change according to download folder
    “encryption”: 0,
    “lazy-bitfield-enabled”: true,
    “message-level”: 2,
    “open-file-limit”: 32,
    “peer-limit-global”: 240,
    “peer-limit-per-torrent”: 60,
    “peer-port”: 11282,  <<<=== Change to avoid default port
    “peer-port-random-high”: 65535,
    “peer-port-random-low”: 49152,
    “peer-port-random-on-start”: false,
    “peer-socket-tos”: 0,
    “pex-enabled”: true,
    “port-forwarding-enabled”: true,
    “preallocation”: 2,
    “proxy”: “”,
    “proxy-auth-enabled”: false,
    “proxy-auth-password”: “”,
    “proxy-auth-username”: “”,
    “proxy-enabled”: false,
    “proxy-port”: 80,
    “proxy-type”: 0,
    “ratio-limit”: 0,
    “ratio-limit-enabled”: false,
    “rpc-authentication-required”: true,  <<<=== Enable username / password access in the webpage
    “rpc-bind-address”: “0.0.0.0”,
    “rpc-enabled”: true,
    “rpc-password”: “xxxxx“,  <<<=== Set a password to logon in the webpage
    “rpc-port”: 9091,
    “rpc-username”: admin“,  <<<=== Set a username to logon in the webpage
    “rpc-whitelist”: “*.*.*.*,127.0.0.*”,   <<<=== Allow all IP address to access webpage
    “rpc-whitelist-enabled”: true,
    “speed-limit-down”: 500,
    “speed-limit-down-enabled”: false,
    “speed-limit-up”: 25,   <<<=== Set the value for the global max upload speed
    “speed-limit-up-enabled”: true,   <<<=== Enable the global max upload speed
    “upload-slots-per-torrent”: 14
}

To access Transmission Web Interface from the web, you need also to open port 9091 in your internet router.

Syabas on GigaNAS – Best configuration and Logging

Download Syabas package from Embeded System to enable Video / Audio / Photo streaming on the GigaNAS with latest firmware installed.

A brochure with a features list of the Syabas NAS Media Server is also available on the Syabas website with sample of the configuration and folders structure.

DLNA protocol and NMPR v2.1 (Networked Media Product Requirements) is used to share data for gaming consoles, PCs and mobile devices that support Universal Plug and Play.

The public sharing folders are stored in \mnt\ide4\public\media\ and divided as follow:

  • Audio
  • Photo
  • Photo_Thumbnails
  • Video

The configuration, application and web server are located in \mnt\ide4\local\syabas\

To edit the configuration via web interface access http://nas:8088/ or edit the configuration file “ms.conf” stored in \mnt\ide4\local\syabas\server:

# version p3.3 [Ref.No : 1.3.2]
# shared media path
media_path=/mnt/ide4/public/media
# media server friendly name
friendly_name=Gemini NAS Media Server
# canche-control value in second
cache_control=1800
# max return
max_return=0
# Optional USB share folder support(refer to README)
# usb_path = /YOUR/USB/PATH

For more information check the official website

Backup with GigaNAS

GigaNAS has an inbox backup functionality from NAS to an external IP address.

It’s a 4 steps wizard with the following settings:
  • IP Address of the remote NAS = location of the network share
  • Full Backup / Incremental Backup = schedule a weekly incremental backup or create a new full standalone backup of the files.
  • Select source folders = select which share to backup
  • Backup scheduling = select a specific date for standalone backup or monthly day and time for incremental backup
  • Email Setting = set Mail Server and EMail Account if you want to receive an email with the backup log
If you need to backup data from PC to NAS, simply use the inbox “NT Backup” on your Operating System or another free solution is Microsoft SyncToy v2.0

MLDonkey on GigaNAS – Best configuration and Logging

Download MLDonkey package available on Embeded System: be sure to have latest firmware installed on the GigaNAS.
Logon to the NAS via your browser with username = admin & password = admin (default).
Navigate to System –> Install Software

After you have installed the package on the NAS, a new folder will be create on this folder: /mnt/ide4/local/mldonkey/
If Ide4 is the Hard Disk with the OS installed and the user shares.

The main configuration file is download.ini in text format: edit it with MLDonkey Core (read Service) disable or do it via WEB GUI.

You could interact with MLDonket core with the following interfaces:

  • GUI Port = 4001 –> Used by Sancho
  • WEB HTTP Port = 4080 –> Used to access via browser http://nas:4080/
  • Telnet Port = 4000 –> Used by CMD access

If you have some problems, enable the full logging (Option –> Files) and check MLNET.log in /mnt/ide4/local/mldonkey/

Downloaded files are saved during in the temp folder (/mnt/ide4/local/mldonkey/temp/GUID) until completition, then they are moved to incoming folder.

More information on the official MLDonkey website