Forum

Full Version: How to increase swap size
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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..
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
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?
(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!
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 :-)
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
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 ...
Reference URL's