[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] how much memory does LVM need? oom-killer comes



Tomasz Chmielewski schrieb:

Ouch - now it went so far that the machine only loops from a kernel panic to a kernel panic - that's really bad:

(...)
Out of memory: kill process 2220 (getty) score 24 or a child
Killed process 2220 (getty)
Kernel panic - not syncing: Out of memory and no killable processes...

Rebooting in 20 seconds..

Again, replying to myself, as no one on this list seem to have a clue about problems with LVM snapshots... I added RAM, and was able to boot again.


Below is a quick try to estimate the memory usage of LVM snapshots; I'm using 2.6.22.6.

The machine has 256 MB RAM.

With these volumes and snapshots, almost 200 MB of memory is used:

# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
  backup              st          owi-ao   1.20T
  backup-snap         st          swi-a- 100.00G backup  31.22
  backup-snap-resized st          swi-a-  30.00G backup  72.73
  backup1             st          -wi-a-   3.00G
  backup1-sync-test   st          -wi-a-   3.00G
  src                 st          -wi-a-   2.00G
  swap                st          -wi-ao   3.00G

# free
             total       used       free     shared    buffers     cached
Mem:        512864     418380      94484          0     216036       5156
-/+ buffers/cache:     197188     315676


After removing a 100 GB snapshot that is over 30% full, we reclaim almost 100 MB of memory:

# lvremove /dev/st/backup-snap

Do you really want to remove active logical volume "backup-snap"? [y/n]: y
  Logical volume "backup-snap" successfully removed


# free
             total       used       free     shared    buffers     cached
Mem:        512864     328668     184196          0     220652       7480
-/+ buffers/cache:     100536     412328
Swap:      3145720        220    3145500


After removing yet another snapshot - 30 GB, over 70% full - we reclaim 70 MB:

# lvremove /dev/st/backup-snap-resized
Do you really want to remove active logical volume "backup-snap-resized"? [y/n]: y
  Logical volume "backup-snap-resized" successfully removed

# free
             total       used       free     shared    buffers     cached
Mem:        512864     335500     177364          0     296444       9436
-/+ buffers/cache:      29620     483244
Swap:      3145720        216    3145504


So, as a rule of thumb, we can say that for each *used* GB of snapshot, ~3 MB of RAM is needed.


--
Tomasz Chmielewski
http://wpkg.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]