Gerrards Cross Computer Club

ICY NAS-Box 4220 - Install Spindown Fix

Return to support page home

Page updated 15 August 2009

Page Contents

  1. ICY NAS-Box 4220 - Install Spindown Fix
    1. Page Contents
    2. Background
    3. Why This Page Has Been Created
    4. Important Warning About Power Failure
    5. My Configuration
      1. My Network
      2. My NAS-4220
    6. Installation Steps
      1. Pre-requisites
      2. Enable Telnet Access to NAS-4220
    7. Now we are Ready to Configure the NAS
      1. Login to the NAS
      2. Prepare the USB Stick
    8. Install Spindown Fix
      1. Now Prepare the Script Files we Need
    9. hdparm -What on Earth is THAT for?
    10. Choice of hdparm Values
    11. Acknowledgments


The ICY Box NAS 4220 is an excellent Network Attached Storage devicethe device will be referred to as NAS in the rest of this page. Replace <nas> by your NAS box name or IP address.

The NAS suffers however from one irritating problem - the disks do not spin down when the device is idle. The reason appears to be caused by tasks within the Operating system running under control of the scheduler and kick in a regular intervals to perform routine tasks. Many of these access files within the filing system which resets the spin down timer. The net result is that the disks never stop.

The NAS web page shows a function intended to control spindown of the RAID drives but it does not work. Raidsonic are "working on it" but meanwhile some clever people have devised a workaround. This moves the accessed files onto a USB stick thus permitting the rotating drives to shut thmselves down.

Why This Page Has Been Created

I am experienced with computers but this has been mainly using Windows. I am however relatively inexperienced with using either UNIX or LINUX.  This, together with the issues associated with translation from the German (see below), led me to create this page so that if I ever had to do it again I would have the instructions and not have to work it out again. I am also planning a talk at my local computer club on the subject of Backup and NAS. This page and other associated pages will be referred to so that out (Windows using) members will have a simple guide to using this device.

Important Warning About Power Failure

I discovered that when there is a power failure the USB stick will not remount when the NAS 4220 is restarted and the NAS 4220 will not boot. Panic not! I have discovered a workaround.

Power down the NAS 4220 again and remove the USB stick. Power up the NAS 4220 again without the stick and it will revert to the original configuration i.e. the one before you formatted the stick. Any user accounts etc that have been created will not be available. Again don't panic!

Now plug in the USB stick and it will mount correctly. Now you can shut down the NAS 4220 properly and restart it. Now the USB stick will be seen correctly and everything should be back as it was.

I found this our the hard way and assumed the USB stick had become faulty. I recreated all the accounts again on a new stick. It was when it happened a second time that I discovered the workaround.

Why does this happen? well i am not a UNIX expert but (having taken advice from a clleague who is) I beleive tha the USB file format is marked as dirty while it is being used (files are open). if it is shut down properly then the file system is unmounted cleanly. When a USB device is mounted properly UNIX will verify and fix the file format before mounting the USB stick and it works correctly.During boot up however it appears that the sequence attempts to access the USB device before it has been repaired and the boot sequence fails when it attempts to access the USB stick. Plugging it in AFTER the NAS 4220 has booted allows it the be repaired so on the next boot it is fine.

I have no doubt that a UNIX guru could modify the script to allow for this evenuality. i can however live with it

My Configuration

My Network

I have a network of three Windows XP computers.

My NAS-4220

I have a ICY Box NAS-4220 with version 1.2 board.

The firmware has been upgraded to 2.6.0.IB.1.RS.1

Following advice in the user guide (use drives from two different manufacturers) I have fitted the following disk drives:

I have fitted a 1Gb USB stick in the rear USB socket to be used by the spindown fix.

I have changed my NAS name. In the description  replace <nas> by your NAS box name or IP address

Installation Steps


Enable Telnet Access to NAS-4220

To prepare the USB stick, or to verify that the sfile:///Z:/Soroban%20Installation/PC%20Files/Kompozer/kompozer-0.7.10-win32/teps described are installed correctly, or to fault find if something does go wrong, it will be necessary to connect to the command line interface uses a feature called telnet. the NAS via what is called a Command Line interface. The command line interface uses a feature called telnet

As initially installed "out of the box" the NAS-4220 does not support telnet however so first we need to enable it. This is quite simple.

Step Action Screenshot
1 Connect to your NAS 4220 box using your favourite browser. Enter the URL http://<nas> – replace <nas> by your NAS box name or IP address. The screen shown should appear.

Enter your standard administrator <user name> and <password> (default is admin/admin).

Click Login Button.
Login screen
2 Enter the following URL in your web browser – replace <nas> by your NAS box name or IP address. Note that the part following <nas>/ can be copied [CTRL+C] from the text below and pasted into the URL [CTRL-V] in your browser to overwrite the final part of the URL displayed http://<nas>/home.cgi

http://< nas>/cgi/telnet/telnet.cgi followed by [Enter]

The telnet enable screen will now appear.
Standard NAS screen
3 You now need to click the Enabled Checkbox (this has already been done on the screenshot).

Click Save button

Close down your browser. The NAS now supports telnet connections.
Telnet enable page

Now we are Ready to Configure the NAS

Login to the NAS

We use PuTTY to configure the NAS. Assuming it has been insatlled - Run PuTTY.

Connect to the NAS with PuTTY and login as root. The password is the same as that configured for admin (default admin). The prompt will be your NAS name and is shown here as <NAS>

<NAS> login: root


