环境 Redhat 7.2 ,示例:
新添加一个swap分区
============要求:================================
swap 分区容量为 512 MiB
当您的系统启动时,swap 分区应该可以自动挂载
不要移除或者修改其他已经存在于您的系统中的 swap 分区
================================================
1、先查看一下目前系统中使用的swap分区,我的是只有一个,现在我要再添加个, 容量是512M的。。。
[root@desktop ~]# swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 2047996 0 -1
2、用分区工具重新划分一个容量为512M的分区,逻辑分区主分区都可以,推荐使用逻辑分区。。。
[root@desktop ~]# fdisk /dev/sda
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/sda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x000bffad
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 20482047 10240000 83 Linux
/dev/sda2 20482048 24578047 2048000 82 Linux swap / Solaris
/dev/sda3 24578048 25602047 512000 83 Linux
Command (m for help): n -->使用n新建分区
Partition type:
p primary (3 primary, 0 ex