Skip to contentSkip to conversation

System won't create devices from volume group : advice on dmsetup create command required (or alternative solution)

linux-lvm J4 2 participants 3 messages Mar 3, 2010

lore
Share & tools
lore

J4

author
#0 lore raw

Dear all,

I am moving an LVM between two machines but the new machine won't
create the devices.

** Source machines set-up:
LVM created on XEN server as one volume group.
The Volume Group was then presented to a XEN host via xm block-attach. The XEN host then used fdisk to create two partitions on the new device (/dev/xvdd1 and /dev/xvdd2) [I wish they had not done this!] The devices were removed from the XEN host (xm block detach) and then vgchange -a n mds (mds is the vg)
The discs were unpresented from the source machine.

** Target machine set-up:
Phsyical server.
The discs were presented from the target machine.

# pvscan [results as expected]
# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "mds" using metadata type lvm2
# vgchange -a y mds
 # vgdisplay mds
  --- Volume group ---
  VG Name               mds
  System ID            
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               209.95 GB
  PE Size               4.00 MB
  Total PE              53746
  Alloc PE / Size       53735 / 209.90 GB
  Free  PE / Size       11 / 44.00 MB
  VG UUID               TnUWZQ-kK5S-iLTR-U0C5-NYHk-96cw-smDLm2

However, the devices are not created:

# ls /dev/mapper | grep mds
brw------- 1 root root 253, 11 Mar  3 11:17 /dev/mapper/mds-mds
# fdisk -l /dev/mds/mds
Disk /dev/mds/mds: 225.3 GB, 225380925440 bytes
255 heads, 63 sectors/track, 27401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
       Device Boot      Start         End      Blocks   Id  System
/dev/mds/mds1               1       24152   193992907   83  Linux
/dev/mds/mds2           24152       27401    26105594   83  Linux
# ls -l /dev/mds/mds*
lrwxrwxrwx 1 root root 19 Mar  3 11:17 /dev/mds/mds -> /dev/mapper/mds-mds

I think that I have to use dmsetup to create the devices: dmsetup create However, I have no idea where to start.

I would be very grateful if someone could advice me on how to proceed, because I have a finite time to keep this UAT environment down.

Best regards, J.

#1 lore raw
Quoted 1 line · On 03/03/2010 11:43 AM, J4 wrote:
# vgchange -a y mds

...

Quoted 2 lines
# ls /dev/mapper | grep mds
brw------- 1 root root 253, 11 Mar  3 11:17 /dev/mapper/mds-mds

So the only LV name "mds" there is properly activated.

LVM will not activate partitions on the LV automatically, but you can use "kpartx" utility to do that (see man kpartx).

Try "kpartx -a /dev/mds/mds"

(before deactivating LV you will need run kpartx -d to remove these partition mappings again.)

Milan

author
#2 lore raw

Dear Milan,

Marvellous. This solved the problem.

Many thanks and best wishes, J.

Quoted 17 lines · Milan Broz
Quoted 1 line · On 03/03/2010 11:43 AM, J4 wrote:
# vgchange -a y mds

...

Quoted 2 lines
# ls /dev/mapper | grep mds
brw------- 1 root root 253, 11 Mar  3 11:17 /dev/mapper/mds-mds

So the only LV name "mds" there is properly activated.

LVM will not activate partitions on the LV automatically, but you can use "kpartx" utility to do that (see man kpartx).

Try "kpartx -a /dev/mds/mds"

(before deactivating LV you will need run kpartx -d to remove these partition mappings again.)

Milan