Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

How to Increase the Swap File Size on an Ubuntu VPS

A practical Ubuntu VPS guide to replacing or adding swap files, with exact commands, filesystem caveats, persistence steps, verification, and troubleshooting.
Length14 min Posted Quest giverVGSources Team

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To increase swap on an Ubuntu VPS, either replace the existing /swapfile with a larger, non-sparse file or add a second swap file. Replacing it gives you one clean swap area but requires a brief swapoff interval; adding another file reduces that interruption but leaves multiple swap areas to manage. In both cases, check the active configuration first, create the file with secure permissions, run mkswap, enable it with swapon, and add one matching line to /etc/fstab so it returns after a reboot.

The procedure below assumes a file-backed swap area on an Ubuntu VPS, a target of 4 GiB, and a file named /swapfile. Substitute your confirmed path and size rather than copying those values blindly.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What “increasing swap” means on a VPS

A swap file is a reserved area of the VPS disk that Linux can use when physical memory is under pressure. It is not additional RAM: disk-based swap is much slower than memory, and allocating more of it does not improve CPU speed or disk capacity. It can, however, provide room for memory spikes and prevent an out-of-memory event when the machine has enough free storage.

Linux treats a swap file as a fixed swap area after it has been initialized. The practical way to make an existing file larger is to deactivate it, remove it, create a new file at the desired size, initialize that file, and activate it again. A second valid approach is to create another swap file, leave the original in place, and activate both. The correct choice depends on available disk space, how much memory pressure the VPS can tolerate during swapoff, and whether you want one or several entries in the persistent configuration.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Increasing the file size does not resize a currently active area in place. The kernel sees the size established when the file was initialized. That is why the replacement sequence must include swapoff, deletion, allocation, mkswap, and swapon in that order. If you add a second file, each file is initialized and activated independently, and the total shown by memory tools is the sum of all active swap areas.

Choose replacement or an additional file

Approach What you do Advantages Trade-offs
Replace the existing file Run swapoff, delete the old file, create the larger file, then enable it. Leaves one clearly named swap area and a simple /etc/fstab entry. During swapoff, pages must fit in RAM or other active swap. The operation can fail or increase memory pressure.
Add a second file Create a distinct path such as /swapfile2 and activate it alongside the first. Avoids taking the original area out of service and can be done incrementally. Creates multiple active areas and requires a separate persistent line for each one.

Both files and devices can be swap areas. If your provider exposes only a swap partition, enlarging that partition normally involves provider-level or partition-layout work. When free disk space exists, a new file is usually the simpler operational route.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use replacement when a single predictable path matters and the VPS has enough available memory to drain the old area. Use addition when avoiding an interruption is more important, when a partition or original file must remain available, or when you want to increase capacity in stages. In either case, compare the requested size with free disk space before starting; every additional GiB is storage committed to swap rather than to applications, logs, updates, or backups.

Inspect the VPS before changing anything

Run the following commands as an administrator or through sudo:

free -h
swapon --show
cat /proc/swaps
grep -nE 'sswaps' /etc/fstab

free -h shows total, used, and available memory and the currently recognized swap total. swapon --show lists active swap areas, their type, size, and usage. cat /proc/swaps is a second view of what the kernel has actually activated. The grep command displays swap-related lines in /etc/fstab, the file used for boot-time activation.

Confirm the exact path before issuing swapoff. Do not assume the active area is /swapfile; it could have another name or be a partition. Also check disk capacity and leave headroom for the operating system, logs, package updates, and applications. A 4 GiB swap file consumes 4 GiB of VPS storage once fully allocated.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Replacing an active file is safest when the VPS has enough available memory to absorb pages currently in swap. If memory is already tight, schedule the change during a quiet period, stop nonessential workloads, or use the additional-file method instead. Keep an administrative session open while working so you can recover if a command reports an error.

Record the initial output before changing anything. It gives you a baseline for the old size, current usage, and number of active areas. Afterward, you can distinguish a successful increase from a configuration that merely left the old area active. It also helps identify an existing partition or a second file that would otherwise make the final total look larger than the file you created.

