LVM逻辑卷基本操作

2019-03-14  本文已影响0人  ArthurIsUsed

相关命令

[root@KMVS-CENTOS shm]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg_kmvscentos
  PV Size               79.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              20354
  Free PE               0
  Allocated PE          20354
  PV UUID               Ggncx1-y0eb-XVyQ-6jxi-SX35-tzbp-rSeJHP
[root@KMVS-CENTOS shm]# vgdisplay 
  --- Volume group ---
  VG Name               vg_kmvscentos
  System ID             
  Format                lvm2
  Metadata Areas        1
  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                1
  Act PV                1
  VG Size               79.51 GiB
  PE Size               4.00 MiB
  Total PE              20354
  Alloc PE / Size       20354 / 79.51 GiB
  Free  PE / Size       0 / 0   
  VG UUID               HbeVkk-bnpi-O4NZ-aGzQ-N8jy-D8rZ-QNcqgD
[root@KMVS-CENTOS shm]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/vg_kmvscentos/lv_home
  LV Name                lv_home
  VG Name                vg_kmvscentos
  LV UUID                UoK2Gc-Y1Ec-lJXr-Vv57-xAkc-iZsz-HaAtNV
  LV Write Access        read/write
  LV Creation host, time KMVS-CENTOS, 2013-08-08 12:25:46 +0800
  LV Status              available
  # open                 1
  LV Size                25.63 GiB
  Current LE             6562
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

不重启,显示新硬盘

[root@KMVS-CENTOS shm]# ls /sys/class/scsi_host/
host0  host1  host2
 [root@iNeedle~]# echo "- - -" > /sys/class/scsi_host/host0/scan
 [root@iNeedle~]# echo "- - -" > /sys/class/scsi_host/host1/scan
 [root@iNeedle~]# echo "- - -" > /sys/class/scsi_host/host2/scan
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

添加新硬盘,纳入逻辑卷

[root@KMVS-CENTOS shm]# pvcreate  /dev/sdb 
  Physical volume "/dev/sdb" successfully created
[root@KMVS-CENTOS shm]# vgextend vg_kmvscentos /dev/sdb
  Volume group "vg_kmvscentos" successfully extended
[root@KMVS-CENTOS shm]# vgdisplay 
  --- Volume group ---
  VG Name               vg_kmvscentos
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  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               109.50 GiB
  PE Size               4.00 MiB
  Total PE              28033
  Alloc PE / Size       20354 / 79.51 GiB
  Free  PE / Size       7679 / 30.00 GiB
  VG UUID               HbeVkk-bnpi-O4NZ-aGzQ-N8jy-D8rZ-QNcqgD
[root@KMVS-CENTOS shm]# lvresize -L 30G /dev/mapper/vg_kmvscentos-lv_home 
  Extending logical volume lv_home to 30.00 GiB
  Logical volume lv_home successfully resized
    
[root@KMVS-CENTOS shm]# lvextend -L   +25.6G  /dev/mapper/vg_kmvscentos-lv_home 
  Rounding size to boundary between physical extents: 25.60 GiB
  Extending logical volume lv_home to 55.60 GiB
  Logical volume lv_home successfully resized
[root@KMVS-CENTOS shm]# resize2fs /dev/mapper/vg_kmvscentos-lv_home 
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_kmvscentos-lv_home is mounted on /home; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/mapper/vg_kmvscentos-lv_home to 14582784 (4k) blocks.
The filesystem on /dev/mapper/vg_kmvscentos-lv_home is now 14582784 blocks long.

[root@KMVS-CENTOS shm]# df -h
文件系统          容量  已用  可用 已用%% 挂载点
/dev/mapper/vg_kmvscentos-lv_root
                       50G   14G   33G  30% /
tmpfs                 7.9G  292K  7.9G   1% /dev/shm
/dev/sda1             485M   38M  423M   9% /boot
/dev/mapper/vg_kmvscentos-lv_home
                       55G   20G   33G  39% /home
/dev/sda3             119G   13G  101G  11% /disk
上一篇下一篇

猜你喜欢

热点阅读