152

Raspbian uses dphys-swapfile, which is a swap-file based solution instead of the "standard" swap-partition based solution. It is much easier to change the size of the swap. The configuration file is: /etc/dphys-swapfile The content is very simple. By default my Raspbian has 100MB of swap: CONF_SWAPSIZE=100 If you want to change the size, you need to ...


12

I used to use sudo update-rc.d dphys-swapfile remove I haven't tried recently so I'll assume that no longer works as you have tried using it. Perhaps try CONF_SWAPSIZE=0 in /etc/dphys-swapfile


10

To avoid an error on startup regarding dphys service, try to disable swap on this way: sudo dphys-swapfile swapoff sudo dphys-swapfile uninstall sudo update-rc.d dphys-swapfile remove sudo apt purge dphys-swapfile


7

I was wondering if there was any way to allow more ram Not more physical RAM, but you can increase the amount of system memory by using swap, which is a region of secondary storage. Traditionally on linux this is done with a small dedicated partition on a hard disk. Current Raspbian uses something similar, a swap file, which is just a normal file that's ...


6

IMHO, the swap was enabled by default because without the swap when you run out of the memory you'll get a kernel panic and/or the application killed, that might be avoided using swap. With the swap actually active, the performance might be really bad, but the execution still continues. Since nobody could possibly know in advance how the particular RasPi ...


6

The 8GB is only the guideline size of a card. Because of the nature of flash memory and management of dead cells there are slight variations in actual usable space. This usable space will also decrease as the card gets older and older. With SSD's and SD cards like this it is a good idea to leave a small amount of space that is unused. I would say about 1% ...


4

It is a pity that the Raspberry Pis do not have GigaBit Ethernet but it is at least theoretically possible to have swap space on a network device - the Linux Terminal Server Project can offer it from the server to the clients according to this item on their wiki. I found a Foundation Forum topic "Tip: Swap over nfs" that shows how someone who already had ...


4

Raspbmc uses /etc/init/swap.conf to configure swap via /swap file. It first checks for presence of /home/pi/.enable_swap. If you delete /home/pi/.enable_swap then swap file is not created, and then just recreate it with touch /home/pi/.enable_swap if you need swap turned on and reboot.


4

Most likely because at some point previous to this swap was needed. Moving data into swap is a priority when free memory is low, but moving it out is not a priority when free memory is available. The justification for this is pretty sound if you think about it for a bit. Stuff that gets swapped out in the first place is stuff that isn't being accessed ...


3

Network swap is a bad idea. The whole purpose of swap is to replace memory, but it's only feasible if this is done locally. I believe you're going through some premature optimization. I'd put my time into getting everything working, then doing actual tests to see if you do run into any issues or not. If you're running into severe issues, that's the time to ...


3

The first line of df isn't saying the root directory is using all that space, that's the root mount point, containing every directory which isn't covered by one of the other mount points. I suspect the transmission directory isn't on the USB stick as you intend but actually on the SD card. You can use the du command to examine where space is being used. (...


3

Short answer: This is a bad idea overall. And a terrible idea in terms of stability. Long Answer: Memory swapping is something like a last resort measure when your system will run out of RAM available to load all the programs and their data. How well the Operating System manages the swapping pages will be a determinant to how fast your system will perform....


3

I'm the developer of Raspbmc, and I provided a simple method for installing swap (although it's disabled by default, and not recommended for 512MB Pis). Simply run this via SSH: touch /home/pi/.enable_swap sudo reboot You will now have a swap file created at /swap. Source: http://svn.stmlabs.com/svn/raspbmc/release/oscore/upstart-wheezy/perf.conf ...


2

How could I get some extra space on my RPI? The clear and obvious answer is get a bigger SD card. 8 GB isn't really that large. Short of migrating: You could look into removing any development packages you're not using. Run the command sudo apt autoremove to remove packages that are no longer being used.


2

