分区中的交换文件问题不起作用

分区中的交换文件问题不起作用

我无法增加交换文件大小,我在网上看了很多文章,也尝试了下面的方法,但最后只显示 2GB。这是我尝试过的方法。请给我一个解决方案,或者我做错了什么。

 mds@sefat:/$ sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 status=progress
    8282701824 bytes (8.3 GB, 7.7 GiB) copied, 5 s, 1.7 GB/s
    8192+0 records in
    8192+0 records out
    8589934592 bytes (8.6 GB, 8.0 GiB) copied, 5.14598 s, 1.7 GB/s
    mds@sefat:/$ ls
    bin    etc    lib64   opt      run   studio-3t-linux-x64.sh  usr
    boot   home   libx32  Postman  sbin  swapfile                var
    cdrom  lib    media   proc     snap  sys
    dev    lib32  mnt     root     srv   tmp
    mds@sefat:/$ sudo chmod 600 /swapfile
    mds@sefat:/$ sudo mkswap /swapfile
    Setting up swapspace version 1, size = 8 GiB (8589930496 bytes)
    no label, UUID=dbd5b35c-c016-488c-aa09-ff90708bc1ed
    mds@sefat:/$ swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/nvme0n1p2 partition   2G   2G   -2
    mds@sefat:/$ sudo dd if=/dev/nvme0n1p2 of=/swapfile bs=1M count=8192 status=progress
    1863319552 bytes (1.9 GB, 1.7 GiB) copied, 4 s, 466 MB/s
    2048+0 records in
    2048+0 records out
    2147483648 bytes (2.1 GB, 2.0 GiB) copied, 4.7347 s, 454 MB/s
    mds@sefat:/$ swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/nvme0n1p2 partition   2G   2G   -2
    mds@sefat:/$ sudo dd if=/dev/nvme0n1p2 of=/swapfile bs=1M count=8192 status=progress
    1987051520 bytes (2.0 GB, 1.9 GiB) copied, 4 s, 497 MB/s
    2048+0 records in
    2048+0 records out
    2147483648 bytes (2.1 GB, 2.0 GiB) copied, 4.335 s, 495 MB/s
    mds@sefat:/$ swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/nvme0n1p2 partition   2G   2G   -2
    mds@sefat:/$ 

相关内容