centos7磁盤邏輯分區命令_CentOS7 磁盤分區(主分區、擴展分區和邏輯分區)的創建、掛載與刪除...

創建磁盤分區

查看磁盤分區情況:fdisk -l

[root@model ~]# fdisk -l //查看系統中所有磁盤的分區列表

Disk/dev/sda: 107.4 GB, 107374182400 bytes, 209715200sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x000da34bDevice Boot Start End Blocks Id System/dev/sda1 * 2048 591871 294912 83Linux/dev/sda2 591872 189335551 94371840 83Linux/dev/sda3 189335552 209715199 101898248e Linux LVM

Disk/dev/sdb: 1099.5 GB, 1099511627776 bytes, 2147483648sectors //sdb磁盤未分區,1099.5GB

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x3238f946Device Boot Start End Blocks Id System

Disk/dev/mapper/centos-swap: 8334 MB, 8334082048 bytes, 16277504sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 65536 bytes / 65536 bytes

創建主分區

[root@model ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remaininmemory only, until you decide to write them.

Be careful beforeusingthe write command.

Command (mforhelp): m //查看菜單信息

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

g create anewempty GPT partition table

G create an IRIX (SGI) partition table

l list known partition types

m printthismenu

n add anewpartition

o create anewempty DOS partition table

p print the partition table

q quit without saving changes

s create anewempty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (mforhelp): n //新增分區

Partition type:

p primary (0 primary, 0 extended, 4free) //主分區

e extended //擴展分區

Select (defaultp): p

Partition number (1-4, default 1): 1 //選擇分區號,范圍為1~4(主分區和擴展分區加起來最多只能建立 4 個,而擴展分區最多只能建立 1 個),這里選擇1

First sector (2048-2147483647, default 2048): 2048 //分區的起始扇面,默認從2048開始Last sector,+sectors or +size{K,M,G} (2048-2147483647, default 2147483647): +10G //指定該磁盤分區的大小,默認占用整個磁盤;這里用 +size{K,M,G} 命令指定 10G

Partition1 of type Linux and of size 10 GiB is setCommand (mforhelp): p //打印當前磁盤的分區列表

Disk/dev/sdb: 1099.5 GB, 1099511627776 bytes, 2147483648sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x3238f946Device Boot Start End Blocks Id System/dev/sdb1 2048 20973567 10485760 83Linux

Command (mforhelp): w //將本次配置寫入硬盤

The partition table has been altered!Calling ioctl() to re-read partition table.

Syncing disks.

[root@model ~]# lsblk? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //lsblk 列表查看block分區

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

fd0 2:0 1 4K 0 disk

sda 8:0 0 100G 0 disk

├─sda1 8:1 0 288M 0 part /boot

├─sda2 8:2 0 90G 0 part /

└─sda3 8:3 0 9.7G 0 part

├─centos-pool00_tmeta 253:0 0 8M 0 lvm

│ └─centos-pool00-tpool 253:2 0 7.8G 0 lvm

│ ├─centos-swap 253:3 0 7.8G 0 lvm [SWAP]

│ └─centos-pool00 253:4 0 7.8G 1 lvm

└─centos-pool00_tdata 253:1 0 7.8G 0 lvm

└─centos-pool00-tpool 253:2 0 7.8G 0 lvm

├─centos-swap 253:3 0 7.8G 0 lvm [SWAP]

└─centos-pool00 253:4 0 7.8G 1 lvm

sdb 8:16 0 1T 0 disk

└─sdb1 8:17 0 10G 0 part? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//找到新建的分區/dev/sdb1

sr0 11:0 1 1024M 0 rom

新建的分區還沒有格式化和掛載,所以還不能使用。用上述方法依次創建2、3號主分區,并預留4號分區作為擴展分區。

創建擴展分區

[root@model ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //新建分區

Partition type:

p primary (3 primary, 0 extended, 1 free)

e extended

Select (default e): e? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //選擇擴展分區

Selected partition 4

First sector (62916608-2147483647, default 62916608):? ? ? ? ? ? //默認起始扇面

Using default value 62916608

Last sector, +sectors or +size{K,M,G} (62916608-2147483647, default 2147483647):? ? ? ?//默認將剩余全部空間分配給該擴展分區

Using default value 2147483647

Partition 4 of type Extended and of size 994 GiB is set

Command (m for help): w? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //將本次設置寫入磁盤

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

這里把 /dev/sdb 硬盤的所有剩余空間都建立為擴展分區,也就是建立 3 個主分區,剩余空間都建立成擴展分區,再于擴展分區中建立邏輯分區。擴展分區是不能被格式化和直接使用的,所以還要在擴展分區內部再建立邏輯分區。

創建邏輯分區

[root@model ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remaininmemory only, until you decide to write them.

Be careful beforeusingthe write command.

Command (mforhelp): n //新建分區

All primary partitions areinuse

Adding logical partition5 //所有主分區已分配完,默認新建邏輯分區,從分區號從 5 開始First sector (62918656-2147483647, default 62918656): //起始扇面

Usingdefault value 62918656Last sector,+sectors or +size{K,M,G} (62918656-2147483647, default 2147483647): +5G //指定邏輯分區的大小為 5G

Partition5 of type Linux and of size 5 GiB is setCommand (mforhelp): w //保存設置

The partition table has been altered!Calling ioctl() to re-read partition table.

Syncing disks.

所有分區過程中如果不保存并退出是不會生效的,所以建立錯了也沒有關系,使用 q 命令不保存退出即可。如果使用了 w 命令,就會保存退出。有時因為系統的分區表正忙,所以需要重新啟動系統才能使新的分區表生效。

格式化分區

[root@model ~]# mkfs.xfs /dev/sdb1 //將分區/dev/sdb1的文件類型格式化為xfs

mke2fs1.42.9 (28-Dec-2013)

Filesystem label=OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0blocks655360 inodes, 2621440blocks131072 blocks (5.00%) reserved forthe super user

First data block=0Maximum filesystem blocks=2151677952

80block groups32768 blocks per group, 32768fragments per group8192inodes per group

Superblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632Allocating group tables: done

Writing inode tables: done

Creating journal (32768blocks): done

Writing superblocks and filesystem accounting information: done------------- 修改磁盤分區的文件類型 -----------------[root@model~]# blkid /dev/sdb6 //查看 /dev/sdb6 的 UUID 和 文件類型/dev/sdb6: UUID="89f4f8e4-0592-4e91-9064-7388152fec32" TYPE="xfs"[root@model~]# mkfs.ext4 /dev/sdb6 //將邏輯分區的文件類型從 xfs 修改為 ext4, 如果是從 ext4 修改為 xfs 需要在 命令后加 ‘-f’ 強制修改

mke2fs1.42.9 (28-Dec-2013)

Filesystem label=OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0blocks327680 inodes, 1310720blocks65536 blocks (5.00%) reserved forthe super user

First data block=0Maximum filesystem blocks=1342177280

40block groups32768 blocks per group, 32768fragments per group8192inodes per group

Superblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736Allocating group tables: done

Writing inode tables: done

Creating journal (32768blocks): done

Writing superblocks and filesystem accounting information: done

[root@model~]# blkid /dev/sdb6/dev/sdb6: UUID="846373a4-35b0-4988-9574-a508da3906f2" TYPE="ext4"

掛載磁盤分區

[root@model ~]# mount /dev/sdb1 /usr/exdata1 //將 /dev/sdb1 磁盤分區掛載到新建的掛載點 /usr/exdata1 上

[root@model~]# df -T -h | grep /dev/sdb1 //查看 該分區是否已掛載

Filesystem Type Size Used Avail Use%Mounted on

/dev/sdb1 ext4 9.8G 37M 9.2G 1% /usr/exdata1

[root@model~]# vim /etc/fstab //修改fstab配置文件,將該磁盤分區設置為開機自動掛載

# Add command by Kay.sunin 2020/9/29 16:58 //在配置文件中添加一行命令

/dev/sdb1 /usr/exdata1 xfs defaults 1 2 ///dev/sdb1 選擇一個分區;xfs 是當前分區的格式; defaults = rw, suid, dev, exec, auto, nouser, and async; 1 需要 dump;0 不需要 dump; 2 開機時檢查順序,非 boot 文件系統為 1,其它文件系統都為 2

[root@model~]# df -h | grep /dev/sdb1//重啟后再次查看分區掛載情況,發現已經自動掛載~]# umount /usr/

刪除磁盤分區

[root@model ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remaininmemory only, until you decide to write them.

Be careful beforeusingthe write command.

Command (mforhelp): d //刪除分區

Partition number (1-6, default 6): 6 //選擇待刪除的分區號Partition6 isdeletedCommand (mforhelp): w //保存設置

The partition table has been altered!Calling ioctl() to re-read partition table.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/534737.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/534737.shtml
英文地址,請注明出處:http://en.pswp.cn/news/534737.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

php使用webservivce_JWS服務開發使用指南

均支持該版本&#xff0c;主要你的web.xml文件中必須制定2.5版本xmlversion"1.0"encoding"UTF-8"?><web-appxmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xmlns"http://java.sun.com/xml/ns/javaee"xmlns:web"ht…

android sdk是灰的,Android Studio 2.3 sdk管理器標簽灰顯

Android Studio 2.3 - >配置 - > SDK管理器。 這些選項卡呈灰色顯示&#xff1a; SDK工具&#xff0c;SDK更新站點。此外&#xff0c;“Show Package Details”復選框呈灰色。 系統正常更新。沒有錯誤消息。Android Studio 2.3 sdk管理器標簽灰顯我認為這發生在Studio 2.…

android layer陰影,Android Layer-List實現自定義Shape陰影

一、給右側和底層加陰影android:left"2dp"android:top"2dp">android:angle"270"android:endColor"#0F000000"android:startColor"#0F000000" />android:bottomLeftRadius"6dip"android:bottomRightRadius&q…

localdatetime 默認時間_java中的時間與時區:LocalDateTime和Date

LocalDateTimeLocalDateTime本身不包含時區信息&#xff0c;它存儲的是年、月、日、時分秒&#xff0c;納秒這樣的數字。在不同的時區下&#xff0c;這樣的數字代表不同的時間。比如一個LocalDateTime存儲2020-01-01 08&#xff1a;00&#xff1a;00&#xff0c;這里省略納秒。…

html 拖拽坐標,Html+css實現拖拽導航條

div橫向拖拽排序body, div {padding: 0px;margin: 0px;}.box {position: relative;margin-left: 15px;padding: 10px;padding-right: 0px;width: 810px;border: blue solid 1px;}.box ul{list-style: none;overflow: hidden;padding: 0;margin:0;}.drag {float: left;border: #…

seata 如何開啟tcc事物_微服務分布式事務4種解決方案實戰

分布式事務分布式事務是指事務的參與者&#xff0c;支持事務的服務器&#xff0c;資源服務器分別位于分布式系統的不同節點之上&#xff0c;通常一個分布式事物中會涉及到對多個數據源或業務系統的操作。典型的分布式事務場景&#xff1a;跨銀行轉操作就涉及調用兩個異地銀行服…

python redis 哨兵_Redis哨兵機制

概述上篇文章主要說了Redis 復制的內容&#xff0c;但 Redis 復制有一個缺點&#xff0c;當主機 Master 宕機以后&#xff0c;我們需要人工解決切換&#xff0c;比如使用slaveof no one 。實際上主從復制并沒有實現&#xff0c;高可用&#xff0c; 高可用側重備份機器&#xff…

labview自動生成html,使用LabVIEW實現網頁數據提取及交互.pptx

使用 LabVIEW 控制IE或WebBrowser實現網頁數據的提取和交互By GSD&#xff1a;attraction - 張生斌2013.1.11可能會遇到的問題網頁能否被程序控制&#xff0c;程序和網頁如何通信&#xff1f;如何下載網頁中我們所關注的數據&#xff1f;如何用程序修改網頁中表單的內容&#x…

pdf python定位_如何使用PyPDF2獲取PDF定位

我正在使用Python/Django。PyPDF2閱讀我目前的pdf。如何使用PyPDF2獲取PDF定位我想閱讀我已經保存的pdf文件&#xff0c;并獲得pdf內單頁的方向。我期望能夠確定頁面是橫向還是縱向。tempoutpdffilelocation settings.TEMPLATES_ROOT nameOfFinalPdfpageOrientation pageToE…

android 內容顯示欄,android – 在工具欄下顯示內容

您好我試圖簡單地將我的內容放在工具欄下面,但是當我運行我的應用程序時,當它應該低于它時,一些內容隱藏在它后面.我已經閱讀了關于使用框架布局來嘗試將其分開但我已經陷入困境.我目前正在使用隨軟件提供的基本android studio導航抽屜模板,并想知道我必須做出哪些更改.我的協調…

ios nslog 例子_iOS 典型內存泄露案例 - zhenshan2013的個人空間 - 51Testing軟件測試網 51Testing軟件測試網-軟件測試人的精神家園...

最近進行iOS 安全黑匣子的測試,在Demo中通過不斷的點擊調加密接口,同時通過蘋果自帶instrument的leak工具監控,發現典型的內存泄漏,監控圖如下:上圖中紅色的部分表示該操作觸發的代碼有內存泄漏的可能,于是拿出源代碼來研究一番,源代碼如下://加密接口-(IBAction)encrypt:(id)s…

HTML餅狀圖中心添加文字,echarts餅狀圖環形中間動態文字

let currName "";let myChart echarts.getInstanceByDom(document.getElementById(‘chart-panel‘));//console.log(myChart);myChart.on(‘mouseover‘, (params) >{currNameparams.name;console.log(params)let opmyChart.getOption();let _label{normal:{sho…

pos共識機制_OK區塊鏈60講 | 第17集:什么是PoS共識機制

什么是PoS共識機制https://www.zhihu.com/video/1196092110837805056《OK區塊鏈60講》是由OKEx&#xff06;新浪科技聯合出品的區塊鏈科普動畫視頻&#xff0c;針對區塊鏈零基礎用戶&#xff0c;通過系列文章、科普動畫等形式&#xff0c;從概念、技術、應用等角度&#xff0c;…

html溢出左右滾動,html-選項卡溢出時水平滾動

我在容器中有一個基本表。 該表將包含約25列。 我正在嘗試在表格溢出時添加水平滾動條&#xff0c;現在過得很艱難。現在正在發生的情況是&#xff0c;表格單元格通過自動調整單元格的高度并保持固定的表格寬度來容納單元格的內容。對于我的方法為何無法解決此問題的建議&#…

大疆無人機android登錄閃退,你的DJI APP閃退了嗎?附官方解決方案

原標題&#xff1a;你的DJI APP閃退了嗎&#xff1f;附官方解決方案今天&#xff0c;很多飛友反應&#xff0c;在使用大疆無人機過程中出現DJI APP閃退情況。隨后在大疆社區官方給出了解決方案&#xff0c;如下&#xff1a;關于DJI GO 4 APP閃退解決方案目前關于DJI GO4 APP閃退…

ps導出gif顏色不對_PS基礎知識(1)

視圖平移命令&#xff1a;1,使用工具箱中的抓手工具或著&#xff08;H&#xff09;2按住空格鍵&#xff0c;上下左右移動視圖。&#xff08;常用方法&#xff09;圖像格式PSD&#xff1a;原始的圖像文件&#xff0c;包含所有的 Photoshop 處理信息&#xff0c;如圖層&#xff0…

html如何設置鼠標選中狀態,怎么用CSS 設置 當鼠標移動到菜單時,該按鈕變色,鼠標點擊后,頁面停留在鼠標滑過時的狀態!!很急!...

用javascript就可以&#xff0c;基本代碼在下面&#xff0c;你自己照著改吧htmlheadmeta http-equivContent-Type contenttext/html;charset gb2312 //headbodyscript typetext/javascriptfunction changeA(){document.getElementById(menuA).style.background#f00;document.g…

python中難的算法_Python算法很難嗎?python神書《算法圖解》PDF電子版分享給你

許多小伙伴后臺私信說&#xff0c;python算法讓自己很頭疼&#xff0c;有沒有可以讓算法像小說一樣有趣的書籍資料呢&#xff1f;看這里吧&#xff01;小宋為大家找到了這本《算法圖解》的PDF電子版&#xff01;讓你在學習python的路上變得輕松有趣&#xff01;內 容 提 要本書…

音樂分享 html,支付寶朋友圈可以分享音樂嘛

打開手機&#xff0c;找到手機里面的支付寶應用點擊進入在進入的支付寶界面里&#xff0c;選擇底下的朋友點擊進入在彈出的朋友界面選擇生活圈選擇生活圈下方的朋友動態進到朋友動態界面&#xff0c;點擊右上角的照相機圖標支付寶 怎么發朋友圈動態&#xff1f;進入支付寶頁面中…

eplan單線原理圖多線原理圖_EPLAN-黑盒-2

3、黑盒的功能定義制作完成的黑盒僅僅圖形化描述了一個變頻器&#xff0c;它實現邏輯上的智能了嗎&#xff1f;雙擊黑盒彈出屬性標簽&#xff0c;它的主標簽還是現實黑盒&#xff0c;如圖&#xff0c;圖形和邏輯還沒匹配。因此&#xff0c;必須為它重新定義功能。EPLAN的功能定…