Hard drive spindown

843 views
Skip to first unread message

Stealth

unread,
Aug 28, 2012, 9:19:02 AM8/28/12
to al...@googlegroups.com

Hello,

I'm using Alt-f without problem but I saw a strange thing, when I access to my NAS (ssh, Alt-F interface, samba) my drive two spin up with no apparent reason (nothing with lsof)
After a short time sdb spindown without problem and spinup again when I try a new access

sdb is only a backup drive (rsync every night), and I like it never start except on backup process or manual access with ssh

sda is manually programmed to spindown after 20 minutes
sdb run with high saver mode

Thanks

Joao Cardoso

unread,
Aug 28, 2012, 11:25:56 AM8/28/12
to al...@googlegroups.com


On Tuesday, August 28, 2012 2:19:02 PM UTC+1, Stealth wrote:

Hello,

I'm using Alt-f without problem but I saw a strange thing, when I access to my NAS (ssh, Alt-F interface, samba) my drive two spin up with no apparent reason (nothing with lsof)

Do you have Alt-F packages installed? where? (try 'aufs.sh  -l' to see where, if you don't remember)

This was perhaps a bad design decision, but when Alt-F packages are installed, /var/lib, /var/spool, /var/db/... (do a 'ls -l /var' or 'ls -l /Alt-F/' to see which ones) are using the same filesystem as the Alt-F package; thus, some apps that store temporary values in those directories will spin-up the disk.

The reason why this was done is that some programs are designed to be able to resume operation after a crash/restart/reboot as if the crash/reboot had not happen. NFS is one such example:after a reboot, there is enough information stored on disk so that client operation continues without user intervention after a server restart.

I might change this, but some users, specially small-office ones, might complain...

Does the above explains your problem?


After a short time sdb spindown without problem and spinup again when I try a new access

sdb is only a backup drive (rsync every night), and I like it never start except on backup process or manual access with ssh

sda is manually programmed

Why manually? Disk->Utilities>Spindow does not fit your needs?

FredB

unread,
Aug 28, 2012, 11:52:29 AM8/28/12
to al...@googlegroups.com
>
> Do you have Alt-F packages installed? where? (try ' aufs.sh -l ' to
> see where, if you don't remember)

Yes lighttpd, minidlna and openssh

aufs on / type aufs (rw,relatime,si=41936df1)
/mnt/sda2/Alt-F=rw
/rootmnt/root=rw
/rootmnt/rootsq=rr


>
>
> This was perhaps a bad design decision, but when Alt-F packages are
> installed, /var/lib, /var/spool, /var/db/... (do a 'ls -l /var' or
> 'ls -l /Alt-F/' to see which ones) are using the same filesystem as
> the Alt-F package; thus, some apps that store temporary values in
> those directories will spin-up the disk.
>
>
> The reason why this was done is that some programs are designed to be
> able to resume operation after a crash/restart/reboot as if the
> crash/reboot had not happen. NFS is one such example:after a reboot,
> there is enough information stored on disk so that client operation
> continues without user intervention after a server restart.
>
>
> I might change this, but some users, specially small-office ones,
> might complain...
>
>
> Does the above explains your problem?
>

Thanks for the explanations, I agree for sda I think you are right, but when I just open the Alt-F configuration page, the two drives spinup, same problem with ssh or samba. Yes sdb return to sleep quickly, but it's strange, no ? Because there no link between the two hdd.

I thought that sdb should be always in spindown mode (except for midnight rsync of course)

>
> Why manually? Disk->Utilities>Spindow does not fit your needs?
>
>
> to spindown after 20 minutes
> sdb run with high saver mode

Sorry, I mean I added 20 minutes in web interface, no apm high/low

Thanks

Joao Cardoso

unread,
Aug 28, 2012, 4:05:54 PM8/28/12
to al...@googlegroups.com


On Tuesday, August 28, 2012 4:52:35 PM UTC+1, Stealth wrote:
>
> Do you have Alt-F packages installed? where? (try ' aufs.sh -l ' to
> see where, if you don't remember)

Yes lighttpd, minidlna and openssh

aufs on / type aufs (rw,relatime,si=41936df1)
/mnt/sda2/Alt-F=rw

So this excludes my previous post hypothesis.
 
...

Thanks for the explanations, I agree for sda I think you are right, but when I just open the Alt-F configuration page, the two drives spinup, same problem with ssh or samba. Yes sdb return to sleep quickly, but it's strange, no ? Because there no link between the two hdd.


-guess you are not using RAID?
-Is any service serving anything from any sdb filesystem?
-how is swap being used? 'free' displays it.
- what does 'mount' and 'ls -la /mnt/sdb*/' reports?

To hunt the culprit, turn all service off, run 'rc<service> stop', e.g.'rcsmb stop'; for a list of all services, run 'rcall status'; you will be kicked off if running 'rcinetd stop', you have to login again.
You can also unmount Alt-F package filesystem, use 'aufs.sh -u' to stop using it, and 'aufs.sh -m' to mount it again.
Then wait for the disk to spin down and ssh the box -- does the sdb disk wakes-up?

I thought that sdb should be always in spindown mode (except for midnight rsync of course)

It is difficult to make a disk spindown under linux, as in unix "everything is a file".
The only sure way is to unmount all sdb filesystems, turn of swap on sdb and only mount/use them at backup time.

FredB

unread,
Aug 29, 2012, 4:12:31 AM8/29/12
to al...@googlegroups.com

>
> -guess you are not using RAID?

No, two independent disks

> -Is any service serving anything from any sdb filesystem?

No, to be sure I tried lsof but nothing

# lsof | grep sda | wc -l
2
# lsof | grep sdb | wc -l
0

> -how is swap being used? 'free' displays it.

free +m
total used free shared buffers
Mem: 61956 39756 22200 0 18940
-/+ buffers: 20816 41140
Swap: 1060216 10232 1049984

> - what does 'mount' and 'ls -la /mnt/sdb*/' reports?

# mount
rootfs on / type rootfs (rw)
tmpfs on /rootmnt type tmpfs (rw,relatime)
aufs on / type aufs (rw,relatime,si=41936df1)
/dev/loop0 on /rootmnt/rootsq type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime,devgid=9,devmode=664)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime,size=108544k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/sda2 on /mnt/sda2 type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)
/dev/sdb2 on /mnt/sdb2 type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)
/dev/sda4 on /mnt/sda4 type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)
/dev/sdb4 on /mnt/sdb4 type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)

