I'm using a Raspberry Pi B+ with a camera, and it is purpose is literally just for use with the Motion software & share any images/videos it creates on a shared folder over Samba.

Ever since I formatted and set my Pi up (2-3 days ago) it has been taking a really long time to open a shared folder on the Pi from a my main Ubuntu machine on a very good network using Samba, so I started to look for problems on the Pi.

Upon issuing ~ $top on the CLI, i noticed that the Motion software averages about 50% of the CPU, and 10% of the memory. However, it regularly spikes to 98%, as shown below (I'm guessing this is when it is creating the .avi file using the stream of images it took when it noticed movement/motion). I'd like to understand if this is normal? Let's say the Pi is doing it's average 50-55% CPU utilisation with Motion, and then I open a shared folder on the Pi from my Ubuntu machine. Samba takes the remaining 50% of CPU & about 1 minute to open the folder (it does massively drop in CPU once the files are listed, but spikes again if I double click to open one of the files). I've just checked and the folder is 2.2GB large with loads of images and videos (but I've got my file browser - Nautilus - showing only a list file view). Is it normal for these programs to use so much CPU, if so, how can I speed it up?

enter image description here

  • 1
    Samba's a notorious CPU hog, I think. And/or the NTFS driver, if you are using that. So unless you have to use it, it seems like the worst option for file sharing. I've never noticed any delay entering a directory using sshfs + ext4. The total volume of the directory should not be any kind of factor -- the total number of files would though. – goldilocks Oct 7 '15 at 19:13
  • You might also want to double check that using htop, which will show the per core usage properly; top has two modes for reporting usage (toggled with I, see "Irix mode" in the man page) and they can both be a little confusing on multi-core systems. – goldilocks Oct 7 '15 at 19:40
  • pi@raspberrypi ~ $ htop -bash: htop: command not found – john smith Oct 7 '15 at 21:51
  • 1
    Run sudo apt-get install htop to install htop – HeatfanJohn Oct 7 '15 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.