Forum
[PROBLEM] How to increase swap size - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Configuration (/forum-17.html)
+--- Thread: [PROBLEM] How to increase swap size (/thread-2171.html)



How to increase swap size - LeoSum - 12th Mar, 2014 01:44 AM

Hi,
I am running xbian on my model b raspberry, which is working fine. However I installed owncloud 6 on the same machine, using nginx and MySQL. The webinterface is awfully slow, much slower than what I see others are experiencing from youtube videos that show it running on a raspberry using raspbian.
The setup process from tutorials worked on xbian too. The only thing I couldn't acchieve was increasing the swap file to the recommended size of 1024MB which supposedly increases performance.

How do I do that in xbian?

Are there other options to speed up owncloud a bit?

Regards
Leo


RE: How to increase swap size - teekay - 12th Mar, 2014 05:21 AM

Assuming your partition layout looks similar to this fdisk -l output
Code:
/dev/mmcblk0p1   *        2048       71679       34816    b  W95 FAT32
/dev/mmcblk0p2           71680    30767103    15347712   83  Linux
/dev/mmcblk0p3        30767104    31268863      250880   82  Linux swap / Solaris
and you use the (default) BTRFS filesystem, you should be able to do

1.) shrink the BTRFS partition with
Code:
mount /dev/mmcblk0p2 /mnt -o subvolid=0
btrfs fi resize -500m /mnt

2.) Stop the zram-swap service (if it's running at all), and run swapoff /dev/mmcblk0p3

3.) then use your favorite partition manager (parted, cfdisk etc..) to resize the partition behind it (mmcblk0p3)

4.) re-create swap
Code:
mkswap /dev/mmcblk0p3
swapon /dev/mmcblk0p3

Now you should have 500MB more swap.
I haven't tested this on Xbian, but it should work that way. Though it might also blow your RPi, burn your house etc etc..


RE: How to increase swap size - LeoSum - 12th Mar, 2014 06:29 AM

Thanks for your thorough answer! I will try and see if this works an then report back. Just let me take precautions for a potential house fire Wink


RE: How to increase swap size - IriDium - 13th Mar, 2014 04:32 AM

Are you sure you need to increase the swap file? 1Gb seems overly excessive.

What does free -h give?

Can you check the CPU usage with vmstat 5 30 - is it high?


RE: How to increase swap size - LeoSum - 13th Mar, 2014 06:07 PM

(13th Mar, 2014 04:32 AM)IriDium Wrote:  Are you sure you need to increase the swap file? 1Gb seems overly excessive.

What does free -h give?

Can you check the CPU usage with vmstat 5 30 - is it high?

I don't have access to my pi right now, but i fiddled around a bit before I read your post, as I didn't want to accidentally screw everything up by changing the swap size. I think the whole problem really is due to high cpu load. I connected to the pi via ssh and monitored via "top" what is happening while i connected to owncloud in the browser.

top showed me that even before accessing onwcloud the cpu load was high. xmbc was constantly using over 80%. After disabling rss feed in xmbc this droped to 20%, but still a bit high, isn't it?
When i kill xmbc via ssh (stop xmbc), owncloud responds much quicker, even without resizing swap. And top tells me that most of the swap space isn't even used at all, even if I upload and download large files.

So I guess the best thing will be to dynamically enable and disable xbmc whenever I need it. I just need to find a comfortable way to do that. I am looking at reading cec signals from my tv to initiate startup and stop of the xbmc process. But I guess that's another thread by itself Wink

I appreciate your guys help!


RE: How to increase swap size - IriDium - 14th Mar, 2014 02:49 AM

20% is about normal when nothing is going on.

I had a feeling it wasn't a swap size issue from your first post.

Whilst "something" will run on the RPi it may not run well.

You could play around with the "nice" levels and see if that helps, or look at Xbian dynamic priority in XBMC Xbian-config.

Personally I don't think you'll have much success - Xbian is a media centre at the end of the day, and if owncloud uses that much CPU you'll have difficulties playing movies with it running in the background. For the sake of £30 just buy another RPi - Problem solved :-)


RE: How to increase swap size - LeoSum - 14th Mar, 2014 03:12 AM

Yeah you're right, that would probably not work well. But since I am the only person using both owncloud and xbmc, I will never use the two at the same time. When I watch movies I am usually not at work accessing my files via owncloud. And pi number two and three are busy in other projects Wink


RE: How to increase swap size - mk01 - 16th Mar, 2014 09:08 AM

LeoSum

it was plan to implement together with dynamic priority also altering XBMC;s memory limits.

so like when XBMC is going to very idle, it's memory limit would change to let's say 30M (ram use), so almost all XBMC would be swapped out to disc. will enable this in next release.

easiest way to resize swap is to remove 256MB limit on swap in /etc/xbian-initramfs/cnvres-code.sh ... or put additional line below like

Code:
swapsize=1024

then run "sudo xbian-update-initramfs"

then in fdisk remove actual swap partition. on reboot durint initramfs stage, swap should be re-created, according the new code ...