iscsi storage - How to access logical volume and raw files

alain

Renowned Member
May 17, 2009
224
2
83
France/Paris
Hi all,

This is Proxmox ve 1.5 and Kernel 2.6.32.

As already said in another post, I am testing iscsi storage, following the wiki 'Use iSCSI LUN for LVM base'

I already set up two VMs on this storage. So, I have for example a logical volume that appeared with these informations :
# lvdisplay
--- Logical volume ---
LV Name /dev/pve-iscsi/vm-108-disk-1
VG Name pve-iscsi
LV UUID cyUDwo-I3q8-Cxsk-cRad-p3hL-jNZv-ulCU1G
LV Write Access read/write
LV Status available
# open 1
LV Size 20,00 GB
Current LE 5120
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3

I would like in a near future to migrate machines on this storage. I'll need to replace the raw files inside these logical volumes by new ones.

But I don't see clearly how to access these logical volumes to replace the VM raw files.

Can someone gives me some hints on how to do this ?

Thanks in advance

Alain
 
I try to give you an explanation ...
In this structure each LV is a disk of a VM, so if you want to copy a disk in raw form into a LV,
of course you must first create such lv
lvcreate -n "VMID"-L "sizeinGigaByte"G pve-iscsi
then you can copy from raw file to LV
dd if="pathrawfile" of =/dev/pve-iscsi/"VMID" bs=1M
I think is the best and fastest
 
Last edited:
ion-ral,

Thanks for your answer. I understand now that I was completly at lost. There is no 'raw' files inside logical volume, but this one is in some way the raw file. There is something that I find very useful, mount a raw file as loop device, that I tried also with the logical volume :
# mount -o loop,offset=32256 /dev/pve-iscsi/vm-108-disk-1 /mnt

An indeed I was able to access the boot partition, /boot. The rest of the machine use also LVM (it is CentOS)...

Very interesting. Thanks.

Alain
 
You can also use kpartx to create a logical device corresponding logical volume (as well as a raw file)

kpartx -av /dev/pve-iscsi/vm-108-disk-1
Then you can mount any partition without using the offset

mount /dev/mapper/pve--scsi-vm--108--disk--1X /mnt
when you have umount the filesystem eliminate the mapper device with this command:

kpartx -ad /dev/pve-iscsi/vm-108-disk-1
 
Last edited: