LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices



Reply
 
Search this Thread
Old 09-12-2009, 07:35 PM   #1
emrebilmuh
LQ Newbie
 
Registered: Sep 2009
Distribution: RHEL, Centos, Pardus, OpenSuse, Unslung, Ubuntu
Posts: 15

Rep: Reputation: 1
Post changing pv with its multipath volume


Hi,

I have a volume group contains non-multipath physical volumes such as /dev/sda. I want make /dev/sda as multipath device such as /dev/dm-1. But i don't know how make the volume group recognize this physical volume(/dev/dm-1) as it has before(/dev/sda). Actually the question is how to change the physical volume name in the volume group without any disruption...


Thank you for your responses in advance...
 
Old 09-12-2009, 10:09 PM   #2
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
You really don't change the physical volume name in the volume group. You 'pvscan' and LVM looks at all the eligible volumes to see if they have LVM metadata on them.

In your /etc/lvm/lvm.conf file there are two things you want to look at. One is the filter value and the other is preferred_names. The filter value tells LVM what block devices it should look at; preferred_names says which device name to use when it prints out info if there is more than one name representing the same device. (There might be two or three devices that have the same major/minor number...)

I assume that you have multiple paths to your PV device (using DM-multipath?) so that you have a device that you want LVM to recognise and use in place of the single path to that device.

You need to edit filter= in /etc/lvm/lvm.conf, then issue a 'pvscan'. You should filter out the devices you don't want used (reject) and filter in the devices you do want used (accept).

If you 'pvscan -vv' or 'pvscan -vvv', it'll show you which devices are considered or not considered to be part of LVM. Then 'vgscan -vvv' to see what it thinks.

This may or may not be disruptive. The safest thing would be to unmount all of the logical volume in the volume group before you do any of this... Be cautious and careful...

I've never gone from single path to multipath device, so it'd be nice if someone could weigh in on the logistics and safety of doing so.

As always, ymmv and good luck.
 
Old 09-13-2009, 02:21 AM   #3
elcody02
Member
 
Registered: Jun 2007
Posts: 52

Rep: Reputation: 17
Have a look at this thread it should also work in your case.
vgcreate-command-is-changing-devmapper-as-pv-name-in-pvdisplay-to-devdm-xx-path.

In stead of filtering as described above (which will also work) using the
Quote:
preferred_name
should work as well.
 
Old 09-14-2009, 09:25 AM   #4
emrebilmuh
LQ Newbie
 
Registered: Sep 2009
Distribution: RHEL, Centos, Pardus, OpenSuse, Unslung, Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 1
From the suggested topic:

"If i change /etc/lvm/lvm.conf with the new "preferred_names" parameters and run pvs, lvm recognizes the existing physical volumes through their new device pathes?

Or doesn't matter if i unmount the filesystems or not, what should i do to do that exactly with no data loss?"
 
Old 09-14-2009, 01:01 PM   #5
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
We're missing what your "preferred_names" and "filter" statements in lvm.conf look like. Please post them here.

I may be wrong, as I'm often wrong, but I'm not convinced that changing just the "preferred_names" will get LVM to use the multipath device. I still think it depends on what is in your "filter" statement.

I would suggest changing the "preferred_names" to
Code:
preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
then run 'pvscan -vvv' and post the results here. Also include the output from a 'pvs' command and an 'multipath -ll' command.

Here's what one of my systems looks like. Note that /dev/mapper/mpath0 and /dev/dm-7 are the same device, but preferred_names tells LVM to use /dev/mapper/mpath0 in displays.
Code:
[root@xlabwz2l ~]# multipath -ll
mpath0 (36005076305ffc1870000000000000400) dm-7 IBM,2107900
[size=50G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=2][active]
 \_ 0:0:0:1 sda 8:0   [active][ready]
 \_ 1:0:0:1 sdb 8:16  [active][ready]

[root@xlabwz2l ~]# ll /dev/mapper/mpath0
brw-rw---- 1 root disk 253, 7 Sep 11 13:42 /dev/mapper/mpath0

[root@xlabwz2l ~]# ll /dev/dm-7
brw-rw---- 1 root root 253, 7 Sep 11 13:42 /dev/dm-7

[root@xlabwz2l ~]# grep "filter =\|preferred_names =" /etc/lvm/lvm.conf
    preferred_names = [ "^/dev/mapper/mpath", "^/dev/[hs]d" ]
    filter = [ "a|dasda|", "a|/dev/mapper/mpath.*|", "r|.*|" ]

[root@xlabwz2l ~]# pvs
  PV                 VG     Fmt  Attr PSize  PFree
  /dev/dasda2        rootvg lvm2 a-   24.88G  4.38G
  /dev/mapper/mpath0 uservg lvm2 a-   50.00G 30.00G

[root@xlabwz2l ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  rootvg   1   7   0 wz--n- 24.88G  4.38G
  uservg   1   3   0 wz--n- 50.00G 30.00G

[root@xlabwz2l ~]# lsscsi
[0:0:0:1]    disk    IBM      2107900          1.50  /dev/sda
[1:0:0:1]    disk    IBM      2107900          1.50  /dev/sdb
And a 'pvscan -vvv'. Note where it says "Walking through all physical volumes", then "/dev/sda: Skipping (regex)", "/dev/sdb: Skipping (regex)", and "Using /dev/mapper/mpath0", etc.
Code:
[root@xlabwz2l ~]# pvscan -vvv
        Processing: pvscan -vvv
        O_DIRECT will be used
      Setting global/locking_type to 1
      File-based locking selected.
      Setting global/locking_dir to /var/lock/lvm
    Wiping cache of LVM-capable devices
        /dev/console: Not a block device
        /dev/core: Not a block device
        /dev/dasd/0.0.0201/disc: Added to device cache
        /dev/dasd/0.0.0201/part1: Already in device cache
        /dev/dasd/0.0.0201/part2: Already in device cache
        /dev/dasda: Aliased to /dev/dasd/0.0.0201/disc in device cache
(preferred name)
        /dev/dasda1: Already in device cache
        /dev/dasda2: Already in device cache
        /dev/dasd_eer: Not a block device
        /dev/dcssblk0: Added to device cache
        /dev/disk/by-id/scsi-36005076305ffc1870000000000000400: Added to
devicecache
        /dev/disk/by-label/boot: Already in device cache
        /dev/disk/by-path/ccw-0.0.0201: Aliased to /dev/dasda in device
cache
        /dev/disk/by-path/ccw-0.0.0201-part1: Already in device cache
        /dev/disk/by-path/ccw-0.0.0201-part2: Already in device cache

/dev/disk/by-path/ccw-0.0.0300-zfcp-0x5005076305034187:0x400440000000000
0: Added to device cache

/dev/disk/by-path/ccw-0.0.0310-zfcp-0x5005076305084187:0x400440000000000
0: Aliased to /dev/disk/by-id/scsi-36005076305ffc1870000000000000400 in
device cache

        /dev/disk/by-uuid/b6d11836-0ed9-4dff-b42d-27aa3596712f: Already
in device cache
        /dev/dm-7: Already in device cache
        /dev/fd: Symbolic link to directory
        /dev/full: Not a block device
        /dev/initctl: Not a block device
        /dev/kmsg: Not a block device
        /dev/log: Not a block device
        /dev/loop0: Added to device cache
        /dev/loop1: Added to device cache
        /dev/loop2: Added to device cache
        /dev/loop3: Added to device cache
        /dev/loop4: Added to device cache
        /dev/loop5: Added to device cache
        /dev/loop6: Added to device cache
        /dev/loop7: Added to device cache
        /dev/MAKEDEV: Not a block device
        /dev/mapper/control: Not a block device
        /dev/mapper/mpath0: Already in device cache
        /dev/mapper/rootvg-home: Added to device cache
        /dev/mapper/rootvg-midrange: Added to device cache
        /dev/mapper/rootvg-minidisk01: Added to device cache
        /dev/mapper/rootvg-opt: Added to device cache
        /dev/mapper/rootvg-root: Added to device cache
        /dev/mapper/rootvg-swap: Added to device cache
        /dev/mapper/rootvg-var: Added to device cache
        /dev/mapper/uservg-saved_lab1: Added to device cache
        /dev/mapper/uservg-saved_lab2: Added to device cache
        /dev/mapper/uservg-zfcp01: Added to device cache
        /dev/md0: Added to device cache
        /dev/mem: Not a block device
        /dev/mpath/mpath0: Already in device cache
        /dev/net/tun: Not a block device
        /dev/null: Not a block device
        /dev/parport0: Not a block device
        /dev/parport1: Not a block device
        /dev/parport2: Not a block device
        /dev/parport3: Not a block device
        /dev/port: Not a block device
        /dev/ppp: Not a block device
        /dev/ptmx: Not a block device
        /dev/pts/0: Not a block device
        /dev/ram: Added to device cache
        /dev/ram0: Added to device cache
        /dev/ram1: Aliased to /dev/ram in device cache
        /dev/ram10: Added to device cache
        /dev/ram11: Added to device cache
        /dev/ram12: Added to device cache
        /dev/ram13: Added to device cache
        /dev/ram14: Added to device cache
        /dev/ram15: Added to device cache
        /dev/ram2: Added to device cache
        /dev/ram3: Added to device cache
        /dev/ram4: Added to device cache
        /dev/ram5: Added to device cache
        /dev/ram6: Added to device cache
        /dev/ram7: Added to device cache
        /dev/ram8: Added to device cache
        /dev/ram9: Added to device cache
        /dev/ramdisk: Aliased to /dev/ram0 in device cache (preferred
name)
        /dev/random: Not a block device
        /dev/root: Aliased to /dev/mapper/rootvg-root in device cache
(preferred name)
        /dev/rootvg/home: Aliased to /dev/mapper/rootvg-home in device
cache (preferred name)
        /dev/rootvg/midrange: Aliased to /dev/mapper/rootvg-midrange in
device cache (preferred name)
        /dev/rootvg/minidisk01: Aliased to /dev/mapper/rootvg-minidisk01
in device cache (preferred name)
        /dev/rootvg/opt: Aliased to /dev/mapper/rootvg-opt in device
cache (preferred name)
        /dev/rootvg/root: Aliased to /dev/root in device cache
        /dev/rootvg/swap: Aliased to /dev/mapper/rootvg-swap in device
cache (preferred name)
        /dev/rootvg/var: Aliased to /dev/mapper/rootvg-var in device
cache (preferred name)
        /dev/rtc: Not a block device
        /dev/sda: Aliased to
/dev/disk/by-path/ccw-0.0.0300-zfcp-0x5005076305034187:0x400440000000000
0 in device cache (preferred name)
        /dev/sdb: Aliased to
/dev/disk/by-id/scsi-36005076305ffc1870000000000000400 in device cache
(preferred name)
        /dev/sg0: Not a block device
        /dev/sg1: Not a block device
        /dev/stderr: Not a block device
        /dev/stdin: Not a block device
        /dev/stdout: Not a block device
        /dev/systty: Not a block device
        /dev/tty: Not a block device
        /dev/ttyS0: Not a block device
        /dev/ttyS1: Not a block device
        /dev/ttyS2: Not a block device
        /dev/ttyS3: Not a block device
        /dev/ttysclp0: Not a block device
        /dev/urandom: Not a block device
        /dev/uservg/saved_lab1: Aliased to /dev/mapper/uservg-saved_lab1
in device cache (preferred name)
        /dev/uservg/saved_lab2: Aliased to /dev/mapper/uservg-saved_lab2
in device cache (preferred name)
        /dev/uservg/zfcp01: Aliased to /dev/mapper/uservg-zfcp01 in
device cache (preferred name)
        /dev/X0R: Not a block device
        /dev/zero: Not a block device
        /dev/zfcp_cfdc: Not a block device
    Wiping internal VG cache
    Walking through all physical volumes
        /dev/ramdisk: Skipping (regex)
        /dev/loop0: Skipping (sysfs)
        /dev/sda: Skipping (regex)
        /dev/md0: Skipping (regex)
        Opened /dev/dasda RO
      /dev/dasda: size is 52428782 sectors
        /dev/dasda: block size is 1024 bytes
        /dev/dasda: Skipping: Partition table signature found
        Closed /dev/dasda
        /dev/dcssblk0: Skipping (regex)
        /dev/root: Skipping (regex)
        /dev/ram: Skipping (regex)
        /dev/loop1: Skipping (sysfs)
        Opened /dev/dasda1 RO
      /dev/dasda1: size is 204799 sectors
        Closed /dev/dasda1
      /dev/dasda1: size is 204799 sectors
        Opened /dev/dasda1 RO O_DIRECT
        /dev/dasda1: block size is 1024 bytes
        Closed /dev/dasda1
        Using /dev/dasda1
        Opened /dev/dasda1 RO O_DIRECT
        /dev/dasda1: block size is 1024 bytes
      /dev/dasda1: No label detected
        Closed /dev/dasda1
        /dev/rootvg/home: Skipping (regex)
        /dev/ram2: Skipping (regex)
        /dev/loop2: Skipping (sysfs)
        Opened /dev/dasda2 RO
      /dev/dasda2: size is 52219904 sectors
        Closed /dev/dasda2
      /dev/dasda2: size is 52219904 sectors
        Opened /dev/dasda2 RO O_DIRECT
        /dev/dasda2: block size is 4096 bytes
        Closed /dev/dasda2
        Using /dev/dasda2
        Opened /dev/dasda2 RO O_DIRECT
        /dev/dasda2: block size is 4096 bytes
      /dev/dasda2: lvm2 label detected
        lvmcache: /dev/dasda2: now orphaned
        /dev/dasda2: Found metadata at 51712 size 2362 for rootvg
(UbQG3P-UQfk-KBhs-0XGD-zBVU-BeWR-05GCQR)
        lvmcache: /dev/dasda2: now in VG rootvg
        lvmcache: /dev/dasda2: setting rootvg VGID to
UbQG3PUQfkKBhs0XGDzBVUBeWR05GCQR
        lvmcache: /dev/dasda2: VG rootvg: Set creation host to xlabwz2l.
        Closed /dev/dasda2
        /dev/rootvg/opt: Skipping (regex)
        /dev/ram3: Skipping (regex)
        /dev/loop3: Skipping (sysfs)
        /dev/rootvg/midrange: Skipping (regex)
        /dev/ram4: Skipping (regex)
        /dev/loop4: Skipping (sysfs)
        /dev/rootvg/var: Skipping (regex)
        /dev/ram5: Skipping (regex)
        /dev/loop5: Skipping (sysfs)
        /dev/rootvg/swap: Skipping (regex)
        /dev/ram6: Skipping (regex)
        /dev/loop6: Skipping (sysfs)
        /dev/rootvg/minidisk01: Skipping (regex)
        /dev/ram7: Skipping (regex)
        /dev/loop7: Skipping (sysfs)
        Opened /dev/mapper/mpath0 RO
      /dev/mapper/mpath0: size is 104857600 sectors
        Closed /dev/mapper/mpath0
      /dev/mapper/mpath0: size is 104857600 sectors
        Opened /dev/mapper/mpath0 RO O_DIRECT
        /dev/mapper/mpath0: block size is 4096 bytes
        Closed /dev/mapper/mpath0
        Using /dev/mapper/mpath0
        Opened /dev/mapper/mpath0 RO O_DIRECT
        /dev/mapper/mpath0: block size is 4096 bytes
      /dev/mapper/mpath0: lvm2 label detected
        lvmcache: /dev/mapper/mpath0: now orphaned
        /dev/mapper/mpath0: Found metadata at 11776 size 1341 for uservg
(5U24Qp-pc28-NXYg-yBw7-n8Wj-ARhB-eGMORo)
        lvmcache: /dev/mapper/mpath0: now in VG uservg
        lvmcache: /dev/mapper/mpath0: setting uservg VGID to
5U24Qppc28NXYgyBw7n8WjARhBeGMORo
        lvmcache: /dev/mapper/mpath0: VG uservg: Set creation host to
xlabwz2l.
        Closed /dev/mapper/mpath0
        /dev/ram8: Skipping (regex)
        /dev/uservg/zfcp01: Skipping (regex)
        /dev/ram9: Skipping (regex)
        /dev/uservg/saved_lab1: Skipping (regex)
        /dev/ram10: Skipping (regex)
        /dev/uservg/saved_lab2: Skipping (regex)
        /dev/ram11: Skipping (regex)
        /dev/ram12: Skipping (regex)
        /dev/ram13: Skipping (regex)
        /dev/ram14: Skipping (regex)
        /dev/ram15: Skipping (regex)
        /dev/sdb: Skipping (regex)
        Opened /dev/mapper/mpath0 RO O_DIRECT
        /dev/mapper/mpath0: block size is 4096 bytes
      /dev/mapper/mpath0: lvm2 label detected
        /dev/mapper/mpath0: Found metadata at 11776 size 1341 for uservg
(5U24Qp-pc28-NXYg-yBw7-n8Wj-ARhB-eGMORo)
        Closed /dev/mapper/mpath0
        Opened /dev/mapper/mpath0 RO O_DIRECT
        /dev/mapper/mpath0: block size is 4096 bytes
      /dev/mapper/mpath0: lvm2 label detected
        /dev/mapper/mpath0: Found metadata at 11776 size 1341 for uservg
(5U24Qp-pc28-NXYg-yBw7-n8Wj-ARhB-eGMORo)
        Read uservg metadata (7) from /dev/mapper/mpath0 at 11776 size
1341
        Closed /dev/mapper/mpath0
        /dev/mapper/mpath0 0:      0   2560: zfcp01(0:0)
        /dev/mapper/mpath0 1:   2560   1280: saved_lab1(0:0)
        /dev/mapper/mpath0 2:   3840   1280: saved_lab2(0:0)
        /dev/mapper/mpath0 3:   5120   7679: NULL(0:0)
        Opened /dev/dasda2 RO O_DIRECT
        /dev/dasda2: block size is 4096 bytes
      /dev/dasda2: lvm2 label detected
        /dev/dasda2: Found metadata at 51712 size 2362 for rootvg
(UbQG3P-UQfk-KBhs-0XGD-zBVU-BeWR-05GCQR)
        Closed /dev/dasda2
        Opened /dev/dasda2 RO O_DIRECT
        /dev/dasda2: block size is 4096 bytes
      /dev/dasda2: lvm2 label detected
        /dev/dasda2: Found metadata at 51712 size 2362 for rootvg
(UbQG3P-UQfk-KBhs-0XGD-zBVU-BeWR-05GCQR)
        Read rootvg metadata (25) from /dev/dasda2 at 51712 size 2362
        Closed /dev/dasda2
        /dev/dasda2 0:      0     64: root(0:0)
        /dev/dasda2 1:     64     64: home(0:0)
        /dev/dasda2 2:    128     64: opt(0:0)
        /dev/dasda2 3:    192     16: midrange(0:0)
        /dev/dasda2 4:    208     32: var(0:0)
        /dev/dasda2 5:    240     32: swap(0:0)
        /dev/dasda2 6:    272     64: midrange(16:0)
        /dev/dasda2 7:    336    320: minidisk01(0:0)
        /dev/dasda2 8:    656    140: NULL(0:0)
  PV /dev/mapper/mpath0   VG uservg   lvm2 [50.00 GB / 30.00 GB free]
  PV /dev/dasda2          VG rootvg   lvm2 [24.88 GB / 4.38 GB free]
  Total: 2 [74.87 GB] / in use: 2 [74.87 GB] / in no VG: 0 [0   ]
[root@xlabwz2l ~]#
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing FM radio volume with gammu? iusegnu Linux - Software 0 11-27-2008 10:09 PM
changing system volume in C knobby67 Programming 0 08-23-2006 02:21 PM
changing volume in mplayer jods Linux - Software 4 03-30-2004 05:42 PM
kmix not changing volume Moebius Linux - Software 0 02-15-2004 08:17 PM
Changing sound volume cli_man Linux - General 6 06-11-2002 06:51 AM


All times are GMT -5. The time now is 08:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration