Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

[PROBLEM] How to increase swap size
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Problem: How to increase swap size
12th Mar, 2014, 01:44 AM
Post: #1
LeoSum Offline
Registered
Posts: 10
Joined: Mar 2014
Reputation: 0
How to increase swap size
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
Find all posts by this user
Quote this message in a reply
12th Mar, 2014, 05:21 AM
Post: #2
teekay Offline
Registered
Posts: 20
Joined: Jan 2014
Reputation: 9
RE: How to increase swap size
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..
Find all posts by this user
Quote this message in a reply
12th Mar, 2014, 06:29 AM
Post: #3
LeoSum Offline
Registered
Posts: 10
Joined: Mar 2014
Reputation: 0
RE: How to increase swap size
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
Find all posts by this user
Quote this message in a reply
13th Mar, 2014, 04:32 AM
Post: #4
IriDium Offline
Inquisitor
******
Posts: 2,025
Joined: Jan 2013
Reputation: 170
RE: How to increase swap size
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?

Please read before you post
How to post a log file

If you liked my help, click on "Thanks" to show your appreciation.
Find all posts by this user
Quote this message in a reply
13th Mar, 2014, 06:07 PM
Post: #5
LeoSum Offline
Registered
Posts: 10
Joined: Mar 2014
Reputation: 0
RE: How to increase swap size
(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!
Find all posts by this user
Quote this message in a reply
14th Mar, 2014, 02:49 AM
Post: #6
IriDium Offline
Inquisitor
******
Posts: 2,025
Joined: Jan 2013
Reputation: 170
RE: How to increase swap size
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 :-)

Please read before you post
How to post a log file

If you liked my help, click on "Thanks" to show your appreciation.
Find all posts by this user
Quote this message in a reply
14th Mar, 2014, 03:12 AM
Post: #7
LeoSum Offline
Registered
Posts: 10
Joined: Mar 2014
Reputation: 0
RE: How to increase swap size
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
Find all posts by this user
Quote this message in a reply
16th Mar, 2014, 09:08 AM
Post: #8
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: How to increase swap size
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 ...

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 10th May, 2025, 09:04 PM Powered By MyBB, © 2002-2025 MyBB Group.