centos扩容大容量个人记录

     

[root@localhost ~]# parted /dev/sdc
GNU Parted 3.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdc: 5498GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted) mklabel gpt
Warning: The existing disk label on /dev/sdc will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdc: 5498GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0 -1
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdc: 5498GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  5498GB  5498GB               primary

(parted) quit
Information: You may need to update /etc/fstab.

[root@localhost ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 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 label type: dos
Disk identifier: 0x000a0b39

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   419430399   209202176   8e  Linux LVM

Disk /dev/sdb: 5497.6 GB, 5497558138880 bytes, 10737418240 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 /dev/mapper/centos-root: 197.0 GB, 197040013312 bytes, 384843776 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 /dev/mapper/centos-swap: 17.2 GB, 17179869184 bytes, 33554432 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 /dev/mapper/vg_opt-lv_opt: 5497.6 GB, 5497553944576 bytes, 10737410048 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

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdc: 5497.6 GB, 5497558138880 bytes, 10737418240 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 label type: gpt
Disk identifier: CCB2DC2B-89E0-4BDF-BBD6-36A932C86E24


#         Start          End    Size  Type            Name
 1           34  10737416287      5T  Microsoft basic primary
[root@localhost ~]# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1              isize=512    agcount=5, agsize=268435455 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=1342177031, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=521728, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sda2  centos lvm2 a--  <199.51g    0
  /dev/sdb   vg_opt lvm2 a--    <5.00t    0
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize    VFree
  centos   1   2   0 wz--n- <199.51g    0
  vg_opt   1   1   0 wz--n-   <5.00t    0
[root@localhost ~]# lvs
  LV     VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   centos -wi-ao---- <183.51g                                             
  swap   centos -wi-ao----   16.00g                                             
  lv_opt vg_opt -wi-ao----   <5.00t                                             

[root@localhost ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 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 label type: dos
Disk identifier: 0x000a0b39

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   419430399   209202176   8e  Linux LVM

Disk /dev/sdb: 5497.6 GB, 5497558138880 bytes, 10737418240 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 /dev/mapper/centos-root: 197.0 GB, 197040013312 bytes, 384843776 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 /dev/mapper/centos-swap: 17.2 GB, 17179869184 bytes, 33554432 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 /dev/mapper/vg_opt-lv_opt: 5497.6 GB, 5497553944576 bytes, 10737410048 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

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdc: 5497.6 GB, 5497558138880 bytes, 10737418240 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 label type: gpt
Disk identifier: CCB2DC2B-89E0-4BDF-BBD6-36A932C86E24


#         Start          End    Size  Type            Name
 1           34  10737416287      5T  Microsoft basic primary
[root@localhost ~]# pvcreate /dev/sdc1
WARNING: xfs signature detected on /dev/sdc1 at offset 0. Wipe it? [y/n]: y
  Wiping xfs signature on /dev/sdc1.
  Physical volume "/dev/sdc1" successfully created.
[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos
  PV Size               199.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              51074
  Free PE               0
  Allocated PE          51074
  PV UUID               h9Gpgc-qzY5-8DFw-WxgH-EP0l-HelB-Ry3qKA

  --- Physical volume ---
  PV Name               /dev/sdb
  VG Name               vg_opt
  PV Size               5.00 TiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1310719
  Free PE               0
  Allocated PE          1310719
  PV UUID               mEcv0S-ycog-sX2x-nNoY-KWcV-ext1-lBfeFX

  "/dev/sdc1" is a new physical volume of "<5.00 TiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name
  PV Size               <5.00 TiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               MJicm1-ioBD-trLZ-2bY0-QoH3-TxZg-zZNtW0

[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sda2  centos lvm2 a--  <199.51g     0
  /dev/sdb   vg_opt lvm2 a--    <5.00t     0
  /dev/sdc1         lvm2 ---    <5.00t <5.00t
[root@localhost ~]# vgdisplay
  --- 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               <199.51 GiB
  PE Size               4.00 MiB
  Total PE              51074
  Alloc PE / Size       51074 / <199.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               3ehTi3-f4et-eS01-M5TT-V0nw-7k0U-vRa6P1

  --- Volume group ---
  VG Name               vg_opt
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <5.00 TiB
  PE Size               4.00 MiB
  Total PE              1310719
  Alloc PE / Size       1310719 / <5.00 TiB
  Free  PE / Size       0 / 0
  VG UUID               hmqt0E-zVay-O7BC-76kr-750B-Q5BT-0Us2Bj

[root@localhost ~]# vgextend vg_opt /dev/sdc1
  Volume group "vg_opt" successfully extended
[root@localhost ~]# vgdisplay
  --- 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               <199.51 GiB
  PE Size               4.00 MiB
  Total PE              51074
  Alloc PE / Size       51074 / <199.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               3ehTi3-f4et-eS01-M5TT-V0nw-7k0U-vRa6P1

  --- Volume group ---
  VG Name               vg_opt
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <10.00 TiB
  PE Size               4.00 MiB
  Total PE              2621438
  Alloc PE / Size       1310719 / <5.00 TiB
  Free  PE / Size       1310719 / <5.00 TiB
  VG UUID               hmqt0E-zVay-O7BC-76kr-750B-Q5BT-0Us2Bj

[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                2r7Auz-reWg-9B9u-44wD-dxFM-WAaR-34s67E
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-05-13 20:23:21 +0800
  LV Status              available
  # open                 2
  LV Size                16.00 GiB
  Current LE             4096
  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                YzcSIS-l30c-l9GU-d43C-MPzI-yqRq-wX18ns
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-05-13 20:23:22 +0800
  LV Status              available
  # open                 1
  LV Size                <183.51 GiB
  Current LE             46978
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg_opt/lv_opt
  LV Name                lv_opt
  VG Name                vg_opt
  LV UUID                1TXj6O-87n9-9zCI-6Uvo-e53i-f0K3-WTdTv7
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2021-05-14 00:09:21 +0800
  LV Status              available
  # open                 1
  LV Size                <5.00 TiB
  Current LE             1310719
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

[root@localhost ~]# lvextend -l +100%FREE /dev/vg_opt/lv_opt
  Size of logical volume vg_opt/lv_opt changed from <5.00 TiB (1310719 extents) to <10.00 TiB (2621438 extents).
  Logical volume vg_opt/lv_opt successfully resized.
[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                2r7Auz-reWg-9B9u-44wD-dxFM-WAaR-34s67E
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-05-13 20:23:21 +0800
  LV Status              available
  # open                 2
  LV Size                16.00 GiB
  Current LE             4096
  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                YzcSIS-l30c-l9GU-d43C-MPzI-yqRq-wX18ns
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-05-13 20:23:22 +0800
  LV Status              available
  # open                 1
  LV Size                <183.51 GiB
  Current LE             46978
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg_opt/lv_opt
  LV Name                lv_opt
  VG Name                vg_opt
  LV UUID                1TXj6O-87n9-9zCI-6Uvo-e53i-f0K3-WTdTv7
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2021-05-14 00:09:21 +0800
  LV Status              available
  # open                 1
  LV Size                <10.00 TiB
  Current LE             2621438
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

[root@localhost ~]# df -Th
Filesystem                Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   xfs       184G  1.9G  182G   2% /
devtmpfs                  devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                     tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs                     tmpfs     3.9G   33M  3.8G   1% /run
tmpfs                     tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                 xfs       497M  135M  362M  28% /boot
/dev/mapper/vg_opt-lv_opt xfs       5.0T  4.8T  278G  95% /opt
tmpfs                     tmpfs     783M     0  783M   0% /run/user/0
[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                2r7Auz-reWg-9B9u-44wD-dxFM-WAaR-34s67E
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-05-13 20:23:21 +0800
  LV Status              available
  # open                 2
  LV Size                16.00 GiB
  Current LE             4096
  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                YzcSIS-l30c-l9GU-d43C-MPzI-yqRq-wX18ns
  LV Write Access        read/write
  LV Creation host, time localhost, 2021-05-13 20:23:22 +0800
  LV Status              available
  # open                 1
  LV Size                <183.51 GiB
  Current LE             46978
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg_opt/lv_opt
  LV Name                lv_opt
  VG Name                vg_opt
  LV UUID                1TXj6O-87n9-9zCI-6Uvo-e53i-f0K3-WTdTv7
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2021-05-14 00:09:21 +0800
  LV Status              available
  # open                 1
  LV Size                <10.00 TiB
  Current LE             2621438
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

[root@localhost ~]# xfs_growfs /dev/vg_opt/lv_opt
meta-data=/dev/mapper/vg_opt-lv_opt isize=512    agcount=5, agsize=268435455 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=1342176256, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=521728, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1342176256 to 2684352512
[root@localhost ~]# df -Th
Filesystem                Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   xfs       184G  1.9G  182G   2% /
devtmpfs                  devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                     tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs                     tmpfs     3.9G   33M  3.8G   1% /run
tmpfs                     tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                 xfs       497M  135M  362M  28% /boot
/dev/mapper/vg_opt-lv_opt xfs        10T  4.8T  5.3T  48% /opt
tmpfs                     tmpfs     783M     0  783M   0% /run/user/0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值