# ls -la /mnt/sdb*/
/mnt/sdb2/:
total 60
drwxrwxrwx 12 root root 4096 Aug 27 21:14 .
drwxr-xr-x 6 root root 120 Aug 26 13:43 ..
drwx-w---- 5 fred users 4096 Aug 27 21:14 .Trash-1000
drwx------ 2 root root 4096 Aug 15 16:35 .systemfile
drwxr-xr-x 8 root root 4096 Aug 28 17:34 Alt-F
drwxr-xr-x 4 root root 4096 Aug 26 13:55 Users
drwxr-xr-x 2 501 501 4096 Aug 15 16:37 alt-f
-rw-r--r-- 1 root root 1419 Aug 26 12:42 alt-f-reloaded.log
drwxr-xr-x 2 root root 4096 Mar 15 2011 compile
-rwxrwxrwx 1 502 502 1562 Jul 1 2011 ctrl_fanspeed.sh
drwxr-xr-x 15 root 702 4096 Feb 15 2010 ffp_sav
drwxrwxrwx 8 fred 502 4096 Aug 23 19:02 fred
-rw-rw-rw- 1 502 502 2876 Aug 15 16:34 fun_plug
-rwxrwxrwx 1 502 502 2506 Jul 8 2011 fun_plug_sav
drwxrwxrwx 4 root root 4096 Jul 19 09:17 minidlna
drwxrwxrwx 6 501 501 4096 Jul 13 12:37 partage

/mnt/sdb4/:
total 2
drwxrwxrwx 3 root root 1024 Aug 15 19:20 .
drwxr-xr-x 6 root root 120 Aug 26 13:43 ..
drwx------ 2 root root 1024 Jul 2 2010 .systemfile


It's the exact clone of sda, ctrl_fanspeed.sh, compile, are unused files just backup of my last live with ffp


# ps -edf
PID USER COMMAND
1 root init
2 root [kthreadd]
3 root [ksoftirqd/0]
4 root [events/0]
5 root [khelper]
6 root [async/mgr]
7 root [sync_supers]
8 root [bdi-default]
9 root [kblockd/0]
10 root [ata_aux]
11 root [ata_sff/0]
12 root [khubd]
13 root [kswapd0]
14 root [aufsd/0]
15 root [aufsd_pre/0]
16 root [scsi_eh_0]
17 root [scsi_eh_1]
23 root [mtdblock0]
25 root [mtdblock1]
26 root [mtdblock2]
27 root [mtdblock3]
28 root [mtdblock4]
31 root [usbhid_resumer]
49 root [loop0]
388 root [kjournald]
525 root syslogd -C -m 0 -D
529 root /usr/sbin/sshd
531 root klogd
553 root [kjournald]
567 root sysctrl
572 root crond
580 fred lighttpd -f /etc/lighttpd/lighttpd.conf
584 fred [php-cgi]
604 root smartd -i 1800
629 root inetd
678 root [kjournald]
716 root /bin/sh --
726 root [kjournald]
1769 root nmbd -D
1771 root smbd -D
1773 root smbd -D
3071 root minidlna
3073 root minidlna
3075 root minidlna
3091 root {sshd} sshd: root@pts/0
3093 root -sh
3100 root [flush-8:0]
3104 root ps -edf


>
>
> To hunt the culprit, turn all service off, run 'rc<service> stop',
> e.g.'rcsmb stop'; for a list of all services, run 'rcall status';
> you will be kicked off if running 'rcinetd stop', you have to login
> again.
> You can also unmount Alt-F package filesystem, use 'aufs.sh -u' to
> stop using it, and 'aufs.sh -m' to mount it again.
> Then wait for the disk to spin down and ssh the box -- does the sdb
> disk wakes-up?
>


Can I use ssh after 'aufs.sh -u' ?
Sorry, I can't try without caution because I'm not at home and I have only ssh access now

I'm using openssh with 822 port, alt-f ssh is disable

If you think it's relevant I can disable all services, minidlna, samba, lighttpd, except openssh ? But I don't know how I can read the disk status log with ssh console

Thanks


Beachsun

unread,
Aug 29, 2012, 2:54:56 PM8/29/12
to

I will bet for Swap.

Try turning off Swap on sdb.

type : swapoff /dev/sdb

After that try to spinDown the disk : hdparm -Y /dev/sdb

And check if it's sleeping : hdparm -C /dev/sdb

Can you post the fstab file? : cat /etc/fstab


By the way, Hello to all, and congrats to Joao for a great piece of soft that extends the life of our DNS323.
Great Work and Support!!! Thnak You!!!

Joao Cardoso

unread,
Aug 29, 2012, 4:48:23 PM8/29/12
to


On Wednesday, August 29, 2012 1:38:00 PM UTC+1, Beachsun wrote:

I will bet for Swap.

Me too. Read Comment 7 and following on  Issue 49
But your instructions to turn swap off are not correct ;-)
 

Try turning off Swap on sdb.

type : swapoff /dev/sdb

You need to specify the partition that is being used for swapping, not the whole disk.
The current swap devices can be obtained using the 'cat /proc/swaps' command; most probably Beachsum will be using /dev/sda1 and /dev/sdb1, but only analyzing the command output he can tell. In the following /dev/sdb1 is *assumed* to be the swap partition.
Then specify the partition in use to the swapoff command, 'swapoff /dev/sdb1'

After being sure that the wakeup issue is derived from swap usage, the swap 'filesystem' has to be destroyed, otherwise on the next reboot it will be used again.
The best is to use that 500MB partition area as a small scratchpad area, creating a normal filesystem on it. That can be done using the Disk Filesystems web page, but swap 'filesystems' don't appear on the page, you have to destroy it first. Use 'dd if=/dev/zero of=/dev/sdb1 count=100' to erase the swap information on the swap partition (after executing the 'swapoff' command).


After that try to spinDown the disk : hdparm -Y /dev/sdb

And check if it's sleeping : hdparm -C /dev/sdb

Can you post the fstab file? : cat /etc/fstab


By the way, Hello to all, and congrats to Joao for a great piece of soft that extends the life of our DNS323.
Great Work and Support!!! Thnak You!!!

Thanks :-)
 
... 
>
> To hunt the culprit, turn all service off, run 'rc<service> stop',
> e.g.'rcsmb stop'; for a list of all services, run 'rcall status';
> you will be kicked off if running 'rcinetd stop', you have to login
> again.
> You can also unmount Alt-F package filesystem, use 'aufs.sh -u' to
> stop using it, and 'aufs.sh -m' to mount it again.
> Then wait for the disk to spin down and ssh the box -- does the sdb
> disk wakes-up?
>


