raid – Ubuntu 18.04, 1.5G Swap 100% used (32G RAM), soft RAID1. How to increase SWAP size?

I have a production server, recently, I have seen server becomes slow sometimes, and SSH is slow, and once get into the terminal, even press ENTER is slow.

When the server is OK, I checked the memory usage and CPU, CPU looks fine, RAM looks fine except SWAP is 100% used. I googled it seems SWAP should not be 100% used, maybe 50%.

So I would like to increase the SWAP size. But since this is a production server, and it has soft RAID1 configured, so I don’t want to mess it up until I am sure it is absolutely correct.

Here are the server configs:

CPU is E3-1245-V2, 32G RAM, 3x2T HDD

top command result:

top - 05:33:54 up 2 days, 13:45,  1 user,  load average: 2.43, 2.43, 2.50
Tasks: 243 total,   1 running, 165 sleeping,   0 stopped,   0 zombie
%Cpu(s): 28.4 us,  0.6 sy,  0.0 ni, 69.0 id,  1.7 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem : 32893852 total,   278960 free, 28153624 used,  4461268 buff/cache
KiB Swap:  1569780 total,        0 free,  1569780 used.  4226648 avail Mem 

df -h result:

Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  1.5M  3.2G   1% /run
/dev/md3         20G  7.4G   11G  41% /
tmpfs            16G     0   16G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/md2        487M  148M  310M  33% /boot
/dev/md4        1.8T  536G  1.2T  32% /home
tmpfs           3.2G     0  3.2G   0% /run/user/1000

cat /proc/mdstat result:

Personalities : (raid1) (raid0) (raid6) (raid5) (raid4) (linear) (multipath) (raid10) 
md4 : active raid1 sdb4(1) sdc4(2) sda4(0)
      1931981760 blocks (3/3) (UUU)
      bitmap: 5/15 pages (20KB), 65536KB chunk

md2 : active raid1 sda2(0) sdb2(1) sdc2(2)
      523200 blocks (3/3) (UUU)
md3 : active raid1 sda3(0) sdb3(1) sdc3(2)
      20478912 blocks (3/3) (UUU)
unused devices: <none>

sudo swapon --show result:

/dev/sdb5 partition 511M 511M   -2
/dev/sdc5 partition 511M 511M   -3
/dev/sda5 partition 511M 511M   -4

I was going to follow this tutorial but I am afraid since I have soft raid1 here, I am not sure if the instructions above still apply, or it should work.


unity – Trying to set up a simple swapping system to swap two game pieces using a button press

I am trying to set up a system that will move two objects. This is a puzzle game with a cursor to visualize where the player is. I need to get the position of the cursor’s left and right half, send that to a function that will then switch the two blocks when a key is pressed.

I have code that will move the cursor around but cannot figure out how to swap two blocks based on the position of the cursor.

I do not know if the code that is currently attached to the cursor will be of any help, but I can provide if necessary.

I am more or less looking for a general solution that I could apply to swapping two blocks.

I do not know if I need to be sending the positions of the cursor to the swap function in order to swap. How would I connect this to the tiles themselves? The code below is located in the board classv2 class. I am not very good with Unity as of yet. Any additional help would be appreciated.

 void Update()
        if (Input.GetButtonUp("Swap"))
            swapTiles(cursorLeft.transform.position.x, cursorRight.transform.position.x);

void swapTiles(float x1, float x2)


Game pieces are created and have an x and y number associated with a game board I created.

The Game pieces have a move routine. I can’t seem to get the pieces to actually swap.

public void Move(int destX, int destY, float timeToMove)
    if (!m_isMoving)
        StartCoroutine(MoveRoutine(new Vector3(destX, destY, 0), timeToMove));

//Moves the piece.
IEnumerator MoveRoutine(Vector3 destination, float timeToMove)
    Vector3 startPosition = transform.position;

    bool reachedDestination = false;

    float elapsedTime = 0f;

    m_isMoving = true;

    while (!reachedDestination)
        //if we are close enough to destination
        if (Vector3.Distance(transform.position, destination) < 0.01f)
            reachedDestination = true;

            if(m_board != null)
                m_board.PlaceGamePiece(this, (int)destination.x, (int)destination.y);

        //track the total running time
        elapsedTime += Time.deltaTime;

        //calculate the lerp value
        float t = Mathf.Clamp(elapsedTime / timeToMove,0f,1f);

        switch (interpolation)
            case InterpType.Linear:
            case InterpType.EaseOut:
                Mathf.Sin(t * Mathf.PI * 0.5f);
            case InterpType.EaseIn:
                t = 1 - Mathf.Cos(t * Mathf.PI * 0.5f);
            case InterpType.SmoothStep:
                t = t * t * (3 - 2 * t);
            case InterpType.SmootherStep:
                t = t * t * t * (t * (t * 6 - 15) + 10);

        //move the game piece
        transform.position = Vector3.Lerp(startPosition, destination, t);

        //wait until next frame
        yield return null;
    m_isMoving = false;

