91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Swap不足怎么辦

發布時間:2021-10-26 15:58:57 來源:億速云 閱讀:129 作者:小新 欄目:建站服務器

這篇文章主要為大家展示了“Swap不足怎么辦”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“Swap不足怎么辦”這篇文章吧。

1. 使用dd命令新建一個文件并掛載為SWAP

    Use command 'dd' to create a file and mount as swap

---------------------------------------------------------------------------------

[root@localhost ~]# free -m

             total       used       free     shared    buffers     cached

Mem:          5966        334       5631          0         16         99

-/+ buffers/cache:        218       5747

Swap:         6143          0       6143

[root@localhost ~]# dd if=/dev/zero of=/root/swap bs=1024 count=1024000

1024000+0 records in

1024000+0 records out

1048576000 bytes (1.0 GB) copied, 3.20295 s, 327 MB/s

bs=是bytes,count是 blocks 個塊,1024bytes=1K,1024000K=1000M

[root@localhost ~]#  mkswap /root/swap

mkswap: /root/swap: warning: don't erase bootbits sectors

        on whole disk. Use -f to force.

Setting up swapspace version 1, size = 1023996 KiB

no label, UUID=af12e46f-16da-4b89-a89f-301bdce4b138

[root@localhost ~]# swapon /root/swap

[root@localhost ~]# free -m

             total       used       free     shared    buffers     cached

Mem:          5966       1604       4361          0         21       1217

-/+ buffers/cache:        365       5600

Swap:         7143          0       7143

與最開始的相比,增加了近1000M

---------------------------------------------------------------------------------

2. 用 fdisk 將未使用的分區格式化,并掛載為swap分區

   use 'fdisk' to format other partitions and mount as swap

--------------------------------------------------------------------------------

[root@localhost ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        2078    16587112+  83  Linux
/dev/sda3            2079        2600     4192965   82  Linux swap / Solaris
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        2078    16587112+  83  Linux
/dev/sda3            2079        2600     4192965   82  Linux swap / Solaris
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First cylinder (2601-2610, default 2601):
Using default value 2601
Last cylinder or +size or +sizeM or +sizeK (2601-2610, default 2610): +50M   ---新增加個50M的擴展分區。

                                                                                                                             ---add a extend partition of 50M
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        2078    16587112+  83  Linux
/dev/sda3            2079        2600     4192965   82  Linux swap / Solaris
/dev/sda4            2601        2607       56227+   5  Extended
Command (m for help): n
First cylinder (2601-2607, default 2601):
Using default value 2601
Last cylinder or +size or +sizeM or +sizeK (2601-2607, default 2607):
Using default value 2607

Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        2078    16587112+  83  Linux
/dev/sda3            2079        2600     4192965   82  Linux swap / Solaris
/dev/sda4            2601        2607       56227+   5  Extended
/dev/sda5            2601        2607       56196   83  Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@bys3 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2013        218       1795          0         15        153
-/+ buffers/cache:         49       1964
Swap:         5094          0       5094
[root@bys3 ~]# swapoff /root/swap   關閉一個SWAP空間

                                                              off a swap space
[root@bys3 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2013        218       1795          0         15        153
-/+ buffers/cache:         49       1964
Swap:         4094          0       4094
[root@bys3 ~]# mkswap /dev/sda5
/dev/sda5: No such file or directory
[root@bys3 ~]#  partprobe    ---同步分區表

                                                     sync of partition table
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.
Segmentation fault
[root@bys3 ~]# mkswap /dev/sda5
Setting up swapspace version 1, size = 57540 kB
[root@bys3 ~]# swapon /dev/sda5
[root@bys3 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2013        218       1795          0         15        153
-/+ buffers/cache:         49       1964
Swap:         4149          0       4149

---------------------------------------------------------------------------------

開機自動掛載

auto mount during boot process

--------------------------------------------------------------------------------

[root@localhost ~]#  vi /etc/fstab 

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda3         swap                    swap    defaults        0 0 
/root/swap              swap                    swap    defaults                   -------dd 掛載方式(dd mount)

/dev/sda5               swap                    swap    defaults        0 0       -------格式化掛載方式(formatting partition mount)

[root@localhost ~]# mount -a              ---------無報錯則掛載成功(No errors then mount succeed)

以上是“Swap不足怎么辦”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

灵宝市| 高平市| 剑河县| 瑞金市| 洛川县| 荃湾区| 达州市| 浠水县| 乌苏市| 沂水县| 威信县| 镇安县| 康保县| 建昌县| 深圳市| 沾化县| 博罗县| 荔浦县| 龙山县| 咸宁市| 宁津县| 北票市| 根河市| 奈曼旗| 开鲁县| 通州区| 双桥区| 盐城市| 中西区| 年辖:市辖区| 凌云县| 溧水县| 赞皇县| 阳朔县| 姜堰市| 抚宁县| 林州市| 南宫市| 昭觉县| 柯坪县| 平陆县|