Hacker News new | past | comments | ask | show | jobs | submit login
Way to give small digital ocean box more RAM
3 points by andrewfromx on Aug 19, 2016 | hide | past | favorite | 3 comments
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000

mkswap /var/swap.img

swapon /var/swap.img

if you are paying $5/month on digital ocean for 512MB Memory machine, the above commands will place a 1000MB file on your drive (it's ok u have 20GB) and use that for swap space so you can exceed your 512 limit.




Small world- I was looking into this earlier today.

From DigitalOcean's site:

"Although swap is generally recommended for systems utilizing traditional spinning hard drives, using swap with SSDs can cause issues with hardware degradation over time. Due to this consideration, we do not recommend enabling swap on DigitalOcean or any other provider that utilizes SSD storage. Doing so can impact the reliability of the underlying hardware for you and your neighbors.

If you need to improve the performance of your server, we recommend upgrading your Droplet. This will lead to better results in general and will decrease the likelihood of contributing to hardware issues that can affect your service."


all I'm trying to do is compile rust-lang with make. Without doing the above trick it runs out of memory during the compile. Surely I can do this trick, compile, reboot and everything will be fine?


Absolutely. I'm using swap to duct-tape a memory leak in production until I have the time to fix the leak :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: