GPT分区格式

发布时间:2023年12月27日
?GPT分区格式
[root@localhost ~]# gdisk /dev/sdb 
-bash: gdisk: 未找到命令
[root@localhost ~]# yum -y install gdisk

- gdisk命令用于查看磁盘使用情况和磁盘分区(GPT分区格式)

?? ?- 命令格式:gdisk [选项...] [设备路径]
?? ?- 常用选项:-l 列出磁盘分区表类型与分区信息

[root@localhost ~]# gdisk /dev/sdb 

[root@localhost ~]# fdisk -l

[root@localhost ~]# mkfs.xfs /dev/sdb1 

[root@localhost ~]# blkid /dev/sdb1
/dev/sdb1: UUID="adb85183-9036-4e9c-ba48-aa008bcbebf2" TYPE="xfs" PARTLABEL="Linux filesystem" PARTUUID="5dd8dd16-0e61-47fd-9c24-58ac87f1ceb3" 
[root@localhost ~]# lsblk 


[root@localhost ~]# vgdisplay -v
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <19.00 GiB
  PE Size               4.00 MiB
  Total PE              4863
  Alloc PE / Size       4863 / <19.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               HI5U81-Hkvk-fmqC-UHnx-CDqk-RjLj-fLzHJB
   
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                GDGd2c-eZch-K97v-zSi0-2eNX-fgUF-fh5xun
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-04-11 05:45:36 +0800
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                8PsH48-HedQ-jXHq-H7rP-Xj9O-Ligh-CairgB
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-04-11 05:45:36 +0800
  LV Status              available
  # open                 1
  LV Size                <17.00 GiB
  Current LE             4351
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               RYZCne-Xpic-a6Fe-TDQO-M4AI-tsmf-vkHFmQ
  PV Status             allocatable
  Total PE / Free PE    4863 / 0
[root@localhost ~]# pvcreate /dev/sdb1
WARNING: xfs signature detected on /dev/sdb1 at offset 0. Wipe it? [y/n]: y
  Wiping xfs signature on /dev/sdb1.
  Physical volume "/dev/sdb1" successfully created.
[root@localhost ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos
  PV Size               <19.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4863
  Free PE               0
  Allocated PE          4863
  PV UUID               RYZCne-Xpic-a6Fe-TDQO-M4AI-tsmf-vkHFmQ
   
  "/dev/sdb1" is a new physical volume of "<50.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               <50.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               WVt5dy-mqhY-O9oo-OKQ8-1ll4-682A-xFLuTp
   
[root@localhost ~]# vgextend centos /dev/sdb1
  Volume group "centos" successfully extended
[root@localhost ~]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part 
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   50G  0 disk 
└─sdb1            8:17   0   50G  0 part 
sr0              11:0    1  4.3G  0 rom  
[root@localhost ~]# lvextend -L +49G /dev/centos/root 
  Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to <66.00 GiB (16895 extents).
  Logical volume centos/root successfully resized.
[root@localhost ~]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part 
  ├─centos-root 253:0    0   66G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   50G  0 disk 
└─sdb1            8:17   0   50G  0 part 
  └─centos-root 253:0    0   66G  0 lvm  /
sr0              11:0    1  4.3G  0 rom  
[root@localhost ~]# xfs_growfs /dev/centos/root 
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=1113856 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=4455424, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 4455424 to 17300480
[root@localhost ~]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part 
  ├─centos-root 253:0    0   66G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   50G  0 disk 
└─sdb1            8:17   0   50G  0 part 
  └─centos-root 253:0    0   66G  0 lvm  /
sr0              11:0    1  4.3G  0 rom  
[root@localhost ~]# df -hl
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root   66G  2.0G   64G    4% /
devtmpfs                 898M     0  898M    0% /dev
tmpfs                    910M     0  910M    0% /dev/shm
tmpfs                    910M  9.6M  901M    2% /run
tmpfs                    910M     0  910M    0% /sys/fs/cgroup
/dev/sda1               1014M  146M  869M   15% /boot
tmpfs                    182M     0  182M    0% /run/user/0
[root@localhost ~]# df -hT
文件系统                类型      容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root xfs        66G  2.0G   64G    4% /
devtmpfs                devtmpfs  898M     0  898M    0% /dev
tmpfs                   tmpfs     910M     0  910M    0% /dev/shm
tmpfs                   tmpfs     910M  9.6M  901M    2% /run
tmpfs                   tmpfs     910M     0  910M    0% /sys/fs/cgroup
/dev/sda1               xfs      1014M  146M  869M   15% /boot
tmpfs                   tmpfs     182M     0  182M    0% /run/user/0

文章来源:https://blog.csdn.net/weixin_45894220/article/details/135251970
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。