linux建立swap分區

來源:互聯網
上載者:User

標籤:

#基於磁碟的
# 將分區轉換成交換分區#1、格式化交換分區[mkswap][[email protected] /]# mkswap /dev/sda5 Setting up swapspace version 1, size = 106889 kB[[email protected] /]# freetotal used free shared buffers cachedMem: 1026816 577392 449424 0 29772 343960-/+ buffers/cache: 203660 823156Swap: 2064344 0 2064344#2、啟用交換分區[swapon][[email protected] /]# swapon /dev/sda5 [[email protected] /]# freetotal used free shared buffers cachedMem: 1026816 577448 449368 0 29792 343960-/+ buffers/cache: 203696 823120Swap: 2168724 0 2168724[[email protected] /]##3、關閉交換分區[swapoff][[email protected] ~]# swapoff /dev/sda5# 設定磁碟巻標[[email protected] auto]# e2label /dev/sda5 sky# 查看巻標[[email protected] auto]# e2label /dev/sda5sky# 根據巻標查看硬碟[[email protected] auto]# findfs LABEL=skyfindfs: Unable to resolve ‘LABEL=sky‘

 

#基於檔案的建立一個分區添加分頁檔#mkdir -p /opt/temp#dd -if =/dev/zero of=/opt/temp/swap bs=1024 count=2048000然後: 建立交換空間#mkswap /opt/temp/swap啟動新增加的2G交換空間#swapon /opt/temp/swap#free -m查看已經可以看到新增的空間了swap-3修改/etc/fstab,使新加的2G交換空間在系統重新啟動後自動生效#echo "/opt/temp/swap swap swap defaults 0 0" >>/etc/fstab

 

參考:http://blog.csdn.net/robertkun/article/details/8522889

        http://www.syscto.com/2014/07/448.html

 



linux建立swap分區

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.