日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

Linux 主分区_扩展分区_逻辑分区

發(fā)布時間:2023/12/13 综合教程 30 生活家
生活随笔 收集整理的這篇文章主要介紹了 Linux 主分区_扩展分区_逻辑分区 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

目錄:

  1、MBR分區(qū)介紹

  2、創(chuàng)建主分區(qū)

  3、創(chuàng)建擴展分區(qū)

  4、創(chuàng)建邏輯分區(qū)  

1、MBR分區(qū)介紹

1.1 分區(qū)規(guī)定:

  每個磁盤設備最多4個主分區(qū),或者3個主分區(qū)+1個擴展分區(qū),是因為MBR(主引導記錄)的分區(qū)表(主分區(qū)表)只能存放4個分區(qū) (GPT分區(qū)沒有這個限制)。

  擴展分區(qū)只能有一個。

  邏輯分區(qū)可以有多個。

  可以從擴展分區(qū)中再次劃分多個邏輯分區(qū),邏輯分區(qū)編號直接從5開始。

1.2 分區(qū)作用:

  主分區(qū):主要是用來啟動操作系統(tǒng)的,它主要放的是操作系統(tǒng)的啟動或引導程序,/boot分區(qū)最好放在主分區(qū)上;

  擴展分區(qū)是不能使用的,它只是做為邏輯分區(qū)的容器存在的,先創(chuàng)建一個擴展分區(qū),在擴展分區(qū)之上創(chuàng)建邏輯分區(qū);

  我們真正存放數據的是主分區(qū)和邏輯分區(qū),大量數據都放在邏輯分區(qū)中。

2、創(chuàng)建主分區(qū)

[root@servera ~]# fdisk /dev/vdb

Command (m for help): n  # 創(chuàng)建新分區(qū) Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p  # 創(chuàng)建主分區(qū) Partition number (1-4, default 1):   # 回車 First sector (2048-10485759, default 2048):   # 回車,設置起始扇區(qū) Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): 409600  # 設置結尾扇區(qū) Created a new partition 1 of type 'Linux' and of size 199 MiB. Command (m for help): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): p  # 創(chuàng)建主分區(qū) Partition number (2-4, default 2):   # 回車 First sector (409601-10485759, default 411648):   # 回車,設置起始扇區(qū) Last sector, +sectors or +size{K,M,G,T,P} (411648-10485759, default 10485759): 819200  # 設置結尾扇區(qū) Created a new partition 2 of type 'Linux' and of size 199 MiB.
Command (m for help): w  # 保存配置 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. [root@servera ~]# fdisk -l /dev/vdb Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0x03864530 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 409600 407553 199M 83 Linux /dev/vdb2 411648 819200 407553 199M 83 Linux

3、創(chuàng)建擴展分區(qū)

[root@servera ~]# fdisk /dev/vdb

Command (m for help): n  # 創(chuàng)建新分區(qū) Partition type p primary (2 primary, 0 extended, 2 free) e extended (container for logical partitions) Select (default p): e  # 創(chuàng)建擴展分區(qū) Partition number (3,4, default 3):   # 選擇分區(qū)號 First sector (409601-10485759, default 821248):   # 起始扇區(qū) Last sector, +sectors or +size{K,M,G,T,P} (821248-10485759, default 10485759):   # 結尾扇區(qū) Created a new partition 3 of type 'Extended' and of size 4.6 GiB. Command (m for help): w  # 保存配置 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. [root@servera ~]# fdisk -l /dev/vdb Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0x03864530 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 409600 407553 199M 83 Linux  # 主分區(qū) /dev/vdb2 411648 819200 407553 199M 83 Linux  # 主分區(qū) /dev/vdb3 821248 10485759 9664512 4.6G 5 Extended  # 擴展分區(qū)

4、創(chuàng)建邏輯分區(qū)

[root@servera ~]# fdisk /dev/vdb

Command (m for help): n  # 創(chuàng)建新分區(qū)
All space for primary partitions is in use.  # 提示所有空間都已經分配給主分區(qū)使用
Adding logical partition 5  # 從擴展分區(qū)中,自動劃分邏輯分區(qū)
First sector (823296-10485759, default 823296):   # 起始扇區(qū)
Last sector, +sectors or +size{K,M,G,T,P} (823296-10485759, default 10485759):   # 結尾扇區(qū)

Created a new partition 5 of type 'Linux' and of size 4.6 GiB.

Command (m for help): t  # 分區(qū)類型
Partition number (1-3,5, default 5): 
Hex code (type L to list all codes): 8e   # LVM類型

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): w  # 保存配置
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


[root@servera ~]# fdisk -l /dev/vdb
Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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
Disklabel type: dos
Disk identifier: 0x03864530

Device     Boot  Start      End Sectors  Size Id Type
/dev/vdb1         2048   409600  407553  199M 83 Linux
/dev/vdb2       411648   819200  407553  199M 83 Linux
/dev/vdb3       821248 10485759 9664512  4.6G  5 Extended
/dev/vdb5       823296 10485759 9662464  4.6G 8e Linux LVM

[root@servera ~]# mkfs.xfs /dev/vdb5  # 格式化邏輯分區(qū)
meta-data=/dev/vdb5              isize=512    agcount=4, agsize=301952 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=1207808, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@servera ~]# mount /dev/vdb5 /var/tmp  # 掛載邏輯分區(qū)

5、Parted格式化2TB以上的磁盤

通常我們使用fdisk工具來進行磁盤分區(qū),但是fdisk只能格式化小于2TB的磁盤。因此大于2TB的磁盤分區(qū)就需要parted工具。

5.1 設置DiskLable Type

  # parted /dev/sdb mklabel gpt

5.2 創(chuàng)建分區(qū)并格式化

  # parted /dev/sdb mkpart primary xfs 0 100%

  # mkfs.xfs /dev/sdb1

5.3 掛載分區(qū)

  #mount /dev/sdb1 /var/tmp

5.4 刪除分區(qū)

  # parted /dev/sdb rm 1

總結

以上是生活随笔為你收集整理的Linux 主分区_扩展分区_逻辑分区的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。