(轉) linux下增加swap分割槽
方法一
一、檢視系統當前的分割槽情況:
>free -m
二、建立用於交換分割槽的檔案:
>dd if=/dev/zero of=/whatever/swap bs=block_size count=number_of_block
三、設定交換分割槽檔案:
>mkswap /whatever/swap
四、立即啟用交換分割槽檔案:
>swapon /whateever/swap
五、若要想使開機時自啟用,則需修改檔案/etc/fstab中的swap行:
/whatever/swap swap swap defaults 0 0
方法二
增加交換分割槽空間的方法:
1.檢視一下/etc/fstab確定目前的分割槽
2.swapoff /dev/hd**
3.free 看一下是不是停了.
4.fdisk 刪了停掉的swap分割槽
5.重新用FDISK建一個新的SWAP分割槽
6.mkswap /dev/hd**把新的分割槽做成swap
7.swapon /dev/hd**開啟swap
8.修改/etc/fstab
操作例項:
1.檢視系統Swap空間使用
# free
total used free shared buffers cached
Mem: 513980 493640 20340 0 143808 271780
-/+ buffers/cache: 78052 435928
Swap: 1052248 21256 1030992
2.在空間合適處建立swap檔案
# mkdir swap
# cd swap
# dd if=/dev/zero of=swapfile bs=1024 count=10000
10000+0 records in
10000+0 records out
# ls -al
total 10024
drwxr-xr-x 2 root root 4096 7月 28 14:58 .
drwxr-xr-x 19 root root 4096 7月 28 14:57 ..
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB
3.啟用swap檔案
# swapon swapfile
# ls -l
total 10016
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
# free
total used free shared buffers cached
Mem: 513980 505052 8928 0 143900 282288
-/+ buffers/cache: 78864 435116
Swap: 1062240 21256 1040984
生成1200M的檔案
# dd if=/dev/zero of=swapfile bs=1024 count=1317000
建立為swap檔案
#mkswap swapfile
讓swap生效
#swapon swapfile
檢視一下swap
#swapon -s
Filename Type Size Used Priority
/dev/sda3 partition 8024 2504 -3
/var/swapfile file 1316992 0 -4
加到fstab檔案中讓系統引導時自動啟動
#vi /etc/fstab
/var/swapfile swap swap defaults 0 0
在Linux下增加Swap區
1.檢視系統Swap空間使用
# free
total used free shared buffers cached
Mem: 513980 493640 20340 0 143808 271780
-/+ buffers/cache: 78052 435928
Swap: 1052248 21256 1030992
2.在空間合適處建立swap檔案
# mkdir swap
# cd swap
# dd if=/dev/zero of=swapfile bs=1024 count=10000
10000+0 records in
10000+0 records out
# ls -al
total 10024
drwxr-xr-x 2 root root 4096 7月 28 14:58 .
drwxr-xr-x 19 root root 4096 7月 28 14:57 ..
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
z
# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB
3.啟用swap檔案
# swapon swapfile
# ls -l
total 10016
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
# free
total used free shared buffers cached
Mem: 513980 505052 8928 0 143900 282288
-/+ buffers/cache: 78864 435116
Swap: 1062240 21256 1040984
#[@more@]
一、檢視系統當前的分割槽情況:
>free -m
二、建立用於交換分割槽的檔案:
>dd if=/dev/zero of=/whatever/swap bs=block_size count=number_of_block
三、設定交換分割槽檔案:
>mkswap /whatever/swap
四、立即啟用交換分割槽檔案:
>swapon /whateever/swap
五、若要想使開機時自啟用,則需修改檔案/etc/fstab中的swap行:
/whatever/swap swap swap defaults 0 0
方法二
增加交換分割槽空間的方法:
1.檢視一下/etc/fstab確定目前的分割槽
2.swapoff /dev/hd**
3.free 看一下是不是停了.
4.fdisk 刪了停掉的swap分割槽
5.重新用FDISK建一個新的SWAP分割槽
6.mkswap /dev/hd**把新的分割槽做成swap
7.swapon /dev/hd**開啟swap
8.修改/etc/fstab
操作例項:
1.檢視系統Swap空間使用
# free
total used free shared buffers cached
Mem: 513980 493640 20340 0 143808 271780
-/+ buffers/cache: 78052 435928
Swap: 1052248 21256 1030992
2.在空間合適處建立swap檔案
# mkdir swap
# cd swap
# dd if=/dev/zero of=swapfile bs=1024 count=10000
10000+0 records in
10000+0 records out
# ls -al
total 10024
drwxr-xr-x 2 root root 4096 7月 28 14:58 .
drwxr-xr-x 19 root root 4096 7月 28 14:57 ..
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB
3.啟用swap檔案
# swapon swapfile
# ls -l
total 10016
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
# free
total used free shared buffers cached
Mem: 513980 505052 8928 0 143900 282288
-/+ buffers/cache: 78864 435116
Swap: 1062240 21256 1040984
生成1200M的檔案
# dd if=/dev/zero of=swapfile bs=1024 count=1317000
建立為swap檔案
#mkswap swapfile
讓swap生效
#swapon swapfile
檢視一下swap
#swapon -s
Filename Type Size Used Priority
/dev/sda3 partition 8024 2504 -3
/var/swapfile file 1316992 0 -4
加到fstab檔案中讓系統引導時自動啟動
#vi /etc/fstab
/var/swapfile swap swap defaults 0 0
在Linux下增加Swap區
1.檢視系統Swap空間使用
# free
total used free shared buffers cached
Mem: 513980 493640 20340 0 143808 271780
-/+ buffers/cache: 78052 435928
Swap: 1052248 21256 1030992
2.在空間合適處建立swap檔案
# mkdir swap
# cd swap
# dd if=/dev/zero of=swapfile bs=1024 count=10000
10000+0 records in
10000+0 records out
# ls -al
total 10024
drwxr-xr-x 2 root root 4096 7月 28 14:58 .
drwxr-xr-x 19 root root 4096 7月 28 14:57 ..
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
z
# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB
3.啟用swap檔案
# swapon swapfile
# ls -l
total 10016
-rw-r--r-- 1 root root 10240000 7月 28 14:58 swapfile
# free
total used free shared buffers cached
Mem: 513980 505052 8928 0 143900 282288
-/+ buffers/cache: 78864 435116
Swap: 1062240 21256 1040984
#[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70612/viewspace-1021765/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux下增加swap分割槽Linux
- Linux 增加 swap 分割槽Linux
- Linux系統中增加Swap分割槽大小Linux
- Linux 建立swap分割槽Linux
- linux新增swap分割槽Linux
- 再談Linux下的swap分割槽薦Linux
- FreeBSD和Linux共享swap分割槽(轉)Linux
- Linux系統中增加Swap分割槽檔案步驟方法Linux
- linux中增加swap分割槽或檔案的步驟方法Linux
- Linux下swap(交換分割槽)的增刪改Linux
- swap分割槽的知識(轉)
- Linux系統中管理Swap分割槽Linux
- Linux SWAP 交換分割槽配置說明Linux
- Linux系統如何進行分割槽?swap分割槽是什麼?Linux
- 不用swap分割槽,用交換檔案(轉)
- Linux 分割槽擴容(根分割槽擴容,SWAP 分割槽擴容,掛載新分割槽為目錄)Linux
- Linux Swap交換分割槽介紹總結Linux
- swap分割槽新增刪除
- 擴充套件redhat linux as 5 的swap分割槽套件RedhatLinux
- 用檔案新增Swap分割槽
- Linux下硬碟分割槽的最佳方案 (轉)Linux硬碟
- Linux下硬碟分割槽的最佳方案(轉)Linux硬碟
- 虛擬塊硬碟,新增點swap分割槽空間(轉)硬碟
- 【實驗】【PARTITION】RANGE分割槽表增加分割槽
- linux 增加swap大小!Linux
- 談Linux分割槽(轉)Linux
- Linux與分割槽 (轉)Linux
- 《RHEL6硬碟的分割槽和swap分割槽管理》——硬碟分割槽的大總結硬碟
- 雲端計算:交換分割槽管理 Swap
- 用檔案作為Swap分割槽
- Linux下恢復硬碟分割槽資料(轉)Linux硬碟
- redhat linux swap分割槽擴充套件的三種方法RedhatLinux套件
- 【Linux】Linux檔案系統管理4 swap交換分割槽管理Linux
- Oracle分割槽表基礎運維-07增加分割槽(2 HASH分割槽)Oracle運維
- Linux與硬碟分割槽(轉)Linux硬碟
- Linux增加swap空間Linux
- Oracle分割槽表基礎運維-07增加分割槽(1範圍分割槽)Oracle運維
- 全面學習分割槽表及分割槽索引(8)--增加和收縮表分割槽索引