Monthly Archives: July 2012

God bless LVM

Correct me if I’m wrong (and I really want to be wrong).
Is that whole LVM crap expects me to be forecaster/fortune-teller?

I wanted to upgrade some squeeze based virtual machine to wheezy. Sounds nice, yeah?
So before the upgrade you should ensure that you have backup, right?
Assuming that whole system is LVM based all you have to do before upgrade is LVM snapshot.
I did it and I was quite surprised that I had to declare its size.
I did it basing on assumption that upgrade shouldn’t take more than let say 5GB.

Tada!

mastersrv:~# lvs
  LV       VG      Attr   LSize   Origin  Snap%  Move Log Copy%  Convert
  backup   virtual -wi-ao  50,00g                                       
  mainsrv  virtual -wi-ao 300,00g                                       
  redminbu virtual swi-a-   5,00g redmine   0,00                        
  redmine  virtual owi-a-  19,53g

Now I did upgrade redmine virtual machine and this is what I got:

mastersrv:~# lvs
  LV       VG      Attr   LSize   Origin  Snap%  Move Log Copy%  Convert
  backup   virtual -wi-ao  50,00g                                       
  mainsrv  virtual -wi-ao 300,00g                                       
  redminbu virtual Swi-I-   5,00g redmine 100.00                        
  redmine  virtual owi-ao  19,53g

These attr flags mean “Snapshot invalid” and “Invalid snapshot”.
End of the story… this is last time I actually tried that method of backup.
Happily I have also some traditional backup (mysqldump+rsync) but I’m really surprised that LVM works this way.
There was plenty of free space to enlarge that volume and this is what you get in your logs:

[13402279.777238] device-mapper: snapshots: Invalidating snapshot: Unable to allocate exception.

Unable to allocate exception? Did it really try to do it?

mastersrv:~# pvs
  PV         VG      Fmt  Attr PSize   PFree  
  /dev/md0   virtual lvm2 a-   884,01g 514,46g

I don’t think so.