一直都说LVM可以在线增加空间,一直都没有试过

下面小试一下:

1.增加硬盘

2.创建PV

3.添加PV到VG

4.扩展LV

1.增加硬盘

该干嘛干嘛

添加后需要重启(有知道不用重启的办法吗)

--这个是新添加的硬盘  
[root@localhost ~]# fdisk -l /dev/sdb  
Disk /dev/sdb: 5368 MB, 5368709120 bytes  
255 heads, 63 sectors/track, 652 cylinders  
Units = cylinders of 16065 * 512 = 8225280 bytes  
Disk /dev/sdb doesn't contain a valid partition table

2.创建PV

--命令很简单

--命令很简单  
[root@localhost ~]# pvcreate /dev/sdb  
  Physical volume "/dev/sdb" successfully created  
  
--可以看到新的PV了  
[root@localhost ~]# pvdisplay  
  /dev/hdc: open failed: No medium found  
  --- Physical volume ---  
  PV Name               /dev/sda2  
  VG Name               VolGroup00  
  PV Size               9.90 GB / not usable 22.76 MB  
  Allocatable           yes (but full)  
  PE Size (KByte)       32768  
  Total PE              316  
  Free PE               0  
  Allocated PE          316  
  PV UUID               n5fS6M-jBiH-n9vU-pBTd-iOCv-BbTe-BUeNZo  
     
  "/dev/sdb" is a new physical volume of "5.00 GB"  
  --- NEW Physical volume ---  
  PV Name               /dev/sdb  
  VG Name                 
  PV Size               5.00 GB  
  Allocatable           NO  
  PE Size (KByte)       0  
  Total PE              0  
  Free PE               0  
  Allocated PE          0  
  PV UUID               TDs3mN-3ON3-eHbl-cohr-7Hr3-8608-jiLlXG  

3.添加PV到VG

--指定对应的VG和PV  
[root@localhost ~]# vgextend VolGroup00 /dev/sdb  
  Volume group "VolGroup00" successfully extended  
  
--看到新的5G添加到VG里面了,状态是没有分配  
[root@localhost ~]# vgdisplay   
  --- Volume group ---  
  VG Name               VolGroup00  
  System ID               
  Format                lvm2  
  Metadata Areas        2  
  Metadata Sequence No  4  
  VG Access             read/write  
  VG Status             resizable  
  MAX LV                0  
  Cur LV                2  
  Open LV               2  
  Max PV                0  
  Cur PV                2  
  Act PV                2  
  VG Size               14.84 GB  
  PE Size               32.00 MB  
  Total PE              475  
  Alloc PE / Size       316 / 9.88 GB  
  Free  PE / Size       159 / 4.97 GB  
  VG UUID               x1uyPD-qBgE-2yQV-T1Cb-IGIz-e4LB-fghf1W  

4.扩展LV

--先添加2G练手  
[root@localhost ~]# lvextend -L +2G /dev/VolGroup00/LogVol00  
  Extending logical volume LogVol00 to 10.88 GB  
  Logical volume LogVol00 successfully resized  
--成功后还未看到新的空间  
[root@localhost ~]# df -m  
Filesystem           1M-blocks      Used Available Use% Mounted on  
/dev/mapper/VolGroup00-LogVol00  
                          8804      7362       988  89% /  
--需要手动刷新  
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00  
resize2fs 1.39 (29-May-2006)  
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required  
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2850816 (4k) blocks.  
The filesystem on /dev/VolGroup00/LogVol00 is now 2850816 blocks long.  
  
--现在就完成了  
[root@localhost ~]# df -m  
Filesystem           1M-blocks      Used Available Use% Mounted on  
/dev/mapper/VolGroup00-LogVol00  
                         10788      7365      2867  72% / 

若需要先缩小则使用以下命令:

lvreduce -L -20G /dev/mapper/vg_mysvr-lv_home

resize2fs /dev/mapper/vg_my-lv_home

lvextend -L +20G /dev/mapper/vg_mysvr-lv_root

resize2fs /dev/mapper/vg_mysvr-lv_root

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。