I was getting a Wordpress database connection error every other day. I created a 512 swap file (1GB droplet) and it made it about a week. I’m trying to increase the swap file 2GB. Here are the steps I took.
sudo swapoff /swapfile sudo dd if=/dev/zero of=swapfile bs=2048 count=1048576 sudo mkswap /swapfile
It reports: Setting up swapspace version 1, size = 1048572 KiB…
sudo swapon /swapfile
It looks like it only created a 1GB swapfile. When I use free-m it says 1023 for the swap. The file size via WinSCP is 2GB.
Is there a limit on the size of a swap file? If so, can I have two swap files? Or should I get a bigger droplet?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Yep, that was it. I redid all those steps replacing the dd with yours and it free -m now shows 2047. Thanks for the help.
<pre>sudo dd if=/dev/zero of=swapfile bs=2048 count=1048576 </pre>should be<pre>sudo dd if=/dev/zero of=/swapfile bs=2048 count=1048576 </pre>
Hi, <br> <br>i use this command : <br> <br>sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k <br> <br>is it correct ? <br> <br>i checked with “top” command it it show <br> <br>KiB Swap: 2150396 <br> <br>is there anything wrong with my command or not ? <br> <br>what is "bs=2048 " mean ? <br> <br>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.