天天看点

How to manage multiple disks based on LVM in Centos 7Overview

How to manage multiple disks based on LVM in Centos 7

  • Overview
    • Installation phase
    • Command line

Overview

Installation phase

How to manage multiple disks based on LVM in Centos 7Overview
How to manage multiple disks based on LVM in Centos 7Overview
How to manage multiple disks based on LVM in Centos 7Overview
How to manage multiple disks based on LVM in Centos 7Overview
How to manage multiple disks based on LVM in Centos 7Overview

Command line

[[email protected] ~]# lsblk -l
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0    80G  0 disk 
sda1          8:1    0   200M  0 part /boot/efi
sda2          8:2    0     1G  0 part /boot
sda3          8:3    0  78.8G  0 part 
centos-root 253:0    0    50G  0 lvm  /
centos-swap 253:1    0   7.9G  0 lvm  [SWAP]
centos-home 253:2    0 180.9G  0 lvm  /home
sdb           8:16   0   160G  0 disk 
sdb1          8:17   0   160G  0 part 
centos-home 253:2    0 180.9G  0 lvm  /home
sr0          11:0    1  1024M  0 rom  
[[email protected] ~]# 

           
[[email protected] ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 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: 5AD14517-8968-4A36-B68E-07A37AC25541


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic 
 3      2508800    167770111   78.8G  Linux LVM       
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 171.8 GB, 171798691840 bytes, 335544320 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: F9313319-724A-4FD6-9A2E-2284462B5E67


#         Start          End    Size  Type            Name
 1         2048    335542271    160G  Linux LVM       

Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 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: 8455 MB, 8455716864 bytes, 16515072 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-home: 194.3 GB, 194259189760 bytes, 379412480 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

[[email protected] ~]# 

           
[[email protected] ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               centos
  PV Size               78.80 GiB / not usable 2.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              20173
  Free PE               1
  Allocated PE          20172
  PV UUID               epfbrQ-7QuS-ueZ1-iSfP-pRjU-6J3z-BNsZkZ
   
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               centos
  PV Size               <160.00 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              40959
  Free PE               0
  Allocated PE          40959
  PV UUID               MkuvrW-IdAf-THjX-1ZH7-a1pj-lPai-wwSz3M
   
[[email protected] ~]# 
[[email protected] ~]# vgdisplay 
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <238.80 GiB
  PE Size               4.00 MiB
  Total PE              61132
  Alloc PE / Size       61131 / 238.79 GiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               rB43hL-tOEC-hvTm-2FeA-g3su-cGGS-rl8Suv
   
[[email protected] ~]# 
[[email protected] ~]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                CFZ9Ix-g3vx-tfT1-ooiR-CS3h-pXoR-UM4AP5
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-11-19 01:20:43 -0500
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                hwz5Gy-I0q3-nGc2-jWx0-SKBx-m2yy-CqFevB
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-11-19 01:20:44 -0500
  LV Status              available
  # open                 1
  LV Size                <180.92 GiB
  Current LE             46315
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
   
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                NCHXcb-1xRf-DnSS-UsYd-sSpa-HI9n-fc5nDS
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-11-19 01:20:44 -0500
  LV Status              available
  # open                 2
  LV Size                <7.88 GiB
  Current LE             2016
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
[[email protected] ~]# 
[[email protected] ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Nov 19 01:20:45 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=dd63ad8c-1457-4774-a301-543994b639cd /boot                   xfs     defaults        0 0
UUID=9B95-B5C6          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
/dev/mapper/centos-home /home                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0
[[email protected] ~]#