偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

linux下分區(qū)與加密詳解

運維 系統(tǒng)運維
Linux是一類Unix計算機操作系統(tǒng)的統(tǒng)稱。Linux操作系統(tǒng)的內(nèi)核的名字也是“Linux”。如何對linux系統(tǒng)進行分區(qū)和分區(qū)加密呢?下文給出了詳細的描述。

Linux是一類Unix計算機操作系統(tǒng)的統(tǒng)稱。Linux操作系統(tǒng)的內(nèi)核的名字也是“Linux”。如何對linux系統(tǒng)進行分區(qū)和分區(qū)加密呢?下文給出了詳細的描述。

redhat企業(yè)6中有強大的圖形分區(qū)工具,這里我分享下我所了解的通過命令行對磁盤進行分區(qū)

1、分區(qū)

 

  1. [root@burvis~]#fdisk/dev/sda  
  2.  
  3. WARNING:DOS-compatiblemodeisdeprecated.It'sstronglyrecommendedto  
  4.  
  5. switchoffthemode(command'c')andchangedisplayunitsto  
  6.  
  7. sectors(command'u').  
  8.  
  9. Command(mforhelp):  
  10.  

 

這里如果你用虛擬機的話可以用#fdisk-cu/dev/vda

這里我用虛擬機作演示

我們先按m獲取幫助

 

  1. Commandaction  
  2.  
  3. atoggleabootableflag  
  4.  
  5. beditbsddisklabel  
  6.  
  7. ctogglethedoscompatibilityflag  
  8.  
  9. ddeleteapartition  
  10.  
  11. llistknownpartitiontypes  
  12.  
  13. mprintthismenu  
  14.  
  15. naddanewpartition  
  16.  
  17. ocreateanewemptyDOSpartitiontable  
  18.  
  19. pprintthepartitiontable  
  20.  
  21. qquitwithoutsavingchanges  
  22.  
  23. screateanewemptySundisklabel  
  24.  
  25. tchangeapartition'ssystemid  
  26.  
  27. uchangedisplay/entryunits  
  28.  
  29. vverifythepartitiontable  
  30.  
  31. wwritetabletodiskandexit  
  32.  
  33. xextrafunctionality(expertsonly)  
  34.  

 

這里主要用到的有

n新建一個分區(qū)

d刪除一個分區(qū)

t改變分區(qū)類型(進去后按l可以查看所有類型)

p查看分區(qū)狀況

w寫入并退出

q退出不寫入

m獲取幫助

接下來我們p查看分區(qū)信息

 

  1. Command(mforhelp):p  
  2.  
  3. Disk/dev/vda:6442MB,6442450944bytes  
  4.  
  5. 16heads,63sectors/track,12483cylinders,total12582912sectors  
  6.  
  7. Units=sectorsof1*512=512bytes 
  8.  
  9. Sectorsize(logical/physical):512bytes/512bytes  
  10.  
  11. I/Osize(minimum/optimal):512bytes/512bytes  
  12.  
  13. Diskidentifier:0x0008f7fd  
  14.  
  15. DeviceBootStartEndBlocksIdSystem  
  16.  
  17. /dev/vda1*204852633526214483Linux  
  18.  
  19. /dev/vda2526336991436746940168eLinuxLVM  
  20.  

 

按n新建一個分區(qū)

 

  1. Command(mforhelp):p  
  2.  
  3. Disk/dev/vda:6442MB,6442450944bytes  
  4.  
  5. 16heads,63sectors/track,12483cylinders,total12582912sectors  
  6.  
  7. Units=sectorsof1*512=512bytes 
  8.  
  9. Sectorsize(logical/physical):512bytes/512bytes  
  10.  
  11. I/Osize(minimum/optimal):512bytes/512bytes  
  12.  
  13. Diskidentifier:0x0008f7fd  
  14.  
  15. DeviceBootStartEndBlocksIdSystem  
  16.  
  17. /dev/vda1*204852633526214483Linux  
  18.  
  19. /dev/vda2526336991436746940168eLinuxLVM  
  20.  

 

這里按e為擴展分區(qū),p為主分區(qū)

我們建一個擴展分區(qū)

輸入e

選擇第三個分區(qū)

選擇起始點,可以直接回車選擇默認

選擇終止點,這里可以像我一樣用+1G,表示給1G的空間,或者可以直接輸入終止點的位置

 

  1. e  
  2.  
  3. Partitionnumber(1-4):3  
  4.  
  5. Firstsector(9914368-12582911,default9914368):  
  6.  
  7. Usingdefaultvalue9914368  
  8.  
  9. Lastsector,+sectorsor+size{K,M,G}(9914368-12582911,default12582911):+1G  
  10.  

 

我們再輸入p看一下分區(qū)信息

 

  1. DeviceBootStartEndBlocksIdSystem  
  2.  
  3. /dev/vda1*204852633526214483Linux  
  4.  
  5. /dev/vda2526336991436746940168eLinuxLVM  
  6.  
  7. /dev/vda399143681201151910485765Extended  
  8.  

 

然后我們再到擴展分區(qū)中去新建分區(qū)

按n

 

  1. Command(mforhelp):n  
  2.  
  3. Commandaction  
  4.  
  5. llogical(5orover)  
  6.  
  7. pprimarypartition(1-4)  
  8.  
  9. l  
  10.  
  11. Firstsector(9916416-12011519,default9916416):  
  12.  
  13. Usingdefaultvalue9916416  
  14.  
  15. Lastsector,+sectorsor+size{K,M,G}(9916416-12011519,default12011519):+200M  
  16.  

 

這里選擇l,我們給他200M的空間

輸入p再看下分區(qū)信息。

 

  1. Command(mforhelp):p  
  2.  
  3. Disk/dev/vda:6442MB,6442450944bytes  
  4.  
  5. 16heads,63sectors/track,12483cylinders,total12582912sectors  
  6.  
  7. Units=sectorsof1*512=512bytes 
  8.  
  9. Sectorsize(logical/physical):512bytes/512bytes  
  10.  
  11. I/Osize(minimum/optimal):512bytes/512bytes  
  12.  
  13. Diskidentifier:0x0008f7fd  
  14.  
  15. DeviceBootStartEndBlocksIdSystem  
  16.  
  17. /dev/vda1*204852633526214483Linux  
  18.  
  19. /dev/vda2526336991436746940168eLinuxLVM  
  20.  
  21. /dev/vda399143681201151910485765Extended  
  22.  
  23. /dev/vda599164161032601520480083Linux  
  24.  

 

ok,我們已經(jīng)分出了一個200M的分區(qū),按w寫入并退出

這個時候我們可以ll一下/dev/vda*

發(fā)現(xiàn)之前分出的vda3與vda5沒有顯示

這里我們用以下partx刷新添加

 

  1. [root@burvis~]#partx-a/dev/vda  
  2.  
  3. BLKPG:Deviceorresourcebusy  
  4.  
  5. erroraddingpartition1  
  6.  
  7. BLKPG:Deviceorresourcebusy  
  8.  
  9. erroraddingpartition2  
  10.  

 

我們在ll一下可以看到已經(jīng)出來了

 

  1. [root@server27~]#ll/dev/vda  
  2.  
  3. vdavda1vda2vda3vda5  
  4.  

 

接下來我們就可以對我們的分區(qū)進行加密了

2、分區(qū)加密

這是對新分區(qū)進行加密,并設置密碼

這里要注意的地方是大小寫

 

  1. [root@burvis~]#cryptsetupluksFormat/dev/vda5  
  2.  
  3. WARNING!  
  4.  
  5. ========  
  6.  
  7. Thiswilloverwritedataon/dev/vda5irrevocably.  
  8.  
  9. Areyousure?(Typeuppercaseyes):YES//YES一定要大寫  
  10.  
  11. EnterLUKSpassphrase://密碼  
  12.  
  13. Verifypassphrase://確認密碼  
  14.  

 

這個時候我們的分區(qū)已經(jīng)被加密,我們要使用必須先解密

這里通過luksOpen來進行解密后面‘burvis’可以寫隨意的名字,然后會將加密卷/dev/vda5解鎖為/dev/mapper/burvis,之后,我們用的都是/dev/mapperburvis了,而不是/dev/vda5

 

  1. [root@burvis~]#cryptsetupluksOpen/dev/vda5burvis  
  2.  
  3. Enterpassphrasefor/dev/vda5://輸入密碼  
  4.  

 

然后對解密的卷進行格式化

 

  1. [root@server27~]#mkfs.ext4/dev/mapper/burvis  
  2.  

 

接下來就是把分區(qū)掛載到我們的系統(tǒng)上

我們可以建一個掛載的目錄,然后把分區(qū)掛上去

 

  1. [root@burvis~]#mkdir/burvis  
  2.  
  3. [root@burvis~]#mount/dev/mapper/burvis/burvis  
  4.  

 

現(xiàn)在我們可以df一下

 

  1. [root@server27~]#df  
  2.  
  3. Filesystem1K-blocksUsedAvailableUse%Mountedon  
  4.  
  5. /dev/mapper/vgsrv-root  
  6.  
  7. 3418812225069299445270%/  
  8.  
  9. tmpfs5107602605105001%/dev/shm  
  10.  
  11. /dev/vda12538713035821040613%/boot  
  12.  
  13. /dev/mapper/vgsrv-home  
  14.  
  15. 253871102682304965%/home  
  16.  
  17. /dev/mapper/burvis19633956461805564%/burvis  
  18.  

 

當我們用完我們的加密分區(qū)后,就可以卸載它然后再鎖住,這樣數(shù)據(jù)就又會保護起來

我們要先卸載我們掛上去的分區(qū),然后再鎖住,如果不能鎖住,可以嘗試下把掛載目錄刪了

 

  1. [root@burvis~]#umount/dev/mapper/burvis  
  2.  
  3. [root@burvis~]#cryptsetupluksCloseburvis  
  4.  

 

如果下次先再用,就重復luksOpen就可以了

鑒于開機自動掛載加密分區(qū)不安全,沒有什么意義,這里就不多加介紹,只附上我的筆記

永久掛載

修改fstab

/dev/mapper/name/*************

編輯/etc/crypttab

vi/etc/crypttab

name/dev/vda*這樣子開機會要求輸入密碼

如果不想輸入密碼

先編輯一個密碼放置的文件比如/root/name

 

  1. #vi/etc/crypttab  
  2.  
  3. name/dev/vda*/root/name  
  4.  
  5. #echo密碼>/root/name  
  6.  
  7. #chownroot/roo/name  
  8.  
  9. #chmod600/root/name  
  10.  
  11. #cryptsetupluksAddKey/dev/vda*/root/name  
  12.  

 

要求輸入密碼

完成

總結(jié):

希望本文介紹的linux系統(tǒng)進行分區(qū)與加密的方法能夠?qū)ψx者有所幫助,更多有關(guān)linux操作系統(tǒng)的知識還有待于讀者去探索和學習。

【編輯推薦】

  1. 自己動手創(chuàng)建最精簡的Linux
  2. 嵌入式Linux驅(qū)動程序開發(fā)要點
  3. Linux內(nèi)核中如何增加自己的驅(qū)動代碼?
  4. windows和linux(ubuntu)雙系統(tǒng)如何進行引導恢復?
  5. windowsXP和UbuntuLinux雙系統(tǒng)下卸載Linux系統(tǒng)的方法
責任編輯:韓亞珊 來源: 博客轉(zhuǎn)載
相關(guān)推薦

2014-06-09 10:09:31

Linux磁盤分區(qū)

2010-08-05 11:03:55

創(chuàng)建分區(qū)文件系統(tǒng)

2014-06-06 13:51:36

磁盤分區(qū)IO分析

2011-08-10 14:51:46

LinuxLVM分區(qū)

2011-01-10 13:40:35

linux硬盤分區(qū)

2009-11-24 09:28:11

linux分區(qū)大磁盤分區(qū)

2009-03-06 16:21:59

LinuxTestdisk修復軟件

2009-11-30 09:56:16

2009-11-11 10:24:10

linuxecho命令詳解

2021-01-14 07:53:09

Linuxlsof 命令

2011-08-16 17:19:59

linux加密分區(qū)

2021-11-22 16:51:40

LinuxBitlockerWindows

2009-01-09 22:52:16

服務器硬盤Linux

2012-05-10 10:10:19

Linuxfdisk

2018-12-10 09:00:00

Linux加密分區(qū)dm-crypt

2023-05-18 09:01:11

MBRGPT分區(qū)

2009-10-15 10:02:39

linuxyum命令詳解

2020-07-09 08:09:21

Linuxdiff命令

2011-08-17 11:13:57

MySQL 5.5truncate分區(qū)

2010-01-05 13:28:23

Linux分區(qū)
點贊
收藏

51CTO技術(shù)棧公眾號