Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Few days ago, in an interview I was asked whether in RHEL/CentOS is it possible to move LVM partitions from one server to another servers.
Just for illustration, I will call the Server "A" which currently has LVM Filesystems and call the Server "B", on which I want to move the LVM Filesystems of Server "A".
I know that I can move VG (and its LVs obviously) from one server to another by exporting and importing it (if we have a shared storage or if we physically plug and unplug the disks), as also illustrated in this link too.
This was my answer too.
Now, is it possible to move (or copy) the VG from Server "A" to Server "B" without a shared storage or without plug/unplug-ing the disks.
Few days ago, in an interview I was asked whether in RHEL/CentOS is it possible to move LVM partitions from one server to another servers.
Just for illustration, I will call the Server "A" which currently has LVM Filesystems and call the Server "B", on which I want to move the LVM Filesystems of Server "A".
I know that I can move VG (and its LVs obviously) from one server to another by exporting and importing it (if we have a shared storage or if we physically plug and unplug the disks), as also illustrated in this link too.
This was my answer too.
Now, is it possible to move (or copy) the VG from Server "A" to Server "B" without a shared storage or without plug/unplug-ing the disks.
Forgive my ignorance on this.
You can try doing a "snapshot" of the LV then move it over that way (using rsync, scp, etc)
The steps would basically go like this...
Create snapshot: (implies you have enough room in the VG to create the snapshot. I chose 1G...you can be more conservative with the size if you want. NOTE: snapshots are COW snapshots)
I just paid more attention to the steps listed by you. Here, you are just syncing two directories, but this won't move the VG or LVM Filesystem but its contents.
Is there any way out that I can move the entire VG to another server without removing disks from the primary server. Thanks.
I just paid more attention to the steps listed by you. Here, you are just syncing two directories, but this won't move the VG or LVM Filesystem but its contents.
Is there any way out that I can move the entire VG to another server without removing disks from the primary server. Thanks.
I would think you can run the commands I showed you on each LV in the VG
I am sorry, I think I am unable to make you understand my query.
My aim is NOT to sync the data of the LVM filesystems but to copy (or move) the entire VG/LV to other server such that if I a type lvs or vgs on other server, I could see the copied/moved VGs/LVs onto new server.
For example, as of now vg1 (and lv1/2) are on box2 (192.168.1.20).
I just want to know is there any way out that I can move vg1 (with lv1/2) to another server, such that if in case I run command vgs or lvs on box1 (192.168.1.10) the output is as follows and the data is intact.
This link worked for me partially. Although, I had to create VG/LV myself, I wonder if there is a way to copy/move LVM metadata too.
I followed these steps.
I added similar disks on the target system (192.168.1.10) with VG and LV.
Code:
root@box1:~# pvcreate /dev/sd{b,c,d}
Writing physical volume data to disk "/dev/sdb"
Physical volume "/dev/sdb" successfully created
Writing physical volume data to disk "/dev/sdc"
Physical volume "/dev/sdc" successfully created
Writing physical volume data to disk "/dev/sdd"
Physical volume "/dev/sdd" successfully created
root@box1:~#
root@box1:~# vgcreate newvg1 /dev/sd{b,c,d}
Volume group "vg1" successfully created
root@box1:~#
root@box1:~# lvcreate -L +200M -n newlv1 newvg1
Logical volume "newlv1" created
root@box1:~#
Now, on source server (192.168.1.20)
Code:
root@box2:~# dd if=/dev/vg1/lv1 | ssh 192.168.1.10 dd of=/dev/newvg1/newlv1
Address 192.168.1.10 maps to box1.test.com, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
root@192.168.1.10's password:
409600+0 records in
409600+0 records out
209715200 bytes (210 MB) copied, 32.8713 seconds, 6.4 MB/s
409600+0 records in
409600+0 records out
209715200 bytes (210 MB) copied, 31.129 s, 6.7 MB/s
root@box2:~#
Now, finally I can mount my new LV filesystem.
Code:
root@box1:~# mount /dev/newvg1/newlv1 /mnt
root@box1:~# ls -lrth /mnt
total 14K
drwx------ 2 root root 12K May 24 16:24 lost+found
-rw-r--r-- 1 root root 26 May 24 17:59 file2
-rw-r--r-- 1 root root 54 May 24 18:00 file1
root@box1:~#
This is similar to what Custangro had suggested (the rsync way).
I am sorry, I think I am unable to make you understand my query.
My aim is NOT to sync the data of the LVM filesystems but to copy (or move) the entire VG/LV to other server such that if I a type lvs or vgs on other server, I could see the copied/moved VGs/LVs onto new server.
Hi, I was looking for some answers on this topic myself and decided to register. Regarding your reply above it is very common to move large amounts of data with RSYNC. Of course, you can use it in all kinds of ways like incremental backups, but its also great for remote copy/backup. When you rsync any data for the first time it is the exact same thing as copying it except that you have lots of options and you can do dry runs with it to make sure it's going to the right place - that's especially nice with something as big as LVM2 logical volumes.
This is my first reply since I just signed up. Hope I did it right.
cosmicflush,
Welcome to LinuxQuestions. This thread is 6 years old and so your comments will probably not help the OP (original poster). In most cases replying to old threads has little value. In searching be mindful of the age of the information since what was posted years ago might not be relevant today.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.