在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

Swap不足怎么办

187次阅读
没有评论

共计 5093 个字符,预计需要花费 13 分钟才能阅读完成。

这篇文章主要为大家展示了“Swap 不足怎么办”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让丸趣 TV 小编带领大家一起研究并学习一下“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 不足怎么办”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注丸趣 TV 行业资讯频道!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-25发表,共计5093字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 久久久www免费看片 久久久www免费人成精品 | 国产高清久久99 | 乱人伦一区二区三区 | 中文在线观看视频 | 社区天堂| 888午夜不卡理论久久 | 久久久久依人综合影院 | 青草视频.com | 亚洲色偷偷色噜噜狠狠99网 | 日韩 欧美 中文 | 又粗又粗又黄又硬又深色的 | www.91在线播放| 九九久久国产精品免费热6 九九久久精品 | 国产亚洲成av人片在线观看 | 无码人妻精品一区二区三区不卡 | 成人在线免费观看网站 | 成人免费xxxxx在线观看 | 日韩在线二区 | 久久超碰97人人做人人爱 | 亚洲欧美日韩高清中文在线 | 欧美人妻精品一区二区三区 | 国产人成精品免费视频 | 国语对白嫖老妇胖老太 | 黄色成人小视频 | 亚洲男人的天堂在线aⅴ视频 | 无码色av一二区在线播放 | 免费观看成人欧美1314www | 欧美a级毛毛片免费视频试播 | 久草中文在线视频 | 精品久久久久中文字幕一区 | 色先锋影院 | 99热最新在线 | 亚洲成av人片在线观看无码不卡 | 草久视频在线 | 亚洲一区欧美一区 | 无遮无挡爽爽免费毛片 | 四虎免费久久影院 | 午夜视频免费在线播放 | 香蕉成人伊视频在线观看 | 亚洲精品视频在线看 | 思思久而久焦人 |