增加SWAP的大小


建立512M的檔案swaptest。
    # dd if=/dev/zero of=/swaptest bs=1024 count=524288

    524288+0 records in
    524288+0 records out
    536870912 bytes (537 MB) copied, 6.971 s, 77.0 MB/s

設定 /swaptest 為 swap,參數-f為force
    # mkswap -f /swaptest

    Setting up swapspace version 1, size = 524284 KiB
    no label, UUID=c65946cf-6c09-431a-a884-1015bdaec7bf

先檢查目前swap的大小
    #free |grep Swap

Swap:      2097144          0    2097144 <-- swap的容量為2G

啟用 /swaptest
    # swapon /swaptest

再檢查swap的大小
    #free |grep Swap

Swap:      2621424          0    2621424  <--增加了256MB

關閉 /swaptest
    #swapoff /swaptest

如果想永遠都使用swap檔案,則編輯 /etc/fstab 加入以下設定:
/swaptest swap swap defaults 0 0

Windows 11安裝時跳過網路連線