人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

Linux添加swap分區(qū)的方法

發(fā)布日期:2022-03-30 16:27 | 文章來源:gibhub

建立一個普通的Linux分區(qū)(主分區(qū)、邏輯分區(qū)均可)

fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 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 identifier: 0x740e36e3
  Device Boot   Start     End   Blocks  Id System
/dev/sdb1       63   4194367   2097152+ 83 Linux
/dev/sdb2     4194368  16777215   6291424  5 Extended
/dev/sdb5     4194431   8388735   2097152+ 83 Linux
/dev/sdb6     8388799  16777215   4194208+ 83 Linux

以sdb6為例,可以看到分區(qū)的十六進制編碼是83,即普通的Linux分區(qū)。

修改分區(qū)類型的十六進制編碼

//t命令:改寫分區(qū)十六進制編碼
Command (m for help): t 
Partition number (1-6): 6
//L命令可以查看不同分區(qū)的十六進制編碼,交換分區(qū)為82
Hex code (type L to list codes): 82
Changed system type of partition 6 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 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 identifier: 0x740e36e3
  Device Boot   Start     End   Blocks  Id System
/dev/sdb1       63   4194367   2097152+ 83 Linux
/dev/sdb2     4194368  16777215   6291424  5 Extended
/dev/sdb5     4194431   8388735   2097152+ 83 Linux
/dev/sdb6     8388799  16777215   4194208+ 82 Linux swap / Solaris
//分區(qū)表寫入磁盤并退出
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

格式化交換分區(qū)

mkswap /dev/sdb6
Setting up swapspace version 1, size = 4194204 KiB
no label, UUID=40eff2c0-3f6b-440e-bc2a-f71d3d5581a7

啟用交換分區(qū)

swapon /dev/sdb6

查看交換分區(qū)加載狀態(tài)

free
       total    used    free   shared  buffers   cached
Mem:    1030108   160768   869340    264   12040   56188
-/+ buffers/cache:   92540   937568
Swap:   6291352     0  6291352

停用交換分區(qū)

swapoff /dev/sdb6

p.s.

不能直接使用mount命令掛載swap分區(qū),因為swap分區(qū)是沒有掛載點的。

直接修改/etc/fstab配置文件,使系統(tǒng)啟動時自動掛載:

/dev/sdb6        swap          swap  defaults    0 0
//查看交換分區(qū)
 swapon -s
Filename        Type    Size  Used  Priority
/dev/sda2                partition  2097148 0  -1
/dev/sdb6                partition  4194204 0  -2

總結(jié)

以上所述是小編給大家介紹的Linux添加swap分區(qū)的方法,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時回復(fù)大家的!

版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部