Replace an existing swap file with a larger one

The following sequence replaces an active /swapfile with a non-sparse 4 GiB file. If your inspection showed a different path, substitute that path consistently.

1. Disable the old swap area

sudo swapoff /swapfile

Wait for the command to return. If it fails because memory cannot accommodate the pages being moved, do not delete the file. Restore memory headroom by stopping or restarting a workload, or add and activate a second swap file first; then retry the replacement during a lower-pressure window. An active swap file must be disabled before it is removed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

2. Remove the old file

sudo rm -f /swapfile

This command removes only the file named in the command. Recheck the path if your existing swap area had a different name. Deleting a file that is still active is an operational mistake; always complete swapoff first.

3. Allocate a 4 GiB, non-sparse file

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 status=progress

Here, 4,096 blocks of 1 MiB produce a nominal 4 GiB file. The progress display can take time on a busy or low-performance VPS. This method writes the blocks rather than creating holes. The Ubuntu swapon documentation identifies dd with /dev/zero as the most portable way to create a swap file and warns against files with holes.

Do not substitute a fast allocation command without checking its filesystem behavior. A file that appears to have the requested logical size may contain unallocated holes, and swapon can reject it.

Adjust both count and the path for your target. The example uses MiB-sized blocks, so the count is the number of MiB to write. Make sure the resulting allocation fits the free space you measured; dd writes the file in full and can expose a storage limit before the rest of the setup is complete.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Restrict access to root

sudo chmod 600 /swapfile

Mode 600 allows only the owner, normally root, to read or write the file. Swap can contain pages from processes, so leaving it readable by other users is an avoidable exposure.

5. Write the swap signature

sudo mkswap /swapfile

mkswap formats the file as a swap area. It does not activate it. The command should report the file size and a generated swap identifier. If it warns that the file is not suitable, stop and correct the allocation rather than proceeding.

6. Activate the new file

sudo swapon /swapfile

The new area is now available to the kernel. The mkswap documentation explicitly requires a subsequent swapon command to start using a newly created swap area.

7. Make the change persistent

Edit /etc/fstab:

sudoedit /etc/fstab

Ensure it contains one line for the file:

/swapfile none swap sw 0 0

Remove or correct an obsolete line for the deleted file, and do not add duplicate lines for the same path. The entry tells Ubuntu to activate this file during boot. If an old entry already has exactly this path, keep one valid copy rather than appending another.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save the file only after checking the path and the fields. The first field must match the file you actually activated; the type is swap; and the options shown above are the standard sw activation options. A manually enabled file can work until reboot even when this line is missing, so persistence must be checked separately from immediate activation.

Add a second swap file instead

Use this method when you want to avoid disabling the original area for long, or when the VPS cannot comfortably move all swapped pages back into RAM. Choose a path that does not already exist; the example uses /swapfile2 and allocates 2 GiB.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
  1. Create a fully allocated file:

    sudo dd if=/dev/zero of=/swapfile2 bs=1M count=2048 status=progress
  2. Protect it from non-root users:

    sudo chmod 600 /swapfile2
  3. Initialize the swap area:

    sudo mkswap /swapfile2
  4. Activate it immediately:

    sudo swapon /swapfile2
  5. Add its boot-time entry:

    printf '/swapfile2 none swap sw 0 0n' | sudo tee -a /etc/fstab

After these commands, both files can appear in swapon --show. Keep one persistent /etc/fstab line for each intended swap area. Multiple areas are supported, but each additional file consumes disk capacity and adds another item to maintain.

Check that /swapfile2 was not already listed before using tee -a. Appending blindly can create duplicate boot entries. If you are unsure, inspect the file, add the line once with an editor, and then run the verification commands. The original area remains active, so the reported total should increase by the new file’s size rather than replace the old value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove an additional file later

Deactivate it before deleting it, then remove its persistent entry:

sudo swapoff /swapfile2
sudo rm /swapfile2
sudoedit /etc/fstab

In the editor, delete the /swapfile2 line. Removing only the file while leaving its line in /etc/fstab can cause boot-time activation errors.

Filesystem and allocation caveats

Why holes matter

A sparse or hole-filled file reports a logical length without reserving all of its blocks. The Ubuntu swapon manual warns: “You should not use swapon on a file with holes.” Depending on the filesystem and how the file was created, activation may fail immediately or the file may not provide the storage you expect. Writing the file with dd if=/dev/zero avoids this portability problem.

Why allocation commands differ by filesystem

fallocate can behave differently on ext4, XFS, and copy-on-write filesystems. The Ubuntu documentation calls out additional requirements for Btrfs and identifies dd as the portable fallback. If you do not know the VPS filesystem or its swap-file rules, use the documented dd sequence rather than assuming a fast allocation command is safe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This caveat matters even when a file listing shows the expected length. Logical size and physically allocated blocks are not always the same, which is precisely the condition that creates holes. The portable sequence trades speed for predictable allocation across the filesystems commonly encountered on VPS images.

Check capacity before writing

The file occupies VPS disk space, so verify that the requested size plus normal operating headroom fits. A failed dd may leave a partial file; remove that incomplete file only after confirming it is not active, then choose a smaller size or free storage.

Do not count swap as free application storage after the change. A larger file can help absorb memory pressure, but it permanently reserves that portion of the VPS disk while it exists. If the provider offers a separate disk or storage volume, that changes the capacity question, but the swap-file procedure itself still requires a correctly allocated file on a supported, writable filesystem.

Swap files versus swap partitions

Ubuntu supports a device as well as a regular file as a swap area. A provider may present a swap partition that appears in swapon --show without any /swapfile path. In that case, do not run file commands against the partition. mkswap can initialize a device, but expanding the partition generally requires changing the partition layout or requesting provider-level capacity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

When a VPS has free space inside an existing writable filesystem, adding a file avoids repartitioning and is usually the simpler operational route. The inspection commands tell you which arrangement you have before you make a destructive change.

Verify size, activation, and persistence

Run all three checks after replacing or adding a file:

swapon --show
cat /proc/swaps
free -h
  • swapon --show should list the expected path and size. With two files, both paths should appear.
  • cat /proc/swaps confirms the swap areas currently known to the kernel.
  • free -h should show the increased total swap in its Swap: row.

Then inspect /etc/fstab again and confirm exactly one valid line per intended swap area:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
grep -nE 'sswaps' /etc/fstab

A reboot test is an operational choice for the administrator. If you perform one, check swapon --show and free -h again after the VPS returns. The important condition is that the active paths, sizes, and persistent entries agree; a file that works only until the next reboot is not a complete configuration.

Compare the post-change total with your baseline, not just with the nominal count in the command. An existing partition or second file may already contribute swap. If the new path is absent, activation failed even if free -h still reports some swap. If the total is unexpectedly high, list every active area and remove only the one you intentionally no longer need.

Swappiness is a separate decision

Increasing the swap-file size does not automatically change how aggressively Ubuntu moves memory pages to swap. Ubuntu’s Swap FAQ records a default swappiness value of 60. Treat this as a separate workload-tuning choice rather than a required step in resizing.

Inspect the current value with:

sysctl vm.swappiness

A temporary change can be made with sudo sysctl vm.swappiness=<value>, replacing <value> with the value you intend to test. Observe memory pressure and disk I/O under the actual workload before deciding whether the change is beneficial. If it is deliberate and lasting, place it in an appropriate sysctl configuration file according to your operating procedure; do not confuse that setting with swap-file activation in /etc/fstab.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no need to alter swappiness merely because the file is larger. First establish that the additional capacity is active and persistent, then evaluate workload behavior. A size change and a policy change have different failure modes and should be rolled back independently if either causes undesirable memory or I/O behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

swapon: ... has holes or an invalid argument

The file was likely created sparsely or with a filesystem-specific allocation behavior. Disable it if necessary, recreate it with dd if=/dev/zero, apply mode 600, run mkswap, and activate it again. Do not work around the warning by repeatedly running swapon on the same unsuitable file.

swapoff cannot complete

The VPS may not have enough usable memory to move swapped pages back. Leave the old file intact, reduce workload pressure, or create and activate a second file first. Retrying during a quieter period is safer than forcing the removal of an active area.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

mkswap or swapon reports permission errors

Use sudo for administrative commands and verify the file is owned and protected appropriately. A swap file should normally be mode 600. Also check that the path is on a filesystem mounted read-write.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The VPS runs out of disk space during creation

Stop and inspect the partial file and available capacity. Do not add an /etc/fstab entry for a file that was not created successfully. Free storage or select a smaller swap size, while retaining headroom for the operating system and applications.

Swap works now but disappears after reboot

The file was activated manually but lacks a correct persistent entry. Add one line such as /swapfile none swap sw 0 0 for each intended file, remove stale or duplicate lines, and verify the active list after the next maintenance reboot.

The total swap is larger than expected

Inspect swapon --show and /proc/swaps for other files or partitions. The total includes every active swap area, not just the file you most recently created. Remove an unwanted area only with swapoff, deletion, and corresponding /etc/fstab cleanup.

The new file is present but not listed

Check each stage rather than repeating the whole procedure blindly. Confirm that mkswap completed, run swapon against the exact path, and inspect the resulting error. Then verify mode 600, available capacity, and whether the filesystem is writable. A correct /etc/fstab line does not activate a file immediately if the manual swapon step failed.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When more swap is not the real fix

Swap is a safety margin for memory pressure, not a substitute for adequate RAM. If the VPS continually uses swap, response times and disk I/O may suffer even after the file is enlarged. Use the inspection output and workload observations to decide whether the underlying need is more memory, fewer concurrent processes, or additional disk capacity. The swap procedure can prevent a sudden failure during a spike, but it does not make disk-backed pages perform like RAM.

Operational checklist

  • Confirm the active path with swapon --show before changing anything.
  • Record current memory and swap with free -h and cat /proc/swaps.
  • Check /etc/fstab for existing entries and avoid duplicates.
  • Verify free disk capacity and leave operating headroom.
  • For replacement, run swapoff before deleting the old file.
  • Create the new file with dd to avoid sparse-file problems.
  • Set mode 600, run mkswap, then swapon.
  • Persist each intended area with one matching /etc/fstab line.
  • Verify with swapon --show, cat /proc/swaps, and free -h.
  • Treat swappiness tuning independently from file-size changes.

Frequently Asked Questions

Can I resize an active Ubuntu swap file in place?

The reliable procedure is to run swapoff, remove the old file, create a new fully allocated file at the desired size, run mkswap, and enable it with swapon. If disabling the old area would create too much memory pressure, add a second file instead.

Is adding a second swap file safe?

Yes. Ubuntu supports multiple swap areas. Give the new file a distinct path, use mode 600, initialize and activate it, and add one separate /etc/fstab line. Remember that every active file consumes disk capacity.

Why does Ubuntu reject my swap file as having holes?

The file is sparse or was allocated in a filesystem-specific way that leaves unallocated regions. Recreate it with dd if=/dev/zero; Ubuntu documents that method as the most portable and warns against files with holes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does increasing swap increase RAM?

No. Swap uses VPS disk storage and is slower than physical memory. It can absorb memory spikes, but persistent memory pressure may indicate that the VPS needs more RAM or a workload change.

What should be in /etc/fstab for a swap file?

For the example path, use one line: /swapfile none swap sw 0 0. Keep exactly one valid line for each intended swap area, remove stale entries, and verify after a reboot if you choose to test boot persistence.

Do I need to change swappiness after enlarging swap?

No. File size and swappiness are separate settings. Ubuntu’s documented default is 60. Inspect the current value with sysctl vm.swappiness and change it only after observing the workload’s memory and I/O behavior.

The Bottom Line

Confirm the current swap paths and /etc/fstab first. Replace an active file only after swapoff, or add a second file when memory pressure makes replacement risky. Allocate the file fully with dd, secure it with mode 600, run mkswap and swapon, then keep one matching /etc/fstab entry per swap area. Finish by checking swapon --show, /proc/swaps, and free -h; more swap provides disk-backed headroom, not more RAM.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.