1834601 Members
3536 Online
110069 Solutions
New Discussion

lvcreate

 
SOLVED
Go to solution
Alex Lavrov
Regular Advisor

lvcreate

Hello people,

When I create a logical volume on vg01, I get the following error:
#lvcreate -L 100 vg01
lvcreate: Logical volume "/dev/vg01/lvol48" already exists.

So I looked at /dev/vg01 directory and I noticed that there is a difference between the device file names and their minor numbers. lvols 1-34 are ok: their minor numbers are 0x010001-0x010022.
lvol 35 does not exist. lvol 36 has minor number 0x010023 instead of 0x010024. The mess continues until lvol 49, which has minor number 0x01002f (47 in decimal). So, when I run lvcreate, it looks for the first free minor number, which is 0x010030 (48 in decimal), but it fails because lvol48 already exists.

Does anyone knows how to fix this problem? I don't want to use lvcreate -n every time I want to create a logical volume.

Thanx.
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: lvcreate

Cleaning up the minor numbers almost always fixes this.

If the minor number does not belong removal is in order.

doing a -n with proper automated names will still leave you with a volume group you can export and import.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
T. M. Louah
Esteemed Contributor

Re: lvcreate

Humm .. worst case will be to vgexport without (NO) "-m" option then vgimport this will reset all lvols.
can you list vgdisplay vg01 ? check Cur PV & Act PV & open LV ... all that good stuff.
I would try vgxport/vgimport, but you have to deactivate vg b4 vgexporting, that means unmounting filesystems first.

Little learning is dangerous!
Alex Lavrov
Regular Advisor

Re: lvcreate

vgexport/vgimport solution is risky: after doing vgimport without -m option, I wont know the proper order of the new lvols (for example, I wont know what was the previous name of lvol35).

What do you mean in "cleaning up the minor numbers"?

10x.
Stuart Abramson_2
Honored Contributor
Solution

Re: lvcreate

I don't think you can change the minor numbers. But you CAN change the LV-names:

If the file system is not part of the "boot sequence", you can just

umount /fs
cd /dev/vgXX
mv block_old block_new
mv raw_old raw_new
vi /etc/fstab
change old to new
mount /fs

You can change /dev/vgXX/lvolNN to /dev/vgXX/lvolYY.

But, I think you should get used to creating new lvols with the "-n lvolNN" option. what's the problem there?
Wouter Jagers
Honored Contributor

Re: lvcreate

Indeed. The minor numbers are looking good, you're just missing that lvol35.

It will take a lot of mounting, unmounting and (don't forget !!) editing fstab, but it will be ok when you rename 36 to 35, 37 to 36 and so on.

It's a dirty job, but..

greets
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
T. M. Louah
Esteemed Contributor

Re: lvcreate

You can change the minor number with another unique one:
crw-r----- 1 root sys 64 0x000004 Aug 21 08:58 /dev/vg00/rlvol4

here is an example :
# mknod /dev/vg00/rlvol4 c 64 0x00000a
# mknod /dev/vg00/lvol4 b 64 0x00000a
# ll /dev/vg00/*lvol4
brw-rw-rw- 1 root sys 64 0x00000a Dec 27 14:08 /dev/vg00/lvol4
crw-rw-rw- 1 root sys 64 0x00000a Dec 27 14:06 /dev/vg00/rlvol4

Happy 200.4 all
Little learning is dangerous!