4

lvm卷的clone方法

 9 months ago
source link: https://bajie.dev/posts/20231208-iscsi_lv_clone/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Lvm卷的clone方法

2023-12-08 1 分钟阅读

用pxe远程启动一个iscsi卷的方法已经会了的话。

如果我们要批量产新虚机,最快的方法应该是把远程的iscsi卷clone一下,供新的虚机用,方法如下:

在172.18.30.18上操作

查看一下,原来有两个LV(逻辑卷)

 # lvdisplay
2020-10-15_165500.png

那就把pvc-vis-18-31-48的lvm虚机卷,先copy做个mirror,-b参数表示后台运行。

# lvconvert --type mirror --alloc anywhere -m1 /dev/vg-targetd/pvc-vis-18-31-48 -b
  Logical volume vg-targetd/pvc-vis-18-31-48 converted.

提示一下就运行完毕了,虚假啊,后台正在运行同步信息:

lvs -a -o +devices | egrep "LV|48"

2020-10-15_165157.png

看那个Cpy&Sync,那个是进度条,才6.91,务必等走到100,再进行后续操作

然后破开这个mirror,把副本命名为vis-18-31-49

#lvconvert --splitmirrors 1 --name vis-18-31-49 /dev/vg-targetd/pvc-vis-18-31-48
  Logical volume vg-targetd/pvc-vis-18-31-48 converted.

再运行 lvdisplay

2020-10-15_165555.png

多出一个逻辑卷pvc-vis-18-31-49,之后我们就可以用这个新卷建立iscsi对象了。

这个卷装的Linux是Centos 7 last,网卡是dhcp,可以当模板复用。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK