Search This Blog

Friday, March 11, 2011

LVM is reporting I/O errors after creating a snapshots and modifying it

Once you create a snapshot for one of your logical volumes you can mount it in rw mode and use it as a normal available file system/block device. After some time you may get errors like the one bellow unfortunately.

# lvs
  /dev/group1/snap: read failed after 0 of 4096 at 0: Input/output error
  Volume group group2 is exported
  LV         VG     Attr   LSize  Origin Snap%  Move Log             Copy%  Convert
  l1         group1 owi-ao 12.00m                                            group1 mwi-a- 12.00m                    mirror.new_mlog 100.00        
  snap       group1 Swi-I-  4.00m l1     100.00                                    
  snap2      group1 swi-a- 20.00m l1       0.23                                    
  snap3      group1 swi-ao  4.00m l1       1.17                                    
  snap4      group1 swi-a-  4.00m l1       1.17        

The key part to understand this is to look at the attribute descriptions of the lvs command.

$ man lvs | less -R  +2/lv_attr -X
1  Volume  type:  (m)irrored,  (M)irrored  without  initial  sync,  (o)rigin,  (p)vmove,  (s)napshot, invalid (S)napshot,
                 (v)irtual, mirror (i)mage, mirror (I)mage out-of-sync, under (c)onversion

              2  Permissions: (w)riteable, (r)ead-only

              3  Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited This is capitalised if the volume is  cur‐
                 rently locked against allocation changes, for example during pvmove (8).

              4  fixed (m)inor

              5  State:  (a)ctive,  (s)uspended,  (I)nvalid  snapshot,  invalid  (S)uspended  snapshot, mapped (d)evice present without
                 tables, mapped device present with (i)nactive table

              6  device (o)pen

It means that our snapshot device /dev/group1/snap has run out of free space. The only way to fix it is to remove the snapshot device because we can't trust unfortunately its content any longer. Next time make sure that the additional free space for the snapshot logical volume is big enough when you plan changing a lot of data on it.

# lvremove /dev/group1/snap4
# lvcreate -n snap -s -L group1/l1

3.8. Snapshots
LVM is reporting I/O errors, but the disk reports no problems

No comments:

Post a Comment