Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →To enlarge swap on an Ubuntu VPS, either replace the active /swapfile with a larger, non-sparse file or add a second swap file. Replacing it gives you one clean swap area but requires a successful swapoff while the server has enough free memory; adding another file reduces that transition but leaves multiple swap areas to manage.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Before changing anything, record the currently active swap areas and the persistent entries in /etc/fstab. Afterward, secure the file with mode 600, initialize it with mkswap, activate it with swapon, and verify both the running system and reboot configuration.
As an Amazon Associate I earn from qualifying purchases.
What increasing swap does—and does not do
Swap is disk space that Linux can use as backing storage for memory pages. Increasing it can give an Ubuntu VPS more room to handle short-lived memory pressure, but it does not add physical RAM. Because swap is on the VPS disk, heavy swapping is slower than keeping active data in memory and consumes the disk capacity available to the operating system and applications.
The procedure below assumes a file-backed swap area and uses /swapfile as the existing path. Confirm the real path on your server before running any destructive command. A VPS that exposes only a swap partition needs a different operational plan; that case is covered later.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Choose replacement or an additional file
| Choice | What you do | Advantages | Costs and risks |
|---|---|---|---|
| Replace the existing file | Disable the current file, delete it, create a larger file at the same path, then enable it. | Leaves one swap area and one simple /etc/fstab entry. |
swapoff must move pages back into RAM. The operation can fail or increase memory pressure if the VPS is already short on RAM. |
| Add a second file | Create a distinct path such as /swapfile2 and enable it alongside the original. |
Avoids taking the original area out of service during creation; useful when a single-file replacement is inconvenient. | Creates multiple active swap areas and an additional persistent entry to audit and remove later. |
Check available disk space before either option. The requested file size must fit without consuming the headroom needed by the operating system, logs, databases, and applications. If the real need is sustained additional memory or storage, enlarging swap only postpones that capacity problem.
Understand the size you are requesting
The replacement example uses bs=1M count=4096: 4,096 blocks of 1 MiB, or 4 GiB of allocated swap. The second-file example uses 2,048 such blocks, or 2 GiB. Change count to match the capacity you have deliberately chosen, and remember that adding a second file increases the total by that file’s full size. There is no requirement to use exactly 4 GiB; the important constraints are the workload, the provider’s disk limit, and enough remaining space for normal operation.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Swap is a capacity decision separate from paging policy. Creating a larger area does not by itself make the kernel swap sooner or later, and changing swappiness does not create more storage. Keep those decisions separate so you can identify whether a problem is lack of capacity, insufficient RAM, or undesirable I/O behavior.
Inspect the current state first
Run these commands as an administrator or prefix them with sudo:
free -h
swapon --show
cat /proc/swaps
grep -nE 'sswaps' /etc/fstab
Use the output to answer four questions:
- How much total, used, and available memory does
free -hreport? - Which swap files or devices are active according to
swapon --show? - Does
/proc/swapsconfirm the same active areas and sizes? - Which lines in
/etc/fstabwill activate swap at boot?
Do not assume that /swapfile is the active path. If the listing shows a different file, substitute that path in the replacement commands. If several entries exist, decide deliberately which ones should remain; accidental duplicate lines can make later troubleshooting confusing.
This inspection also establishes a before-and-after comparison. Record the existing total and each path before making a change. Afterward, the expected increase should be visible in both the active-area listing and the total reported by free -h; a change in only one output indicates that the file may have been created but not activated, or activated but not made persistent.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsReplace an existing /swapfile with a 4 GiB file
This sequence creates a 4 GiB file using 4,096 blocks of 1 MiB. It is appropriate when swapon --show confirms that /swapfile is the area you intend to replace.
1. Plan for the swapoff interval
Disabling swap requires Linux to bring swapped pages back into RAM. Stop or pause memory-heavy jobs if necessary, and perform the change when the VPS has sufficient available memory. If swapoff cannot complete, do not delete the file; restore memory headroom first and try again.
The replacement path has a short period in which the old area is unavailable. That is the principal operational cost of replacement, not the time required to write the new file. If the machine is already under pressure, adding a second area first can provide a less disruptive route, after which you can schedule cleanup of the original file.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
2. Disable and remove the old file
sudo swapoff /swapfile
sudo rm -f /swapfile
Run swapoff against the specific file, not every swap area, so unrelated swap devices remain available. The removal command is safe only after the file is no longer active.
Recommended Free Tools
3. Create a non-sparse file
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 status=progress
This writes the file’s blocks instead of merely reserving apparent length. The Ubuntu swapon(8) documentation warns, “You should not use swapon on a file with holes,” and identifies dd with /dev/zero as the most portable way to create a swap file. Let the command finish and check that the VPS has not run out of disk space.
Do not treat a reported file length as proof that the storage is usable for swap. Hole-filled or sparse allocation can produce the right logical size while lacking physical blocks, and swapon can reject such a file. The explicit dd write avoids that portability problem on the filesystems for which this procedure is intended.
4. Restrict permissions
sudo chmod 600 /swapfile
Mode 600 allows only root to read or write the file. This prevents ordinary accounts from accessing pages that may contain sensitive process data.
5. Initialize and activate the swap area
sudo mkswap /swapfile
sudo swapon /swapfile
mkswap writes swap-area metadata; it does not activate the area by itself. As the mkswap(8) documentation explains, you need swapon after creating the swap area before the kernel can use it.
Free tools Windows power users keep installed
One-click scans. No signup required.
6. Make the new size persistent
Edit the file-system table:
sudoedit /etc/fstab
Keep one line for this file:
/swapfile none swap sw 0 0
Remove an obsolete line for the old path if the path changed, and do not append a duplicate /swapfile line. Saving the entry is what makes the swap area eligible for activation during boot; the current session is already using it because of swapon.
7. Verify the running system
swapon --show
cat /proc/swaps
free -h
swapon --show should list /swapfile with the intended size. /proc/swaps is the kernel’s view of active swap areas, while free -h should show the increased total swap. If the values disagree, stop and inspect the commands and path before rebooting.
Add a second swap file instead
Adding a file is useful when you want to avoid replacing the original immediately and have adequate free disk space. The example below adds a 2 GiB area at /swapfile2 while leaving the existing swap active.
- Create the file with real allocated blocks:
sudo dd if=/dev/zero of=/swapfile2 bs=1M count=2048 status=progress - Protect it:
sudo chmod 600 /swapfile2 - Initialize it:
sudo mkswap /swapfile2 - Enable it immediately:
sudo swapon /swapfile2 - Add exactly one persistent entry:
printf '/swapfile2 none swap sw 0 0n' | sudo tee -a /etc/fstab - Confirm both areas:
swapon --show cat /proc/swaps free -h
The result is multiple swap areas. Keep a clear record of each path and its /etc/fstab line so that a later cleanup does not leave a stale boot entry. The total shown by free -h should include the original area and the new 2 GiB area, subject to the sizes reported by the kernel.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Remove an added swap file safely
Disable the specific area first, delete its file, then remove its persistent line:
sudo swapoff /swapfile2
sudo rm /swapfile2
sudoedit /etc/fstab
Save /etc/fstab with the /swapfile2 line removed. Deleting an active swap file without swapoff can leave the system in an inconsistent state. Verify afterward that the remaining area is still listed and that the total has fallen by the removed file’s size.
Filesystem and allocation caveats
Why sparse files and holes matter
A file can report a large logical length while occupying fewer physical blocks. Such holes are not valid for reliable swap activation: swapon may reject the file. A command that appears to create the right size is therefore not enough; the allocation method must produce usable blocks.
Choosing an allocation method
fallocate behavior varies with the filesystem. Ubuntu’s swapon documentation specifically notes portability concerns across filesystems and additional requirements on Btrfs. The dd commands shown above are the documented portable fallback because they write every block from /dev/zero. If your VPS uses a copy-on-write filesystem or Btrfs, follow that filesystem’s documented swap-file requirements rather than assuming an ext4 procedure will work unchanged.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Check capacity before writing
The dd operation consumes real disk space. Confirm that the requested 4 GiB, 2 GiB, or other size fits with operational headroom. A full root filesystem can prevent services from writing logs or application data even if swap itself activates successfully.
Remember that a second file consumes additional capacity rather than changing the size of the original file. Replacement also needs enough free space for the new file after the old one has been removed, but the server still needs room for ordinary files once the operation is complete. Disk capacity is therefore a direct cost of either method.
When the VPS provides a swap partition
Some providers expose a swap partition or block device instead of a file. mkswap accepts a device as well as a file, so the activation and persistence concepts remain the same, but the storage object is different. Do not run file-removal commands against a partition.
Expanding an existing swap partition usually involves provider controls or partition-layout work. When free filesystem space is available, creating a new swap file is generally the simpler operational route. If the provider controls the partition, consult its storage procedure before changing partition boundaries.
Swappiness is a separate decision
Increasing swap size does not automatically change Linux’s swappiness policy. Ubuntu’s swap FAQ records swappiness=60 as the default. Swappiness influences how readily the kernel considers swapping; it is a workload-tuning setting, not a capacity setting.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Inspect the current value
sysctl vm.swappiness
Test a temporary value
For an experiment, change the value at runtime and observe memory and I/O behavior:
sudo sysctl -w vm.swappiness=10
The value 10 is only an example of a temporary test, not a universal recommendation. Monitor the workload before deciding whether any change is appropriate.
Persist a deliberate setting
If observation supports a permanent change, place the chosen vm.swappiness setting in an appropriate file under /etc/sysctl.d/ and apply it using your normal sysctl configuration process. Keep this change separate from swap-file creation so that you can distinguish capacity problems from paging-policy effects.
Troubleshooting common failures
swapoff fails or takes too long
- Check
free -hand stop memory-intensive services temporarily. - Do not remove the old file while it is still active.
- If the VPS cannot hold the swapped pages in RAM, add capacity through a second file first or resize the VPS, then revisit replacement.
swapon reports an invalid argument or refuses the file
- Confirm the path and that
mkswapcompleted successfully. - Check that the file is mode
600. - Recreate the file with
ddif it was made with a hole-producing allocation method. - Review filesystem-specific rules, especially on Btrfs or other copy-on-write filesystems.
The new swap is active but disappears after reboot
- Inspect
/etc/fstabfor one correctly spelled line using the exact file path. - Remove duplicate or obsolete entries.
- After editing, use
swapon --showandfree -hduring the current session, then schedule a controlled reboot if your operational policy permits it.
The VPS still reports low memory
Swap growth changes the amount of disk-backed virtual memory, not physical RAM. Review the processes consuming memory and the VPS plan’s RAM and disk limits. Persistent heavy swapping indicates that the workload may need more RAM, application tuning, or additional storage rather than an indefinitely larger swap file.
Final verification checklist
swapon --showlists every intended swap file or device and its expected size.cat /proc/swapsconfirms the same areas are active.free -hshows the new total swap.- Every intended persistent area has exactly one matching line in
/etc/fstab. - The swap file is non-sparse and has mode
600. - Disk space remains available for the operating system and applications.
- A reboot check is planned only when you can perform it safely; no reboot is required to verify that the current session is using the newly enabled area.
Questions administrators commonly ask
Do I have to replace the existing file to increase swap? No. Adding /swapfile2 or another distinct file is valid and avoids disabling the original area. The trade-off is that multiple files and persistent entries must be managed.
Can I delete /swapfile while it is active? No. Run swapoff for that specific area first, confirm it is no longer listed, and only then remove the file. If swapoff cannot complete, keep the file and create more memory headroom.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Why use dd instead of fallocate? Ubuntu’s swapon(8) documentation identifies dd with /dev/zero as the most portable creation method and warns against files with holes. Allocation behavior can vary by filesystem, especially on Btrfs and other copy-on-write systems.
Does mkswap turn the file on? No. It initializes the swap-area metadata. Run swapon afterward to activate it for the current session, then add the matching /etc/fstab entry for boot persistence.
Will the new swap survive a reboot automatically? Only if the exact file or device has one correct swap line in /etc/fstab. A successful swapon command alone affects the current session.
Best Value
What if my provider gave me a swap partition? Treat it as a device, not a file. mkswap supports devices, but expanding a partition generally requires provider or partition-layout work. A new file is usually simpler when the filesystem has free space.
Should I change swappiness after increasing swap? Not automatically. Ubuntu documents a default of 60; changing the value is a separate tuning experiment. Observe memory and I/O behavior before making a temporary or persistent adjustment.
Does a larger swap file fix low-RAM problems permanently? No. It adds disk-backed capacity and may help with short-lived pressure, but it cannot provide the performance of physical RAM. Continued heavy swapping points toward more RAM, workload tuning, or additional storage.
Frequently Asked Questions
What is the safest way to increase swap on an Ubuntu VPS?
Inspect active swap and /etc/fstab, then either replace the active file during a low-memory-pressure window or add a second file. In both cases use a non-sparse file, mode 600, mkswap, swapon, and a single matching fstab entry.
Can I add swap without taking the existing swap offline?
Yes. Create and activate a distinct file such as /swapfile2. This avoids replacing the original immediately, but leaves multiple swap areas and persistent entries to maintain.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Why does Ubuntu recommend dd for swap files?
The Ubuntu swapon(8) documentation calls dd with /dev/zero the most portable creation method and warns that files with holes should not be used.
How do I make an enlarged swap file persist after reboot?
Add exactly one line such as /swapfile none swap sw 0 0 to /etc/fstab, then verify the active area with swapon --show and free -h.
What should I do if swapoff cannot finish?
Do not delete the active file. Stop memory-heavy services, restore RAM headroom, or add a second swap area first; then retry replacement when the VPS can hold the swapped pages.
Does increasing swap increase physical memory?
No. Swap consumes VPS disk capacity and provides slower disk-backed virtual memory. Persistent heavy swapping may mean the VPS needs more RAM, application tuning, or additional storage.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →The Bottom Line
Inspect first, choose replacement or addition deliberately, create a fully allocated file with dd, set mode 600, run mkswap and swapon, and keep exactly one correct /etc/fstab entry per intended swap area. Verify with swapon --show, /proc/swaps, and free -h; treat swappiness and VPS resizing as separate decisions.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




