1

Or: How to throttle down one LVM mirror leg lowering its assumed synchronization cpu load?

Is it possible to tweak a LVM mirror configuration so it takes it easy on mirroring files?

Whenever there is some big write, the machine hangs for some seconds (to many).

If LVM could mirror such files in a slower pace, I don't really care having to wait some minutes so the full mirroring completes; LVM could even copy big files little by little.

As an alternative: I am thinking on daemonising unison to backup all small files every minute, and big files I could write a script to copy in a less intensive way.

Any tip?

PS.: I am using KVPM to manage it.

CGroup (how?):
Currently I am trying to use CGroup io throttle, so I can keep LVM mirror active.
I found some info here. I am quite scared of make things stop working also, so I am trying to be sure on what to do...
The lvm mirror leg I want to slow down is at /dev/mapper/GRP-NM_mimage_1 -> /dev/dm-1 from /dev/sda4 (the fast one is at /dev/sdb2).

lvdisplay -v /dev/GRP/NM shows a block device without specifying what mirror leg it is related to...

pvdisplay -mv shows Physical extent 102839 to 117077, Logical volume /dev/GRP/NM_mimage_1, Logical extents 0 to 14238

basically, from this answer, I miss what major:minor to use.

this command sudo lvdisplay -am let me determine the correct major:minor for the mirror leg I need to throttle writes down, now lets test it!

well, the test did not work. I did echo "252:1 $((1*1024*1024))" |sudo tee /sys/fs/cgroup/blkio/blkio.throttle.write_bps_device but even for a 10MB limit, I was still having huge wait times to copy a simple 800MB file from a SATA to a the SSD mirror leg.

For now I just disabled the root OS's SATA mirror leg (one was on the SSD, the other on a SATA). As I also have 5 simple files that I use as swap on the SSD (and were being mirrored to the SATA) my OS was too annoying to be used. I think I need another SSD to consider re-enabling the mirror leg. Unless someone knows how to let the mirror leg on the SATA stop being an IO bottle neck.


I ended letting the LVM mirror stopped for a long time.
Yesterday I re-enabled it finally!
I solved this other problem and LVM mirror seems not that heavy now (but it still seems heavy).
https://askubuntu.com/questions/1047568/why-systemctl-doesnt-list-manage-zeitgeist-daemon-and-what-who-actually-do/1051702#1051702 . I think this from iotop is related to LVM mirror, not sure yet: be/3 root 0.00 K/s 43111.16 K/s 0.00 % 6.77 % [jbd2/dm-2-8]

This question is still useful I think, and I would like to try cgroup cfg whenever I understand it or someone releases a frontend (gfx or ncurses) with help info to let this great tool be more widely used :)

  • (hint) Are the mirrors on a different physical disk and/or different disk controller than the original? – mdpc Aug 31 '16 at 1:55
  • Original disk controller is motherboard one right? Well, they are two different physical storages, one is a SSD, the other is an old 1TB samsung disc, and yes surely the bottleneck is the old disc. Both are connected on the same motherboard, each on a SATA master cable (I kept all slave ones free). I understand if I bought another SSD to mirror on it, probably the issues would be lessened (but would disappear?). But my goal is to keep using the 1TB as mirror. – Aquarius Power Sep 1 '16 at 1:11
  • Maybe you do not want LVM mirroring at all. Maybe what you can use is to rsync from the SSD to the spinner invoked periodically. – mdpc Sep 1 '16 at 1:14
  • @mdpc seems an interesting option, I am also considering cgroup io priority serverfault.com/a/563173/163750 – Aquarius Power Sep 1 '16 at 1:39
  • 1
    nice feature in rsync is that it can throttle transfer rates. – mdpc Sep 1 '16 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.