代码改变世界

Snapshot origin volumes can be resized only while inactive: try lvchange -an

2018-06-05 11:11  潇湘隐者  阅读(1176)  评论(0编辑  收藏  举报

事件现象:

 

最近同事在扩展VG时遇到了Snapshot origin volumes can be resized only while inactive: try lvchange -an错误

 

 

  # partprobe

  # mkfs -t ext3 /dev/sdd3

  # pvcreate /dev/sdd3

  # vgextend VolGroup03 /dev/sdd3

  # lvextend -l +40G  /dev/mapper/VolGroup03-LogVol00 /dev/sdd3

  /dev/VolGroup05/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 279105699840: Input/output error

  /dev/VolGroup05/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 279105757184: Input/output error

  /dev/VolGroup05/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 0: Input/output error

  /dev/VolGroup05/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 4096: Input/output error

  /dev/VolGroup01/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 85865725952: Input/output error

  /dev/VolGroup01/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 85865783296: Input/output error

  /dev/VolGroup01/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 0: Input/output error

  /dev/VolGroup01/LogVol00-PS-user-snapshot: read failed after 0 of 4096 at 4096: Input/output error

  Snapshot origin volumes can be resized only while inactive: try lvchange -an

 

 

 

出错原因:

 

 

 被扩展的VG存在LVM快照(LVM snapshot),所以扩展VG时出现上面错误。因为这个LVM快照是PlateSpin使用,上面没有什么数据一定需要保留。所以使用lvremove删除逻辑卷LV,然后扩展VG。 最后创建LV解决。

 

 

解决方案

 

# stat /dev/VolGroup03/LogVol00-PS-user-snapshot 
# lvremove /dev/VolGroup03/LogVol00-PS-user-snapshot
# lvextend -L +40G /dev/mapper/VolGroup03-LogVol00 /dev/sdd3
# resize2fs /dev/mapper/VolGroup03-LogVol00
# lvcreate -L 20G -s -n LogVol00-PS-user-snapshot /dev/VolGroup03/LogVol00

 

  如果出于保险起见,那么需要备份LVM快照数据,然后卸载卷组(unmount), 然后就按照上面步骤继续操作