一文搞懂linux中swap分区的创建与使用

本文详细介绍了如何在Linux系统中创建和使用swap分区。通过`fdisk`命令进行分区,设置分区类型为Linux swap,然后使用`mkswap`格式化,最后编辑`/etc/fstab`进行永久挂载。作者强调了swap激活的重要性,并分享了一套全面的Linux运维学习资料。
摘要由CSDN通过智能技术生成

-/+ buffers/cache: 747 232

Swap: 0 0 0 # 可以看到现在是没有swap空间的

开始创建swap分区

=========================================================================

分区


[root@server0 ~]# fdisk /dev/sdb 【硬盘根据实际情况选择】

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): p【打印】

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x229e658e

Device Boot Start End Blocks Id System

/dev/sdb1 2048 10487807 5242880 8e Linux LVM

Command (m for help): n【创建分区】

Partition type:

p primary (1 primary, 0 extended, 3 free)

e extended

Select (default p): p【主分区】

Partition number (2-4, default 2): 【直接回车即可】

First sector (10487808-20971519, default 10487808): 【选择开始块,直接回车即可】

Using default value 10487808

Last sector, +sectors or +si

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值