• 要找福利?记不住网址?搜不到?如何与我们保持联系?试试 CTRL+D 把零点博客添加进您的浏览器收藏夹,一键直达永不失联!

磁盘维护Linux swapoff命令

linux系统 涛涛 80次浏览 0个评论

Linux swapoff命令用于关闭系统交换区(swap area)。

swapoff实际上为swapon的符号连接,可用来关闭系统的交换区。

语法

<span class="pln">swapoff </span><span class="pun">[设备]</span>

参数:

  • -a 将/etc/fstab文件中所有设置为swap的设备关闭
  • -h 帮助信息
  • -V 版本信息

实例

显示分区信息:

<span class="com"># sfdisk -l //显示分区信息</span>

<span class="typ">Disk</span> <span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sda</span><span class="pun">:</span> <span class="lit">1305</span><span class="pln"> cylinders</span><span class="pun">,</span> <span class="lit">255</span><span class="pln"> heads</span><span class="pun">,</span> <span class="lit">63</span><span class="pln"> sectors</span><span class="pun">/</span><span class="pln">track
</span><span class="typ">Units</span> <span class="pun">=</span><span class="pln"> cylinders of </span><span class="lit">8225280</span><span class="pln"> bytes</span><span class="pun">,</span><span class="pln"> blocks of </span><span class="lit">1024</span><span class="pln"> bytes</span><span class="pun">,</span><span class="pln"> counting </span><span class="kwd">from</span> <span class="lit">0</span>

  <span class="typ">Device</span> <span class="typ">Boot</span> <span class="typ">Start</span>   <span class="typ">End</span>  <span class="com">#cyls  #blocks  Id System</span>
<span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sda1  </span><span class="pun">*</span>   <span class="lit">0</span><span class="pun">+</span>   <span class="lit">12</span>   <span class="lit">13</span><span class="pun">-</span>  <span class="lit">104391</span>  <span class="lit">83</span> <span class="typ">Linux</span>
<span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sda2     </span><span class="lit">13</span>  <span class="lit">1304</span>  <span class="lit">1292</span>  <span class="lit">10377990</span>  <span class="lit">8e</span> <span class="typ">Linux</span><span class="pln"> LVM
</span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sda3     </span><span class="lit">0</span>    <span class="pun">-</span>    <span class="lit">0</span>     <span class="lit">0</span>  <span class="lit">0</span> <span class="typ">Empty</span>
<span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sda4     </span><span class="lit">0</span>    <span class="pun">-</span>    <span class="lit">0</span>     <span class="lit">0</span>  <span class="lit">0</span> <span class="typ">Empty</span>

<span class="typ">Disk</span> <span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sdb</span><span class="pun">:</span> <span class="lit">652</span><span class="pln"> cylinders</span><span class="pun">,</span> <span class="lit">255</span><span class="pln"> heads</span><span class="pun">,</span> <span class="lit">63</span><span class="pln"> sectors</span><span class="pun">/</span><span class="pln">track

sfdisk</span><span class="pun">:</span><span class="pln"> ERROR</span><span class="pun">:</span><span class="pln"> sector </span><span class="lit">0</span><span class="pln"> does </span><span class="kwd">not</span><span class="pln"> have an msdos signature
</span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sdb</span><span class="pun">:</span><span class="pln"> unrecognized partition
</span><span class="typ">No</span><span class="pln"> partitions found</span>

关闭交换分区。

<span class="com"># swapoff /dev/sda2 // 关闭交换分区</span>

欢迎转载本文:磁盘维护Linux swapoff命令
喜欢 (0)
[ld]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址