Migrating from XenServer, use existing LVM over iSCSI

kalbasit

New Member
Sep 6, 2016
3
0
1
40
Hello,

I'm currently using Citrix XenServer 6.5 and considering switching to ProxMox (testing it with another physical server).
I'm using a Synology NAS as the iSCSI server. XenServer created LVM over the raw iSCSI for the VM storage. I have cloned the iSCSI target/LUN on the Synology for the Proxmox test.

I tried through to add the existing VG to the new VM I've created but ProxMox insists on creating a new VG. I've searched quite a bit and it seems that https://forum.proxmox.com/threads/adding-existing-logical-volumes-to-the-list-of-virtual-disks.2413/ are still pretty accurate in regards to having to add the volumes manually.

I've changed the VM to reference the lvm I've imported (called zeus-lvm)
Code:
# cat /etc/pve/qemu-server/100.conf
balloon: 16384
bootdisk: virtio0
cores: 1
ide2: none,media=cdrom
memory: 1024
name: Zeus
net0: bridge=vmbr0,e1000=3A:63:64:62:33:65,tag=101
net1: bridge=vmbr0,e1000=66:31:35:63:62:32,tag=102
numa: 0
onboot: 1
ostype: l26
smbios1: uuid=36e9388c-35b8-43ab-9fde-84b06c1aa609
sockets: 1
virtio0: zeus-lvm:vm-100-disk-1,size=1023G

and that's correctly defined in /etc/pve/storage.cfg

Code:
# cat /etc/pve/storage.cfg
dir: local
        path /var/lib/vz
        content vztmpl,iso,backup

lvmthin: local-lvm
        vgname pve
        thinpool data
        content images,rootdir

iscsi: zeus
        portal 172.25.1.2
        target zeus-kvm.nasreddine.com:Apollo
        content images

lvm: zeus-lvm
        vgname VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
        content images,rootdir

but not sure what to do at this point? Should I rename the VG to
Code:
vm-100-disk-1
and add the tag with
Code:
lvchange
?

Here's the lvdisplay of the VG

Code:
  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee/MGT
  LV Name                MGT
  VG Name                VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
  LV UUID                4dyggf-12xJ-awyz-M2w6-QTjU-OGU5-6gXSPS
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              NOT available
  LV Size                4.00 MiB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee/VHD-e6969dde-f6ce-458d-bddf-4e28460a559d
  LV Name                VHD-e6969dde-f6ce-458d-bddf-4e28460a559d
  VG Name                VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
  LV UUID                w0wl6q-6cFm-oLmD-sFNY-17x7-lq83-o9diYX
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              NOT available
  LV Size                1022.00 GiB
  Current LE             261632
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee/VHD-08078728-c245-4cea-ae44-7cf07e285148
  LV Name                VHD-08078728-c245-4cea-ae44-7cf07e285148
  VG Name                VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
  LV UUID                dCvv9A-h07e-ZvPD-9PiN-VjnD-Birq-LyEhc2
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              NOT available
  LV Size                12.00 MiB
  Current LE             3
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee/VHD-425d01df-f113-4e2a-83ba-def430344666
  LV Name                VHD-425d01df-f113-4e2a-83ba-def430344666
  VG Name                VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
  LV UUID                8ScW6U-X3LL-tDeb-BI4v-ctD4-ejsC-6HYDxt
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              NOT available
  LV Size                12.00 MiB
  Current LE             3
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee/VHD-629b24fa-86a8-43af-9d44-de31512402ee
  LV Name                VHD-629b24fa-86a8-43af-9d44-de31512402ee
  VG Name                VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
  LV UUID                PByDaC-h11N-AvS2-yR8S-ZVic-9NvQ-PTdjl3
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              NOT available
  LV Size                12.00 MiB
  Current LE             3
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee/VHD-bf10f2c3-39c2-497c-823f-f28325b2fccb
  LV Name                VHD-bf10f2c3-39c2-497c-823f-f28325b2fccb
  VG Name                VG_XenStorage-b3429418-c2d3-d65e-110c-aa50af836fee
  LV UUID                axgtw8-nPEQ-TY0r-p37N-eI7F-FXpK-iXqct0
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              NOT available
  LV Size                12.00 MiB
  Current LE             3
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
 
I finally managed to resolve this by renaming both the VG and the LV to vm-101-disk-1. Please find below details with commands about the resolution:

I resolved it this way (the following lvm are not the same as the one shows above). I added a new VM called websites, created a new storage (during the creating wizard) and deleted once creation completed.

The original VG was named VG_XenStorage-5116a4d0-de07-26ac-b652-a62a75afc389 and it must be renamed to vm-101-disk-1

Code:
vgrename VG_XenStorage-5116a4d0-de07-26ac-b652-a62a75afc389 vm-101-disk-1

Inspect the LV of this VG and rename it to the correct name

Code:
root@kriophoros:~# lvs
  LV                                       VG                                                 Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  MGT                                      vm-101-disk-1                                      -wi-a-----    4.00m
  VHD-14708179-78b1-4c03-8a6c-96e3f6a2344a                            vm-101-disk-1                                      -wi-ao---- 1001.96g

clearly VHD-14708179-78b1-4c03-8a6c-96e3f6a2344a is the name of the needed LV.

Code:
# echo 'virtio0: websites-lvm:vm-101-disk-1,size=1001.96G' >> /etc/pve/qemu-server/101.conf

and finally rename the LV (you must activate the VG before being able to do so:

Code:
# vgchange -ay
# lvrename /dev/vm-101-disk-1/VHD-14708179-78b1-4c03-8a6c-96e3f6a2344a /dev/vm-101-disk-1/vm-101-disk-1
 
I spoke a bit too soon; the hard drive is not usable as is. It's not of a format understood as is by Linux, could be a vmdk?

Code:
root@kriophoros:~# fdisk -l /dev/vm-101-disk-1/*

Disk /dev/vm-101-disk-1/MGT: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/vm-101-disk-1/vm-101-disk-1: 1002 GiB, 1075847364608 bytes, 2101264384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
 
Last edited:
Hi,


I have the same issue, but I can't rename VG and LV. This is informed wich a duplicate VG and LV.


Code:
root@vmobc-pve01:/mnt# vgdisplay
  WARNING: Not using device /dev/sdd for PV 955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D.
  WARNING: PV 955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D prefers device /dev/sdc because device is used by LV.
  --- Volume group ---
  VG Name               VG_XenStorage-49faa339-76d0-c8c6-7fdd-2114703b73fe
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <2.00 TiB
  PE Size               4.00 MiB
  Total PE              524285
  Alloc PE / Size       262659 / 1.00 TiB
  Free  PE / Size       261626 / <1021.98 GiB
  VG UUID               pNg1PJ-muSV-A29X-uQoN-maky-MwGN-EqzkQg


Code:
root@vmobc-pve01:~# pvdisplay
  WARNING: Not using device /dev/sdd for PV 955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D.
  WARNING: PV 955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D prefers device /dev/sdc because device is used by LV.
  --- Physical volume ---
  PV Name               /dev/sdc
  VG Name               VG_XenStorage-49faa339-76d0-c8c6-7fdd-2114703b73fe
  PV Size               2.00 TiB / not usable 12.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              524285
  Free PE               261626
  Allocated PE          262659
  PV UUID               955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D

Code:
root@vmobc-pve01:~# lvdisplay
  WARNING: Not using device /dev/sdd for PV 955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D.
  WARNING: PV 955tEr-0dJG-mLrK-yaGU-0odD-La0N-2fBM8D prefers device /dev/sdc because device is used by LV.
  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-49faa339-76d0-c8c6-7fdd-2114703b73fe/MGT
  LV Name                MGT
  VG Name                VG_XenStorage-49faa339-76d0-c8c6-7fdd-2114703b73fe
  LV UUID                94SCE1-6Cwd-mSkH-3fwN-Ik6c-gRaR-jH1D58
  LV Write Access        read/write
  LV Creation host, time vmobcxenserver01.vmobc.local, 2017-09-11 18:23:18 -0300
  LV Status              available
  # open                 0
  LV Size                4.00 MiB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/VG_XenStorage-49faa339-76d0-c8c6-7fdd-2114703b73fe/VHD-bb176be7-e580-4722-afdd-5d9dbe53415b
  LV Name                VHD-bb176be7-e580-4722-afdd-5d9dbe53415b
  VG Name                VG_XenStorage-49faa339-76d0-c8c6-7fdd-2114703b73fe
  LV UUID                3hwn1F-jF6t-wkXS-QSS0-E8fs-FjRB-dldR35
  LV Write Access        read/write
  LV Creation host, time vmobcxenserver01.vmobc.local, 2017-09-11 18:25:48 -0300
  LV Status              available
  # open                 0
  LV Size                1.00 TiB
  Current LE             262658
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1


Thanks,
Marcelo Costa
Porto Alegre, Brazil
 
IIRC, the xenserver/Citrix Xenserver uses VHD format for the disks so you may have to convert it from VHD to qcow2 or to just RAW and go from there.