交换文件和交换分区

交换分区步骤说明:新建分区-类型选择swap类型—>kpartx –a /dev/sda5àmkswapàblkid /dev/sda5àswapon –help—>/etc/fstab

命令解释:

[root@yangcan ~]# swapon --help 

Usage:
 swapon -a [-e] [-v] [-f]             enable all swaps from /etc/fstab
 swapon [-p priority] [-v] [-f] <special>  enable given swap
 swapon -s                            display swap usage summary
 swapon -h                            display help
 swapon -V                            display version 

The <special> parameter:
 {-L label | LABEL=label}             LABEL of device to be used
 {-U uuid  | UUID=uuid}               UUID of device to be used
 <device>                             name of device to be used
 <file>                               name of file to be used

 

1.      新建分区:

Command (m for help): n
First cylinder (3005-3916, default 3005):
Using default value 3005
Last cylinder, +cylinders or +size{K,M,G} (3005-3916, default 3916): +1G

Command (m for help): p 

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00092856 

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              39        2354    18598912   83  Linux
/dev/sda3            2354        2611     2064384   82  Linux swap / Solaris
/dev/sda4            2611        3916    10483750    5  Extended
/dev/sda5            2611        2742     1053563+  83  Linux
Command (m for help): t
Partition number (1-7): 5
Hex code (type L to list codes): 82
Changed system type of partition 5 to 82 (Linux swap / Solaris) 

Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00092856
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              39        2354    18598912   83  Linux
/dev/sda3            2354        2611     2064384   82  Linux swap / Solaris
/dev/sda4            2611        3916    10483750    5  Extended
/dev/sda5            2611        2742     1053563+  82  Linux swap / Solaris
 

2.      格式化/dev/sd5swap分区类型

交换文件和交换分区

 

交换文件和交换分区

 

3.      验证,已经挂载成功


4.      修改Priority ,优先级的值在0-32767,值越高,优先级越高。

  -p, --priority priority

              Specify the priority of the swap device.  priority is a value between  0  and  32767.  Higher  numbers  indicate  higher  priority.  See

              swapon(2) for a full description of swap priorities. Add pri=value to the option field of /etc/fstab for use with swapon -a.

交换文件和交换分区

 

5.      交换文件

交换文件和交换分区

 

6.      修改交换文件的优先级

交换文件和交换分区

 

交换文件和交换分区

PS:需要注意的是,每新增交换分区或者交换文件的时候,priority都会发生变化,所有一新增,就需修改priority

 

你可能感兴趣的:(swap,交换分区,交换文件)