linux增大SWAP分区

有两种方式:
第一种:分区
1、创建一个分区并将分区改为Linux swap / Solaris
# fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652): +500M
Command (m for help): p
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 62 497983+ 83 Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 62 497983+ 82 Linux swap / Solaris
Command (m for help): w
2、# mkswap /dev/sdb1
3、# swapon -a /dev/sdb1
4、在/etc/fstab 中加入
/dev/sdb1 swap swap defaults 0 0
第二种:文件
1、生成一个500M的文件
dd if=/dev/zero of=/swapfile bs=10M count=50
2、mkswap /swapfile
3、swapon /swapfile
4、在/etc/fstab 中加入
/swapfile swap swap defaults 0 0
相关查看命令:
free
swapon -s
cat /proc/swaps
关闭命令
swapoff /swapfile swapoff /dev/sdb1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值