Your memory isn't "almost fully used" in the sense you think. Total: The amount of memory available to the system. Used: The amount of memory containing information tracked by the system. Cached: The amount of memory in use as a page cache by the system. Basically, this is stuff that was read off disk (or whatever storage) into memory for some useful ...


2

That's the default size of the swap file, 100 megabytes. If you want to make it smaller edit /etc/dphys-swapfile and change 100 to some other number. Use the following commands to put the resize into affect. /etc/init.d/dphys-swapfile stop /etc/init.d/dphys-swapfile start Use the following command to permanently remove the swap file. sudo update-rc.d ...


2

If you're concerned about SD corruption, then I'd say leave swap on the NAS. Spinning disk is much better at handling constant read/write/rewrite operations than SD cards and the WD Red series is designed to act in a NAS system. That being said, SD cards are getting better at handling the larger number of IO operations, provided the SD card is of good ...


2

.*.swp files are created by the vi editor to log changes so that the undo command can work. They are created with the same permissions as the file they are logging in the same directory. Because the name starts with a period they are hidden. If you've used sudo vi /etc/rc.local and created /etc/.rc.local.swp you'll need to use sudo rm /etc/.rc.local.swp to ...


2

It's a system service. You can systemctl disable dphys-swapfile if you want, and list a swap partition in fstab instead (or whatever you normally do, or not use any swap). You can delete the swap file too since (pretty certain) its a dphys-swapfile exclusive thing. I'm not sure why it is not fixing the OOM kills Is your swap partition exactly the same ...


1

There's a good article on nixCraft regarding the "correct" amount of swap. It's worth reading I think because it suggests that there is no single "correct" amount for all applications. If we look at Raspberry Pi's default allocation of swap, it's actually quite low. On my systems for example: RPi3B+: $ free -m total used free ...


1

I would recommend enabling swap in the form of zram, which should give you much more graceful degradation than you're seeing. My guess is that the kernel is trying to keep you from oomkiller by repeatedly paging out text segments, which then have to be brought back in to execute. Better to execute at all than kill things, in the kernel's opinion. Also, ...


1

sudo swapoff -a sudo swapon -a or sudo systemctl disable dphys-swapfile then sudo systemctl enable dphys-swapfile


1

I found some hack to compile the file, but it is not sure that this won't make any troubles in future. I've run gcc's preprocessor on the file (-E flag) in Raspberry: /usr/bin/c++ -E -DBOOST_NO_RTTI -I/home/pi/Desktop/iroha/irohad -I/home/pi/Desktop/iroha/libs -I/home/pi/Desktop/iroha/shared_model -I/home/pi/Desktop/iroha/zbudowane/schema -isystem /usr/...


1

Swap is only used if you run out of memory. The Pi normally uses a swapfile, which if not used has no penalty, but if required is slow. Without swap the OS will terminate low priority processes or crash. The choice is yours.


1

It's possible that the swap file is still set on the SD card. The process I would use is sudo dphys-swapfile swapoff sudo nano /etc/dphys-swapfile Set the value of CONF_SWAPFILE in to point to your hard disk mount / partition on the HDD and REMOVE the # at the start of the line Set the value of CONF_SWAPSIZE to the size you want sudo dphys-swapfile setup ...


1

There are a few issues since the current version of bash is not interpreting zram.sh properly. You can test wether bash interpretes your zram.sh well by executing (as root) following script -no impact! just see! The instructions modprobe and swapoff are disabled-: #!/bin/bash cores=$(nproc --all) echo $cores # modprobe zram num_devices=$cores #...


1

Are you sure you really want to have swap on an external disk like that, over USB? It seems a little unusual, and might not be all that fast, so you might want to double check that requirement... Assuming you do want to do that, the easiest way to have swap enabled at boot is via fstab. This would require the disk always be there, but if you can manage that,...


Only top voted, non community-wiki answers of a minimum length are eligible