SirJohnDoe
Posts: 16
Joined: Tue Jul 28, 2015 10:20 am

External HDD spins up every 30 minutes

Thu Aug 20, 2015 4:51 pm

Recently I've noticed my external HDD spins up every 30 minutes, after which it'll spin down again in 10 minutes (the default time). It's a WD Studio II external HDD, formatted as NTFS and with a GPT system. Naturally I've been searching for what causes this. I've turned off several daemons, shut down Kodi, but the cycle continued. When checking for Disk read and write actions with iotop, I also couldn't identify the programs responsible.

What I've tried:

Turning off Kodi, vsftpd, samba, rsyslog, rsync, ntp, cron, as described here: http://info4admins.com/tips-to-spindown ... or-ubuntu/

Here's an iotop log of an hour (it occurs at 00 and 30 or close to that): http://pastebin.com/5xqtTHdM

A list of all services on my system (with service --status-all):

Code: Select all

[ ? ]  alsa-utils
 [ - ]  bootlogs
 [ ? ]  bootmisc.sh
 [ ? ]  cgroup-bin
 [ ? ]  checkfs.sh
 [ ? ]  checkroot-bootclean.sh
 [ - ]  checkroot.sh
 [ - ]  console-setup
 [ + ]  cron
 [ + ]  dbus
 [ ? ]  dphys-swapfile
 [ ? ]  fake-hwclock
 [ ? ]  hdparm
 [ - ]  hostname.sh
 [ ? ]  hwclock.sh
 [ + ]  ifplugd
 [ - ]  kbd
 [ - ]  keyboard-setup
 [ ? ]  killprocs
 [ ? ]  kmod
 [ - ]  kodi
 [ - ]  lightdm
 [ - ]  motd
 [ ? ]  mount
 [ ? ]  mount.save
 [ ? ]  mountall-bootclean.sh
 [ ? ]  mountall.sh
 [ ? ]  mountdevsubfs.sh
 [ ? ]  mountkernfs.sh
 [ ? ]  mountnfs-bootclean.sh
 [ ? ]  mountnfs.sh
 [ ? ]  mtab.sh
 [ ? ]  networking
 [ - ]  nfs-common
 [ + ]  ntp
 [ ? ]  plymouth
 [ ? ]  plymouth-log
 [ - ]  procps
 [ ? ]  raspi-config
 [ ? ]  rc.local
 [ - ]  rmnologin
 [ - ]  rpcbind
 [ - ]  rsync
 [ + ]  rsyslog
 [ + ]  samba
 [ ? ]  screen-cleanup
 [ ? ]  sendsigs
 [ + ]  ssh
 [ - ]  sudo
 [ + ]  triggerhappy
 [ ? ]  tvheadend
 [ + ]  udev
 [ ? ]  udev-mtab
 [ ? ]  umountfs
 [ ? ]  umountnfs.sh
 [ ? ]  umountroot
 [ - ]  unattended-upgrades
 [ - ]  urandom
 [ + ]  vsftpd
 [ - ]  x11-common
The disk itself is mounted with:

Code: Select all

sudo mount -t ntfs-3g -o defaults,noatime,uid=hts,umask=0113,dmask=0022 /dev/sda1 /home/pi/media/HDD1
using a script at start up (fstab was giving problems).

The raspbian version I run is from February. I've upgraded the kernel manually to 3.19.2-v7+ so it works with my tv stick.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: External HDD spins up every 30 minutes

Thu Aug 20, 2015 5:43 pm

See if useing hdparm to put the drive in stand by untill it's needed helps.

http://linux.die.net/man/8/hdparm
Two heads are better than one, unless one's a goat head.

SirJohnDoe
Posts: 16
Joined: Tue Jul 28, 2015 10:20 am

Re: External HDD spins up every 30 minutes

Thu Aug 20, 2015 6:54 pm

The problem isn't spinning down, as it does so automatically, put something takes it out of stand-by. Also HDparm doesn't work with external disks afaik, and probably also doesn't support NTFS.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: External HDD spins up every 30 minutes

