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

[[email protected] ~]# 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
[[email protected] ~]# 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                                                    
[[email protected] ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  DTVG   2   3   0 wz--n- 114.49g    0 
[[email protected] ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/xvda2 DTVG lvm2 a--   14.50g    0 
  /dev/xvdb  DTVG lvm2 a--  100.00g    0 
[[email protected] ~]# 
[[email protected] ~]# \rm -rf /data/*
[[email protected] ~]# umount /data/
[[email protected] ~]# lvremove /dev/DTVG/data 
Do you really want to remove active logical volume DTVG/data? [y/n]: y
  Logical volume "data" successfully removed
[[email protected] ~]# vgreduce DTVG /dev/xvdb
  Removed "/dev/xvdb" from volume group "DTVG"
[[email protected] ~]# pvremove /dev/xvdb
  Labels on physical volume "/dev/xvdb" successfully wiped.
[[email protected] ~]# 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                                                    
[[email protected] ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  DTVG   1   2   0 wz--n- 14.50g    0 
[[email protected] ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/xvda2 DTVG lvm2 a--  14.50g    0 
[[email protected] ~]# sed -i 's/.*data/#&/' /etc/fstab && grep data /etc/fstab 
#UUID=b42596fb-0453-4396-844f-33237e971d0d /data xfs  defaults  0 0
[[email protected] ~]# poweroff
[[email protected] ~]# pvcreate /dev/xvdb
  Physical volume "/dev/xvdb" successfully created.
[[email protected] ~]# vgextend DTVG /dev/xvdb
  Volume group "DTVG" successfully extended
[[email protected] ~]# 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.
[[email protected] ~]# 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
[[email protected] ~]# 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                                                    
[[email protected] ~]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  DTVG   2   3   0 wz--n- 514.49g    0 
[[email protected] ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/xvda2 DTVG lvm2 a--   14.50g    0 
  /dev/xvdb  DTVG lvm2 a--  500.00g    0 
[[email protected] ~]# echo "$(blkid /dev/DTVG/data|awk '{gsub(/"/,"");print $2}') /data xfs  defaults  0 0" >> /etc/fstab
[[email protected] ~]# [ -d /data ] || mkdir -p /data
[[email protected] ~]# 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
[[email protected] ~]# 
[[email protected] ~]# 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! 
[[email protected] ~]# 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                                                                        *:*                  
[[email protected] ~]# 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
[[email protected] ~]# 
  • 本文由 发表于 2017年3月6日02:27:21
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
匿名

发表评论

匿名网友 填写信息

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