Can I use ssh after 'aufs.sh -u' ?
Sorry, I can't try without caution because I'm not at home and I have only ssh access now

I'm using openssh with 822 port, alt-f ssh is disable

Than don't stop ssh, or you won't be able to ssh the box. Hopefully the wakeup is swap derived, you won't have to disable services looking for the culprit.
  

If you think it's relevant I can disable all services, minidlna, samba, lighttpd, except openssh ? But I don't know how I can read the disk status log with ssh console

'logread' displays the system log, 'dmesg' displays the kernel log
 

Thanks

Joao Cardoso

unread,
Aug 29, 2012, 4:53:48 PM8/29/12
to al...@googlegroups.com


On Wednesday, August 29, 2012 9:26:32 PM UTC+1, Joao Cardoso wrote:
 
Use 'dd if=/dev/zero of=/dev/sdb1 count=100' to erase the swap information on the swap partition (after executing the 'swapoff' command).

Please notice that the previous post originally had 'count=1000'. 100 is enough and safer.

Stealth

unread,
Aug 30, 2012, 5:36:11 AM8/30/12
to al...@googlegroups.com
  629 root     inetd
  678 root     [kjournald]
  716 root     /bin/sh --
  726 root     [kjournald]
 3415 root     {sshd} sshd: root@pts/0
 3417 root     -sh
 3426 root     [flush-8:0]
 3447 root     ps -edf

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      530113+ 82 Linux swap
/dev/sdb2             131      121601   975715807+ 83 Linux
/dev/sdb4              67         130      514080  83 Linux

Test1:

swapoff /dev/sdb1

I waited some minutes, and I logged

# logread | grep wake

Aug 30 09:30:25 nostromo daemon.info sysctrl: right_dev disk (sda) wakeup
Aug 30 09:30:27 nostromo daemon.info sysctrl: left_dev disk (sdb) wakeup -> when I stopped services an swap
Aug 30 10:12:12 nostromo daemon.info sysctrl: right_dev disk (sda) wakeup -> first test, good
Aug 30 10:45:22 nostromo daemon.info sysctrl: right_dev disk (sda) wakeup -> second test

Seem good

Test2:

Reboot with all services and swapoff /dev/sdb1

Aug 30 12:19:48 nostromo daemon.info sysctrl: right_dev disk (sda) wakeup

So for me the solution is just put swapoff /dev/sdb1 at start

Thanks for all

I am really impressed by Alt-F, now it's like I have a new NAS, for example samba speed is more fast x2

 




Beachsun

unread,
Aug 30, 2012, 7:45:17 AM8/30/12
to al...@googlegroups.com


El miércoles, 29 de agosto de 2012 22:26:32 UTC+2, Joao Cardoso escribió:


On Wednesday, August 29, 2012 1:38:00 PM UTC+1, Beachsun wrote:

I will bet for Swap.
 
Me too. Read Comment 7 and following on  Issue 49
But your instructions to turn swap off are not correct ;-)
 

Try turning off Swap on sdb.

type : swapoff /dev/sdb

You need to specify the partition that is being used for swapping, not the whole disk.
The current swap devices can be obtained using the 'cat /proc/swaps' command; most probably Beachsum will be using /dev/sda1 and /dev/sdb1, but only analyzing the command output he can tell. In the following /dev/sdb1 is *assumed* to be the swap partition.
Then specify the partition in use to the swapoff command, 'swapoff /dev/sdb1'


As usual, you are right. :)

In Swapon/off i you must use the partition and not the whole disk. My mind fail me... :)
And i suposed 1st partition just because it is the usual on the original Firmware, but really you can use whatever you like best.

 
After being sure that the wakeup issue is derived from swap usage, the swap 'filesystem' has to be destroyed, otherwise on the next reboot it will be used again.
The best is to use that 500MB partition area as a small scratchpad area, creating a normal filesystem on it. That can be done using the Disk Filesystems web page, but swap 'filesystems' don't appear on the page, you have to destroy it first. Use 'dd if=/dev/zero of=/dev/sdb1 count=100' to erase the swap information on the swap partition (after executing the 'swapoff' command).


