Linux之LVS基于虚拟化的CentOS 7 扩容LV

[root@DS-VM-Node56 ~]# df -hP
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               2.0G     0  2.0G    0% /dev
tmpfs                  2.0G     0  2.0G    0% /dev/shm
tmpfs                  2.0G   17M  2.0G    1% /run
tmpfs                  2.0G     0  2.0G    0% /sys/fs/cgroup
/dev/mapper/DTVG-root   13G  3.6G  9.0G   29% /
/dev/xvda1             497M  208M  289M   42% /boot
tmpfs                  396M     0  396M    0% /run/user/0
/dev/mapper/DTVG-data  100G   74G   27G   74% /data
[root@DS-VM-Node56 ~]# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data DTVG -wi-ao---- 100.00g                                                    
  root DTVG -wi-ao----  12.50g                                                    
  swap DTVG -wi-ao----   2.00g                                                    
[root@DS-VM-Node56 ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  DTVG   2   3   0 wz--n- 114.49g    0 
[root@DS-VM-Node56 ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/xvda2 DTVG lvm2 a--   14.50g    0 
  /dev/xvdb  DTVG lvm2 a--  100.00g    0 
[root@DS-VM-Node56 ~]# 
[root@DS-VM-Node56 ~]# \rm -rf /data/*
[root@DS-VM-Node56 ~]# umount /data/
[root@DS-VM-Node56 ~]# lvremove /dev/DTVG/data 
Do you really want to remove active logical volume DTVG/data? [y/n]: y
  Logical volume "data" successfully removed
[root@DS-VM-Node56 ~]# vgreduce DTVG /dev/xvdb
  Removed "/dev/xvdb" from volume group "DTVG"
[root@DS-VM-Node56 ~]# pvremove /dev/xvdb
  Labels on physical volume "/dev/xvdb" successfully wiped.
[root@DS-VM-Node56 ~]# lvs
  LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root DTVG -wi-ao---- 12.50g                                                    
  swap DTVG -wi-ao----  2.00g                                                    
[root@DS-VM-Node56 ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  DTVG   1   2   0 wz--n- 14.50g    0 
[root@DS-VM-Node56 ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/xvda2 DTVG lvm2 a--  14.50g    0 
[root@DS-VM-Node56 ~]# sed -i 's/.*data/#&/' /etc/fstab && grep data /etc/fstab 
#UUID=b42596fb-0453-4396-844f-33237e971d0d /data xfs  defaults  0 0
[root@DS-VM-Node56 ~]# poweroff
[root@DS-VM-Node56 ~]# pvcreate /dev/xvdb
  Physical volume "/dev/xvdb" successfully created.
[root@DS-VM-Node56 ~]# vgextend DTVG /dev/xvdb
  Volume group "DTVG" successfully extended
[root@DS-VM-Node56 ~]# lvcreate -l 100%FREE -n data DTVG
WARNING: xfs signature detected on /dev/DTVG/data at offset 0. Wipe it? [y/n]: y
  Wiping xfs signature on /dev/DTVG/data.
  Logical volume "data" created.
[root@DS-VM-Node56 ~]# mkfs.xfs -f /dev/DTVG/data
meta-data=/dev/DTVG/data         isize=512    agcount=4, agsize=32767744 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=131070976, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=63999, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@DS-VM-Node56 ~]# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data DTVG -wi-a----- 500.00g                                                    
  root DTVG -wi-ao----  12.50g                                                    
  swap DTVG -wi-ao----   2.00g                                                    
[root@DS-VM-Node56 ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  DTVG   2   3   0 wz--n- 514.49g    0 
[root@DS-VM-Node56 ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/xvda2 DTVG lvm2 a--   14.50g    0 
  /dev/xvdb  DTVG lvm2 a--  500.00g    0 
[root@DS-VM-Node56 ~]# echo "$(blkid /dev/DTVG/data|awk '{gsub(/"/,"");print $2}') /data xfs  defaults  0 0" >> /etc/fstab
[root@DS-VM-Node56 ~]# [ -d /data ] || mkdir -p /data
[root@DS-VM-Node56 ~]# mount -a && df -hP
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               2.0G     0  2.0G    0% /dev
tmpfs                  2.0G     0  2.0G    0% /dev/shm
tmpfs                  2.0G  8.4M  2.0G    1% /run
tmpfs                  2.0G     0  2.0G    0% /sys/fs/cgroup
/dev/mapper/DTVG-root   13G  3.3G  9.3G   27% /
/dev/xvda1             497M  208M  289M   42% /boot
tmpfs                  396M     0  396M    0% /run/user/0
/dev/mapper/DTVG-data  500G   33M  500G    1% /data
[root@DS-VM-Node56 ~]# 
[root@DS-VM-Node56 ~]# service mysqld start
Starting MySQL.170305 14:24:26 mysqld_safe Adding '/usr/local/lib/libjemalloc.so' to LD_PRELOAD for mysqld
170305 14:24:26 mysqld_safe Logging to '/data/mariadb/mysql-error.log'.
. SUCCESS! 
[root@DS-VM-Node56 ~]# ss -tnl
State      Recv-Q Send-Q                                              Local Address:Port                                                             Peer Address:Port              
LISTEN     0      100                                                     127.0.0.1:25                                                                          *:*                  
LISTEN     0      300                                                             *:3306                                                                        *:*                  
LISTEN     0      128                                                             *:22                                                                          *:*                  
LISTEN     0      128                                                             *:4567                                                                        *:*                  
[root@DS-VM-Node56 ~]# df -hP
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               2.0G     0  2.0G    0% /dev
tmpfs                  2.0G     0  2.0G    0% /dev/shm
tmpfs                  2.0G  8.4M  2.0G    1% /run
tmpfs                  2.0G     0  2.0G    0% /sys/fs/cgroup
/dev/mapper/DTVG-root   13G  3.3G  9.3G   27% /
/dev/xvda1             497M  208M  289M   42% /boot
tmpfs                  396M     0  396M    0% /run/user/0
/dev/mapper/DTVG-data  500G  2.8G  497G    1% /data
[root@DS-VM-Node56 ~]# 

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

lookback

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: