Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, July 16, 2013

How to move lv volume from host to host

To move one LVM volume from host A to host B you should create on host B a volume with same size as moving volume from host A.
After creation you can copy data from one volume to another with dd, ssh commands and gzip for speeding it up:

dd bs=1M if=LVM_HOST_A | gzip --fast -c | ssh HOST_B "gzip -d -c | dd bs=1M of=LVM_HOST_B"

To speed it up little more you can turn off compression in ssh (we already have compressed data with gzip) and choose fast cipher by adding -c arcfour -o Compression=no to ssh:

dd bs=1M if=LVM_HOST_A | gzip --fast -c | ssh -c arcfour -o Compression=no HOST_B "gzip -d -c | dd bs=1M of=LVM_HOST_B"

You can install pv utility to see file transfer progress, rate and etc. Like this:

dd bs=1M if=LVM_HOST_A | pv -brtp | gzip --fast -c | ssh -c arcfour -o Compression=no HOST_B "gzip -d -c | dd bs=1M of=LVM_HOST_B"

And look at lvmsync - it allows you to sync only changes made since LVM snapshot was made.

Thursday, December 20, 2012

How to clear cached memory on linux


Since 2.6.16 you need only echo to clear cached memory on Linux box.

This will clear all cached memory.

echo 3 > /proc/sys/vm/drop_caches
You can clear only part of it by using 1 or 2. All options:

  • 1 to clear cached pages.
  • 2 to clear dentries and inodes. 
  • 3 to clear all cached memory.

Links:
I found this advise here
Some notes about Linux VFS
Linux Page cache