Why destroy the swap filesystem? It's not sufficient to modify de fstab file to increase the priority to sda1? That way only when sda1 is full filled the system will use sdb1.



Joao Cardoso

unread,
Aug 30, 2012, 9:42:15 AM8/30/12
to al...@googlegroups.com


On Thursday, August 30, 2012 12:45:17 PM UTC+1, Beachsun wrote:
...
  
After being sure that the wakeup issue is derived from swap usage, the swap 'filesystem' has to be destroyed, otherwise on the next reboot it will be used again.
The best is to use that 500MB partition area as a small scratchpad area, creating a normal filesystem on it. That can be done using the Disk Filesystems web page, but swap 'filesystems' don't appear on the page, you have to destroy it first. Use 'dd if=/dev/zero of=/dev/sdb1 count=100' to erase the swap information on the swap partition (after executing the 'swapoff' command).


Why destroy the swap filesystem? It's not sufficient to modify de fstab file to increase the priority to sda1?

Yes, but only until the next reboot, because in Alt-F fstab is created dynamically, only remote filesystem entries like nfs or cifs are saved in flash.
When a disk is detected or plugged, every partition on it is checked for a valid/supported filesystem, and if any is found an fstab entry is created and the filesystem is mounted.
If special mount options were specified for that particular filesystem (in the Disk->Filesystem web page), they are applied (user specified mount options are assigned to filesystems based on its uuid).

Why? Because disks can easily be exchanged, even hot-swapable, in the box.


 

FredB

unread,
Aug 30, 2012, 10:11:59 AM8/30/12
to al...@googlegroups.com
So I confirm, no problem now

Just one another question about my problem

/dev/sda4 and /dev/sdb4 was created by dns 323, now I can delete this partitions ?
Can I extend sda2 and sdb1 ?

What's the usual partitioning with Alt-F ?

Thanks

Joao Cardoso

unread,
Aug 30, 2012, 4:07:36 PM8/30/12
to al...@googlegroups.com


On Thursday, August 30, 2012 3:12:11 PM UTC+1, Stealth wrote:
So I confirm, no problem now

Just one another question about my problem

/dev/sda4 and /dev/sdb4 was created by dns 323, now I can delete this partitions ?
Can I extend sda2 and sdb1 ?

As you can see from the start sector of the partition table you posted, partitions are "out of order", sdb4 starts after sdb1, then comes sdb2:

   Device Boot      Start         End  
/dev/sdb1               1          66 
/dev/sdb2             131      121601 
/dev/sdb4              67         130 
 
Nothing wrong with that, it's the way D-Link engineers thinks :-), but Alt-F Disk Partitioner will refuse to change it.

So, no, you can't delete sdb4 and extend sdb2 into it. You can only extend sdb1 (or delete sdb2 and extend sdb4, which you obviously *don't* want to do).

Extending a partition, and keeping the filesystem (and data) it contains, can only be done at the partition end. Of course, you can move a partition and consolidate it with a neighbor partition; 'parted' (for which an Alt-F package exists) is your friend (but do a backup first!)

What's the usual partitioning with Alt-F ?

Depends on the disk layout selected in the Disk Wizard, but sdx1 is always a 512MB swap partition, then follows the data partition, sdx2 and, in case of RAID that requires equally sized partitions and disks are not of equal size, sdx3 with the remainder space.

And I take the opportunity to correct myself regarding my proposal of destruction of the swap partition in your sdb disk.
It's a bad idea. Specially in your case, where your second disk is a mirror of the first; if the first fails and you want the second to take its place, it will *need* a swap partition, if not for other reasons for at least be able to do a fsck at boot time.
The 323 has only 64MB (not GB!) of memory, and that is not enough for running fsck on modern big disks.
And from your usage pattern (the 'free' command output) you need swap for running other apps.


Thanks

FredB

unread,
Sep 2, 2012, 9:11:19 AM9/2/12
to al...@googlegroups.com

Ok thanks, so If one day I want to buy new drives,
for example a 2/3 to
I should:

1 ) Put the new disk in left slot
2) Use wizard (?) utilities for adding correct
partitions
3) Use rsync for data
4) Switch sdb with sda
5) Put the second new drive in sdb
Steep 1-3 with second disk sdb

Seems good for you ?
Reply all
Reply to author
Forward
0 new messages