Thu Aug 20, 2015 9:20 pm

It works on my seagate external drive, but not my toshiba. ;)
Two heads are better than one, unless one's a goat head.

User avatar
DougieLawson
Posts: 39126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: External HDD spins up every 30 minutes

Thu Aug 20, 2015 9:27 pm

SirJohnDoe wrote:... and probably also doesn't support NTFS.
Does it have to be NTFS? It will run faster, file security will work and it will spin-down when not needed if you reformat it to ext4.

hdparm appears to work with my B+ which has the rootfs on a hard drive.

Code: Select all

root@apollo ~ # hdparm -B 1 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0x01 (1)
 APM_level      = 1
root@apollo ~ # hdparm /dev/sda

/dev/sda:
 multcount     =  0 (off)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 19457/255/63, sectors = 312581808, start = 0
root@apollo ~ #
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

SirJohnDoe
Posts: 16
Joined: Tue Jul 28, 2015 10:20 am

Re: External HDD spins up every 30 minutes

Thu Aug 20, 2015 10:42 pm

DougieLawson wrote:
SirJohnDoe wrote:... and probably also doesn't support NTFS.
Does it have to be NTFS? It will run faster, file security will work and it will spin-down when not needed if you reformat it to ext4.

hdparm appears to work with my B+ which has the rootfs on a hard drive.

Code: Select all

root@apollo ~ # hdparm -B 1 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0x01 (1)
 APM_level      = 1
root@apollo ~ # hdparm /dev/sda

/dev/sda:
 multcount     =  0 (off)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 19457/255/63, sectors = 312581808, start = 0
root@apollo ~ #
Well, it's a lot of work to transfer 2 TB of files and put them another disk, then re-format and put them back.

Again, spinning down is no problem, it works fine. I'm just trying to find out what process wakes up my external HDD every 30 minutes

User avatar
DougieLawson
Posts: 39126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: External HDD spins up every 30 minutes

Thu Aug 20, 2015 10:54 pm

Looks like it's a feechur of the userland NTFS driver.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

fruit-uk
Posts: 609
Joined: Wed Aug 06, 2014 4:19 pm
Location: Suffolk, UK

Re: External HDD spins up every 30 minutes

Fri Aug 21, 2015 5:22 am

SirJohnDoe wrote:Well, it's a lot of work to transfer 2 TB of files and put them another disk, then re-format and put them back.
Do it from your backup drive - you do have a backup, don't you? 2TB is a lot to lose.

SirJohnDoe
Posts: 16
Joined: Tue Jul 28, 2015 10:20 am

Re: External HDD spins up every 30 minutes

Fri Aug 21, 2015 12:43 pm

fruit-uk wrote:
SirJohnDoe wrote:Well, it's a lot of work to transfer 2 TB of files and put them another disk, then re-format and put them back.
Do it from your backup drive - you do have a backup, don't you? 2TB is a lot to lose.
It's only movies and tv series, so it doesn't really matter as I can easily redownload everything. I've just managed to free up enough space on my other disks to transfer the lot, and will re-format it to ext4.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: External HDD spins up every 30 minutes

Fri Aug 21, 2015 10:34 pm

I have 2 1TB drives one mirrored to the other with rysnc. When I first set my system up I tried to do it with ntfs and had issues, reformatting solved everything. Maybe you'll have the same experience.
Two heads are better than one, unless one's a goat head.

bismosa
Posts: 42
Joined: Sun Dec 23, 2012 11:43 am

Re: External HDD spins up every 30 minutes

Wed Feb 17, 2016 5:08 pm

Hello,

did you find the problem?

I had the same problem. I use Openelec and have no iotop.
Then i have tried to find the problem with:

Code: Select all

while true; do lsof | grep sda; done
And have seen that smartmontools is accessing the drive. I have now deactivated it...and all is well :)

Regards Bismosa

Return to “Raspberry Pi OS”