首页 > 代码库 > linux补充挂载swap分区
linux补充挂载swap分区
linux补充挂载swap分区
机房的一台新装cento,top发现没有swap分区,看来机房初装系统有问题。
[root@LAX ~]# top top - 18:26:53 up 3:41, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 213 total, 1 running, 212 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.9%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 16324896k total, 259328k used, 16065568k free, 5984k buffers Swap: 0k total, 0k used, 0k free, 26932k cached
可以看到,Swap 为 0k
查看该服务器系统盘分区情况:
[root@LAX ~]# parted /dev/sda GNU Parted 2.1 Using /dev/sda Welcome to GNU Parted! Type ‘help‘ to view a list of commands. (parted) p Model: ATA ST33000650NS (scsi) Disk /dev/sda: 3001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 316MB 315MB ext4 2 316MB 4510MB 4194MB raid 3 4510MB 3001GB 2996GB ext4
换一台也是刚安装的服务器对比一下:
[root@usa178 ~]# parted /dev/sda GNU Parted 2.1 Using /dev/sda Welcome to GNU Parted! Type ‘help‘ to view a list of commands. (parted) p Model: ATA ST33000650NS (scsi) Disk /dev/sda: 3001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 106MB 105MB ext4 2 106MB 8495MB 8389MB linux-swap(v1) 3 8495MB 3001GB 2992GB ext
看来是第二分区没分区,分区挂载试试
[root@LAX ~]# mkswap /dev/sda2 Setting up swapspace version 1, size = 4095996 KiB no label, UUID=d713cc10-10dc-42d0-b152-c6eecbcd6579 #UUID=d713cc10-10dc-42d0-b152-c6eecbcd6579 [root@LAX ~]# swapon /dev/sda2 [root@LAX ~]# top top - 18:35:24 up 3:49, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 212 total, 1 running, 211 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 98.5%id, 1.3%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 16324896k total, 262768k used, 16062128k free, 6100k buffers Swap: 4095996k total, 0k used, 4095996k free, 27000k cached
成功了,Swap: 4095996k total
最后放到/etc/fstab中,确保重启后可正常使用
[root@LAX ~]# cat /etc/fstab UUID=356d4065-9613-490e-a22f-f7c1a7b85d84 / ext4 defaults 1 1 UUID=cb053b9d-9ef8-48e3-8227-683c62d937f6 /boot ext4 defaults 1 2 UUID=d713cc10-10dc-42d0-b152-c6eecbcd6579 swap swap defaults 0 0 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=/data2 /data2 ext4 defaults 0 0
本文出自 “福州恒达电脑” 博客,请务必保留此出处http://fzhddn.blog.51cto.com/12650899/1917073
linux补充挂载swap分区
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。