首页
学习
活动
专区
圈层
工具
发布

swap

作者头像
零月
发布2018-04-25 14:22:22
发布2018-04-25 14:22:22
1.6K0
举报
文章被收录于专栏:从零开始的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 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档