Skip to contentSkip to conversation

disk naming

linux-lvm Matt Schillinger 5 participants 15 messages Jan 3, 2003 – Jan 8, 2003

lore
Share & tools
lore
#0 lore raw

this should be a simple question, but I can't find a direct discussion in the lvm documentation. I believe that i have found that LVM will find appropriate PV's regardless of their name (sda,sdb).. Is this true? Do i need devfs to ensure that i always have the same disk naming, or will LVM handle this for me? I am currently using scsidev for naming purposes, but have found that vgcreate will not work with scsidev device names (/dev/scsi/sdh0-0c0i4l2p1) /dev/scsi/sd(host=0,scsiid=4,LUN=2,partition #=1)

..

Thanks,

Signature · 2 lines
Matt Schillinger
[email protected]
#1 lore raw
Quoted 3 lines · Matt Schillinger

this should be a simple question, but I can't find a direct discussion in the lvm documentation. I believe that i have found that LVM will find appropriate PV's regardless of their name (sda,sdb).. Is this true?

Kind of. When you created (maybe even just used) a PV/VG with DEVFS it will only work with devfs.
IIRC when you compile DEVFS into the kernel, but do not mount it, you can create PVs, but createvg will not find them unless you mount devfs.

Quoted 2 lines

Do i need devfs to ensure that i always have the same disk naming, or will LVM handle this for me?

devfs does not ensure you have the same names.

Quoted 4 lines

I am currently using scsidev for naming purposes, but have found that vgcreate will not work with scsidev device names (/dev/scsi/sdh0-0c0i4l2p1) /dev/scsi/sd(host=0,scsiid=4,LUN=2,partition #=1)

Most likely the userspace tools do not search the /dev/scsi/sdxxx devices for PV signatrue. IIRC there is one file where you can add them. It's in tools/lib/lvm_check_partitioned_dev.c but I've no idea how to add your devices.

Signature · 4 lines
Goetz Bock       (c) 2002 as     blacknet.de - Munich - Germany   /"\
IT Consultant    GNU FDL 1.1    secure mobile Linux everNETting   \ /
                                                                   X
 ASCII Ribbon Campaign against HTML email & microsoft attachments / \
#2 lore raw

If i'm NOT using devfs, can i reliably (assuming that disks are on the same scsi id/lun/host channel) use lvm?

Scenario:

LV is created with device /dev/sdd, which is on host channel 2

Machine is shutdown, and a new raid is connected on host channel 1, with one disk.

Machine is restarted, and the 1 disk on the host channel 1 raid takes /dev/sdd. The original disk is now /dev/sde.

Will LVM find the correct disk?

Matt Schillinger
[email protected]

Quoted 33 lines · Goetz Bock
Quoted 3 lines · Matt Schillinger

this should be a simple question, but I can't find a direct discussion in the lvm documentation. I believe that i have found that LVM will find appropriate PV's regardless of their name (sda,sdb).. Is this true?

Kind of. When you created (maybe even just used) a PV/VG with DEVFS it will only work with devfs.
IIRC when you compile DEVFS into the kernel, but do not mount it, you can create PVs, but createvg will not find them unless you mount devfs.

Quoted 2 lines

Do i need devfs to ensure that i always have the same disk naming, or will LVM handle this for me?

devfs does not ensure you have the same names.

Quoted 4 lines

I am currently using scsidev for naming purposes, but have found that vgcreate will not work with scsidev device names (/dev/scsi/sdh0-0c0i4l2p1) /dev/scsi/sd(host=0,scsiid=4,LUN=2,partition #=1)

Most likely the userspace tools do not search the /dev/scsi/sdxxx devices for PV signatrue. IIRC there is one file where you can add them. It's in tools/lib/lvm_check_partitioned_dev.c but I've no idea how to add your devices.

Signature · 10 lines
Goetz Bock       (c) 2002 as     blacknet.de - Munich - Germany   /"\
IT Consultant    GNU FDL 1.1    secure mobile Linux everNETting   \ /
                                                                   X
 ASCII Ribbon Campaign against HTML email & microsoft attachments / \

_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Signature · 5 lines
Matt Schillinger
System Administrator
FlightSafety International
[email protected]
314-551-8403
#3 lore raw
Quoted 7 lines · Matt Schillinger

If i'm NOT using devfs, can i reliably (assuming that disks are on the same scsi id/lun/host channel) use lvm?

Scenario:

LV is created with device /dev/sdd, which is on host channel 2

Quoted 8 lines

Machine is shutdown, and a new raid is connected on host channel 1, with one disk.

Machine is restarted, and the 1 disk on the host channel 1 raid takes /dev/sdd. The original disk is now /dev/sde.

Will LVM find the correct disk?

Yes, that'll work fine. Getting LVM to work with those scsidev names you mentioned in the first email will be quite a lot harder (unless you use LVM2).

patrick

#4 lore raw

Patrick,

I was wondering if you could explain a little bit of how lvm finds a device that no longer corresponds to the same 'dev/sd*' name. does it use some kind of device id or serial number? I just want to be doubly sure, as Steven Lembark claimed that it WOULDN't work..

Thanks,

Matt Schillinger
[email protected]

Quoted 29 lines · Patrick Caulfield
Quoted 7 lines · Matt Schillinger

If i'm NOT using devfs, can i reliably (assuming that disks are on the same scsi id/lun/host channel) use lvm?

Scenario:

LV is created with device /dev/sdd, which is on host channel 2

Quoted 8 lines

Machine is shutdown, and a new raid is connected on host channel 1, with one disk.

Machine is restarted, and the 1 disk on the host channel 1 raid takes /dev/sdd. The original disk is now /dev/sde.

Will LVM find the correct disk?

Yes, that'll work fine. Getting LVM to work with those scsidev names you mentioned in the first email will be quite a lot harder (unless you use LVM2).

patrick

_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Matt Schillinger
System Administrator
FlightSafety International
[email protected]
314-551-8403
#5 lore raw

-- Matt Schillinger <[email protected]>

Quoted 6 lines

Patrick,

I was wondering if you could explain a little bit of how lvm finds a device that no longer corresponds to the same 'dev/sd*' name. does it use some kind of device id or serial number? I just want to be doubly sure, as Steven Lembark claimed that it WOULDN't work..

LVM is going to look for, say, /dev/sda1. If the device at that location in your disk chain is not a PV then you will have problems. The "sda1" string say to access the first scsi drive that was put on line. Depending on controller issues you may get into situations where the SCSI initiators come on line in a random order and you have no way of knowing what "sda1" really means. The fix there is to install one of them as a module and only bring on line the controller with your boot drive on it at first.

--
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647

                                           +1 8773 252 1080
#6 lore raw
In reply to Matt Schillinger

-- Matt Schillinger <[email protected]>

Quoted 7 lines

If i'm NOT using devfs, can i reliably (assuming that disks are on the same scsi id/lun/host channel) use lvm?

Scenario:

LV is created with device /dev/sdd, which is on host channel 2

Quoted 7 lines

Machine is shutdown, and a new raid is connected on host channel 1, with one disk.

Machine is restarted, and the 1 disk on the host channel 1 raid takes /dev/sdd. The original disk is now /dev/sde.

Will LVM find the correct disk?

Nope. Main issue there is that the first disk device encountered by the kernel will be /dev/sda. Period.

This is the same catagory of problem you get into with DOS when adding a new drive displaces the "D:" partition on your first drive.

There are a few fixes for this:

1. Install the non-root drives' controller as a module and add /etc/rc.d/init.d/otherscsi to install the extra controller's module. At that point you are guaranteed not to find the RAID before you want to.

2. Devfs will solve this particular problem since the /dev/type/bus/target/item list has not changed. What will break devfs is adding a new controller on the PCI bus in a way that displaces your existing controler as, say, /dev/scsi/bus0.

--
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647

                                           +1 8773 252 1080
#7 lore raw
Quoted 14 lines · Steven Lembark

-- Matt Schillinger <[email protected]>

Quoted 10 lines

If i'm NOT using devfs, can i reliably (assuming that disks are on the same scsi id/lun/host channel) use lvm?

Scenario:

LV is created with device /dev/sdd, which is on host channel 2

Machine is shutdown, and a new raid is connected on host channel 1, with one disk.

Quoted 7 lines
Quoted 4 lines

Machine is restarted, and the 1 disk on the host channel 1 raid takes /dev/sdd. The original disk is now /dev/sde.

Will LVM find the correct disk?

Nope. Main issue there is that the first disk device encountered by the kernel will be /dev/sda. Period.

NOPE, NOPE, NOPE.

LVM writes a UUID to each disk and uses that as the PV identifier. it does NOT matter what it is called to the kernel. (as long as the device actually visible to the code).*

I regularly plug and unplug disks around LVM systems and it works just fine.

patrick

* by which I mean it's a "known device" and not some new device that hasn't been coded for in LVM (eg i2o block devs). This particular restriction is lifted in LVM2.

#8 lore raw
Quoted 8 lines

NOPE, NOPE, NOPE.

LVM writes a UUID to each disk and uses that as the PV identifier. it does NOT matter what it is called to the kernel. (as long as the device actually visible to the code).*

I regularly plug and unplug disks around LVM systems and it works just fine.

And you move the SCSI cards around so that their bus addresses are changed w/o having any effect on LVM?

--
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647

                                           +1 8773 252 1080
#9 lore raw
Quoted 7 lines · Steven Lembark
Quoted 7 lines

NOPE, NOPE, NOPE.

LVM writes a UUID to each disk and uses that as the PV identifier. it does NOT matter what it is called to the kernel. (as long as the device actually visible to the code).*

Quoted 5 lines
Quoted 2 lines

I regularly plug and unplug disks around LVM systems and it works just fine.

And you move the SCSI cards around so that their bus addresses are changed w/o having any effect on LVM?

No, but that makes no difference either. Linux allocates the first disk as sda and the second as sdb regardless of whether they are on the same controller or not.

LVM uses the UUID to identify PVs, NOT major/minor numbers or names (didn't I just say that?)

Signature · 1 line
patrick
#10 lore raw

-- Patrick Caulfield <[email protected]>

Quoted 14 lines · Steven Lembark
Quoted 7 lines
Quoted 7 lines

NOPE, NOPE, NOPE.

LVM writes a UUID to each disk and uses that as the PV identifier. it does NOT matter what it is called to the kernel. (as long as the device actually visible to the code).*

Quoted 5 lines
Quoted 2 lines

I regularly plug and unplug disks around LVM systems and it works just fine.

And you move the SCSI cards around so that their bus addresses are changed w/o having any effect on LVM?

Quoted 6 lines

No, but that makes no difference either. Linux allocates the first disk as sda and the second as sdb regardless of whether they are on the same controller or not.

LVM uses the UUID to identify PVs, NOT major/minor numbers or names (didn't I just say that?)

But if you switch two scsi controllers around it can leave one booted befre the other. You then end up with "sda" being the first disk on another scsi chain. I have seen this happen when people strip a machine and don't re-assemble the cards in the same order -- or do and the bus is reverse-ordered on the new system.

You can also have problems if devices on one scsi chain has devices on it that will sometimes slow down the card's bus scan. This shows up as machines that don't boot if there is media in one device. The card takes longer to init itself, the other card comes online first, and you have a reversal of bus0 and bus1.

Since the second card is frequently a different make or model it usually works to have that one as a module and insmod it in the rc.sysinit or SVR4 files. At that point you are guaranteed of getting the right card online first.

Try this on a system with two scsi cards and you'll see what I mean: without changing anything else, switch which of the cards the two disk chains connect to (i.e., disks on bus0 are now on bus1). Reboot the machine and see if it will boot successfully.

The UUID is bus specific.

--
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647

                                           +1 8773 252 1080
#11 lore raw
Quoted 5 lines · Steven Lembark

Try this on a system with two scsi cards and you'll see what I mean: without changing anything else, switch which of the cards the two disk chains connect to (i.e., disks on bus0 are now on bus1). Reboot the machine and see if it will boot successfully.

You're arguing about something different. Will LVM work if you move disks around? Yes. Will the box boot if you move disks around? Depends if you setup the box to do that. Booting has nothing to do with LVM.

Signature · 3 lines
Randomly Generated Tagline:
"Ever heard of .cshrc?
 That's a city in Bosnia.  Right?"      - Unknown
#12 lore raw
In reply to Steven Lembark
Quoted 10 lines · Steven Lembark

Try this on a system with two scsi cards and you'll see what I mean: without changing anything else, switch which of the cards the two disk chains connect to (i.e., disks on bus0 are now on bus1). Reboot the machine and see if it will boot successfully.

The UUID is bus specific.

No.

LVM puts it's OWN UUID on the disk. nothing to do with anybody elses UUID. It travels with the disk and has nothing to do with where the disk is. Even if it's over an NBD connection to another machine, LVM will find it and it will work.

Patrick

#13 lore raw

I have another scenario... If I have 1 volume setup (/dev/test_vg/testlv1) and mounted on say, /mnt.

The disk is connected via scsi host channel 0, scsi id 4, and lun 0.

If i umount /mnt,
move the scsi disk to host channel 1,

Then run rescan-scsi-bus.sh 1, it should scan the scsi bus on host channel 1, then find the scsi disk.

is there a way to make lvm see the new disk in a way that is mountable?

I have done the previous, but i see in /proc/lvm/global, that each VG is associated with PV devices (/dev/sda1, etc). Is there a way that lvm can rescan and reassociate VGs to new PV devices? (as in the disk on the host channel 1 is added in as /dev/sdd).. If i reboot, this is no problem to register things, but I am wonder if it is possible to do the task without a reboot..

Thanks,

Matt Schillinger
[email protected]

#14 lore raw
In reply to Matt Schillinger

-- Matt Schillinger <[email protected]>

Quoted 9 lines

this should be a simple question, but I can't find a direct discussion in the lvm documentation. I believe that i have found that LVM will find appropriate PV's regardless of their name (sda,sdb).. Is this true? Do i need devfs to ensure that i always have the same disk naming, or will LVM handle this for me? I am currently using scsidev for naming purposes, but have found that vgcreate will not work with scsidev device names (/dev/scsi/sdh0-0c0i4l2p1) /dev/scsi/sd(host=0,scsiid=4,LUN=2,partition #=1)

sd[abcd] notation is based on the order which the kernel finds devices on the bus. Adding a SCSI card or removing disks will change the naming.

devfs allows using /dev/scsi/.../busX/.../targetY/.../partZ, which will not change unless you shuffle the scsi cards :-)

I use it mainly because I prefer to know what I'm pointing at -- memorizing the device letter conventions can be an exercise in futility.

You can quickly convert from one naming convention to the other if your root volume isn't on LVM: boot single user, export the VG's and import them using the devfs naming convention.

-

Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647

                                           +1 773 252 1080