BusyBox v1.00-rc3 (2007.08.08-11:22+0000) Built-in shell (ash)

Enter 'help' for a list of built-in commands.


Prepare the USB Stick

Plug in a USB stick (1 Gigabyte) if you have not already done so. It can go in either the front or rear port but the rear port seems more appropriate as this will be a permanent installation.

Enter the following commands into the PuTTY window. 

The second line will permanently destroy all data on the USB stick as it reformats the stick into UNIX ext2 format.

The fourth line copies the existing /system folder to the USB stick

umount /dev/sda1

mke2fs /dev/sda1

mount /dev/sda1 /mnt/usb1

(cd /system; tar cf - .) | (cd /mnt/usb1; tar xf -)

You should be able to copy the commands from above (select and use CTRL+V) and paste into PuTTY (Right Click).

Install Spindown Fix

Now Prepare the Script Files we Need

For this you need notepad++ and PuTTY.

Step Action Screenshot
1 Run notepad++ from Start/Programs. Notepad++ uses a tabbed display with one tab corresponding to each open file. The initial screen will have an empty page already shown on the first tab.

Note that this is not a complete tutorial on notepad++ but step by step descriptions are given.
2 We now need to name this file.

Select Menu File -> Save As to open the familiar Windows File Save dialog box

Navigate to //<nas>/public/applications on the NAS and use the Create New Folder button to create a new folder. Rename it to usb-system. See the screenshot.

Click on folder you have just created to open it. Change the file name from new 1 to init and click Save
Save as

Copy and paste the following text between the horizontal lines into the notepad++ Window

HD_MNT_POINT=$(cat /usr/sausalito/codb/objects/1/Disk.rootdir 2> /dev/null)
exec $CWD/do-init >> $CWD/init.log 2>&1

You may find that additional blank lines are inserted. These do not actually matter but they may be deleted for tidiness.

Note that the init tab now has a red symbol indicating that the content has changed and needs to be saved. 

Important Click on the Format Menu and select Convert to UNIX format. The script will not work unless you do this

Jane's Documents 2008-07-05 20;04;55

Right Click on the tab. This opens a menu which contains a Save me item. Click it. The file will be saved and the red symbol disappears.

init file complete
4 Repeat steps 2 using the filename do-init instead of init and copy paste the following text

 "------ START $(date) -----"
echo "checking $USB_MNT_POINT ..."
if [ -e $USB_MNT_POINT/ImageInfo ]; then
  echo "remounting /system ..."
  cd /
  umount /system
  if [ $? != 0 ]; then
     echo "ABORTED: Failed to unmount old /system."
  mount $USB_DEV /system
  echo "DONE: Your NAS system is now running from USB stick:"
  echo "set spindown of /dev/hda and /dev/hdb to 10 minutes ..."
  hdparm -S120 /dev/hda /dev/hdb
  echo "ABORT: Found no USB device with valid system."

As before the tab will have a write symbol so save the file (right click and use the Save me as before). Remember the warning to Convert to UNIX format. This may now already be selected.


hdparm -What on Earth is THAT for?

The hdparm command controls the spin down time for both disk drives. By having two hparm commands the two drives can be programmed separately. UNIX refers to the drives as /dev/hda and /dev/hdb. The -s120 parameter controls the delay before the drives spin down. The number can take a value between 0 and 255 but the interpretation of the parameter is rather strange. To quote the UNIX documentation (man page)

Set the standby (spindown) timeout for the drive. This value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means "off". Values from 1 to 240 specify multiples of 5 seconds, for timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, for ti Standby timer values: spec'd by Standard, with device specific minimum
meouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes, 253 sets a vendor-defined timeout, and 255 is interpreted as 21 minutes plus 15 seconds.

In the script shown the spindown time is set to 120 giving a time of 10 minutes. If you want to change it (see below for some guidance to value) then use Notepad++ to change the value.

Reboot the NAS to apply the script using the front panel button.

Choice of hdparm Values

The choice of value to use turns out to be quite complex. Some drives, including the WD7500AACS I used have a minimum time. The drive parameters can be read using hdparm -I /dev/hda or -I /de/hdb. For the WD drive the report includes: 

 Standby timer values: spec'd by Standard, with device specific minimum

Unfortunately WD do not specify what this minimum value is! I have monitored the drive with the time set to 1 hour (parameter set to 252) and it took 4 hours 15 minutes to stop. The Seagate drive stopped after 1 hour.

It is currently speculation but WD appear to be deliberately choosing to keep the drive spinning for this extended time to reduce the possibility of the drive starting and stopping frequently. Starting and stopping puts mechanical strains on the drive. Leaving it spinning however can wear out he bearings and takes significantly more power. When drives are spinning they are also noisier (the Seagate dignificantly noisier than the Western Digital drive). There are therefore many factors to take into account.

The optimum time, assuming would depend on the expected usage. If being used for backup against a schedule then the time when it is required, and the length of time is fairly predicatable and so a short time would be a good choice. If the usage is more random then a longer time might be appropriate.

I am sticking to 1 hour for the time being.


The fix is described here in the NAS-4220 Wiki. The description above gives step by step instructions but I have done nothing more than document the process. I understand that this method was devised by a forum member gmeyer. Note that a large part of this forum is written in German. Neither Google or Babel fish make translations that are easy to read.

The workaround depends on the concepts described in the userscripts package created by Skara. The link to the forum entry in English is here It is not necessary however essential to install Usercripta in order to use this workaround. In principle it should be feasible to integrate the userscript with usb-system fix.