lvm jobs

1 . The host increases 80G SCSI interface hard disk

First up virtual machines, add a 80G SCSI interface hard disk, then open the virtual machine to check whether to add the hard disk

 

2 . Dividing each of three 20G primary partition

[root@localhost ~]# fdisk /dev/sdc

Command ( input m to get help ) : n-

Select (default p): p

Partition number (1-4 , default 1) :

Starting sector (2048-167772159 defaults to 2048) :

We will use the default value 2048

Last sector , + a sector or size + {K, M, G} (2048-167772159 , default 167 772 159) : + 20G

Partition 1 is set to Linux type, size to 20 GiB

Command ( input m to get help ) : n-

Select (default p): p

Partition number (2-4 , default 2) :

Starting sector (67772159 41945088-1 , defaults to 41945088) :

We will use the default value 41,945,088

Last sector , + a sector or size + {K, M, G} (41945088-167772159 , default 167 772 159) : + 20G     

Partition 2 is set to Linux type, size to 20 GiB

Command ( input m to get help ) : n-

Select (default p): P

Partition number (3,4 , default 3) :

Starting sector (83888128-167772159 defaults to 83888128) :

We will use the default value 83,888,128

Last sector , + a sector or size + {K, M, G} (83888128-167772159 , default 167 772 159) : + 20G

Partition 3 is set to Linux type, size to 20 GiB

 

Command ( input m to get help ) : W

[root@localhost ~]# fdisk -l /dev/sdc

   设备 Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048    41945087    20971520   83  Linux

/dev/sdc2        41945088    83888127    20971520   83  Linux

/dev/sdc3        83888128   125831167    20971520   83  Linux

 

3 . Converting the three primary partitions of the physical volume ( the pvcreate ), physical volume scanning system

[root@localhost ~]# pvcreate /dev/sdc1

  Physical volume "/dev/sdc1" successfully created.

[root@localhost ~]# pvcreate /dev/sdc[23]

  Physical volume "/dev/sdc2" successfully created.

  Physical volume "/dev/sdc3" successfully created.

[root@localhost ~]# pvscan

  PV /dev/sdc2                      lvm2 [20.00 GiB]

  PV /dev/sdc3                      lvm2 [20.00 GiB]

  PV /dev/sdc1                      lvm2 [20.00 GiB]

4 . Two physical volumes to create a volume group, the name for myvg , view the volume group size

[root@localhost ~]# vgcreate myvg /dev/sdc1 /dev/sdc2

  Volume group "myvg" successfully created

[root@localhost ~]# vgdisplay /dev/myvg

  --- Volume group ---

  VG Name               myvg

  System ID             

  format lvm2

  Metadata Areas        2

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV 0

  Open LV               0

  Max PV                0

  Cur PV                2

  Act PV                2

  VG Size               39.99 GiB

  PE Size               4.00 MiB

  Total IN 10238

  Alloc PE / Size       0 / 0   

  Free  PE / Size       10238 / 39.99 GiB

  VG UUID               AoIQXr-xYB9-G4i7-jnvY-q4zr-4DxT-nTac4b

5 . Create a logical volume mylv , size 30G

[root@localhost ~]# lvcreate -L 30G -n mylv myvg

  Logical volume "mylv" created.

6 . The logical format to xfs file system, and mount it to / data on the directory, create a file test

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

[root@localhost ~]# mkdir /data

[root@localhost ~]# mount /dev/myvg/mylv  /data/

 

7 . Logical Volume increased to 35G

[root@localhost ~]# lvextend -L +5G /dev/myvg/mylv

  Size of logical volume myvg/mylv changed from 30.00 GiB (7680 extents) to 35.00 GiB (8960 extents).

  Logical volume myvg/mylv successfully resized.

[root@localhost ~]# xfs_growfs /dev/myvg/mylv

[root@localhost ~]# df -hT

[root@localhost ~]# lvdisplay /dev/myvg/mylv

Guess you like

Origin www.cnblogs.com/qingqing1/p/11291233.html
LVM