前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布

swap

作者头像
零月
发布2018-04-25 14:22:22
1.1K0
发布2018-04-25 14:22:22
举报
文章被收录于专栏:从零开始的linux从零开始的linux
  • Swap分区,即交换分区,系统在物理内存不够时,与Swap进行交换。

# free -m

total used free shared buffers cached

Mem: 981 178 802 0 19 49

-/+ buffers/cache: 109 871

Swap: 2047 0 2047

创建一个swap分区

代码语言:javascript
复制
# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to         switch off the mode (command 'c') and change display units to         sectors (command 'u'). Command (m for help): p Disk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0007187a    Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          26      204800   83  LinuxPartition 1 does not end on cylinder boundary./dev/sda2              26        1301    10240000   83  Linux/dev/sda3            1301        1562     2097152   82  Linux swap / Solaris/dev/sda4            1562        1693     1056046+  83  Linux Command (m for help): tPartition number (1-4): 4Hex code (type L to list codes): 82Changed system type of partition 4 to 82 (Linux swap / Solaris) Command (m for help): p Disk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0007187a    Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          26      204800   83  LinuxPartition 1 does not end on cylinder boundary./dev/sda2              26        1301    10240000   83  Linux/dev/sda3            1301        1562     2097152   82  Linux swap / Solaris/dev/sda4            1562        1693     1056046+  82  Linux swap / Solaris Command (m for help): wThe partition table has been altered!
代码语言:javascript
复制
# partx -a  /dev/sdaBLKPG: Device or resource busyerror adding partition 1BLKPG: Device or resource busyerror adding partition 2BLKPG: Device or resource busyerror adding partition 3BLKPG: Device or resource busyerror adding partition 4# mkswap /dev/sda4Setting up swapspace version 1, size = 1056040 KiBno label, UUID=99e1751e-a38c-4f56-b80f-d80e7148608b# swapon /dev/sda4 # free -m             total       used       free     shared    buffers     cachedMem:           981        180        800          0         19         50-/+ buffers/cache:        110        870 Swap:         3079          0       3079 
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-04-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始的linux 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
对象存储
对象存储(Cloud Object Storage,COS)是由腾讯云推出的无目录层次结构、无数据格式限制,可容纳海量数据且支持 HTTP/HTTPS 协议访问的分布式存储服务。腾讯云 COS 的存储桶空间无容量上限,无需分区管理,适用于 CDN 数据分发、数据万象处理或大数据计算与分析的数据湖等多种场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档