(!(Cursor is in the Bottom Left.)(1))(1)

software engineering – Building a unified interface for a swap chain in both DirectX 12 and Vulkan

Most objects in DirectX 12 have natural analogues in Vulkan, e.g.

  • VkInstance = IDXGIFactory
  • VkPhysicalDevice = IDXGIAdapter
  • VkDevice = ID3D12Device
  • VkQueue = ID3D12CommandQueue
  • VkCommandBuffer = ID3D12CommandList

However, when it comes to the swap chain, it’s not clear how the entries in VkSwapchainCreateInfoKHR correspond to entries in DXGI_SWAP_CHAIN_DESC1.

Clearly, there is not always a 1-1 correspondence, but I would really like to know how I can implement a unified interface for both.

dnd 3.5e – Can I swap a maneuver known with another one if I have te requisite before the swap but stop having it after?

The Tome of Battle states the following:

Upon reaching 4th level, and at every even-numbered swordsage level
after that (6th, 8th, 10th, and so on), you can choose to learn a new
maneuver in place of one you already know. In effect, you lose the old
maneuver in exchange for the new one. You can choose a new maneuver of
any level you like, as long as you observe your restriction on the
highest- level maneuvers you know; you need not replace the old
maneuver with a maneuver of the same level. For example, upon reaching
10th level, you could trade in a single 1st-, 2nd-, 3rd- or 4th-level
maneuver for a maneuver of 5th level or lower, as long as you meet the
prerequisite of the new maneuver. You can swap only a single maneuver
at any given level.

So, let’s say my PC (Monk 4, Swordsage 4) has Mighty Throw as his only Setting Sun maneuver and wants to swap it at level 4 with Devastating Throw. He accomplishes the requisite of having 1 Setting Sun maneuver before the swap, however, he no longer accomplishes the requisite after the swap (unless you count the Devastating Throw itself). Is this swap possible?

swap – AMD Optane alternative

I want to have an Optane features with my Ryzen build: high TBW and high I/O. Disk space irrelevant (like MEMPEK1W032GA, 32GB will be enough for me). And it would be nice if I can utilize the full power of my free PCIe 4.0 line. Now I have an PCIe 3.0 x4 NVMe 0.5TB main disk and that’s enough for my data, but with Optane-like disk I can speed up caches (Swap / L2ARC / ZIL / pagefile.sys / etc.) and don’t torture limited resource of my current disk. What can I use?

Yes, I know that Optane is full hardware feature (not only PCIe, but also chipset and CPU). But anyway…

usability – What is the purpose of a swap button in an airline booking app?

It’s to save the user time from having to re-input values.

I’ve heard it called a swap button, but that’s informal.

This is a common pattern in applications where a trip is being planned (or en route). It allows users to quickly reverse the start and end destinations.

enter image description here

The principle behind it is more important to know: don’t make users do more work than they need to.

Ubuntu 20.04 has problems to wake up from suspend when swap is turned off

I have a fresh install with dual boot Windows and encrypted home directory and I am running into this problem. Anytime I disable the swap file in /etc/fstab my laptop loses the ability to suspend or to wake up from suspend.

It either fails to suspend – restarting instead, or becomes unresponsive after suspending, or the keyboard is not working.

Has anyone had similar problems? Any idea what can be going on?

python 3.x – how do I swap around characters from a given string?

def swap_adj(string):
    if len(string) % 2 == 1: 
        string = string(:-1)
        string = string
        for i in range (0, len(string), 2): print(string(i)+string(i+1), end= " ")    

I want the program to swap around each pair of 2 characters so if I inputted (abcdef) as the argument, then it would output (badcfe). Can’t seem to figure out the problem.

keyboard – How to swap Ctrl and Function key?

I’m trying to swap Ctrl and Fn on Catalina without downloading a new app. As suggested in multiple articles, I tried going to System Preferences > Keyboard > keyboard > Modifier Keys.. in hopes to simply swap the function of two keys. However, Fn is missing from the list of modifier keys. Am I missing something here? Do I need to do something else to make Fn key show up there?