LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-01-2016, 09:23 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 235

Rep: Reputation: Disabled
How to create physical volume using UUIDs?


Code:
[user1@localhost dev]$ blkid
/dev/block/8:2: UUID="9GDPNw-xTSk-1eAL-ykft-fpli-0sJf-5fUIzg" TYPE="LVM2_member" 
/dev/block/253:0: UUID="07331e84-c8cd-480c-ae26-4bddcc469d52" TYPE="xfs" 
/dev/block/8:1: UUID="d3d5cb23-fcdf-4bb5-8336-83f1c6fea777" TYPE="xfs" 
/dev/block/253:1: UUID="158845f7-2af5-417f-b09b-f3ee465fd097" TYPE="swap" 
/dev/sr0: UUID="2016-03-04-16-45-10-00" LABEL="VBOXADDITIONS_5.0.16_105871" TYPE="iso9660"
/dev/sda5: UUID="8aa209c9-8550-4e76-9d1c-878fc6f5b160" TYPE="ext4" 
/dev/sda7: UUID="359a9846-9ffb-4fa6-aae4-62c1ec3348e9" TYPE="swap" 
/dev/sda8: UUID="4fef6531-858f-47e8-ba20-89b01e824696" TYPE="ext4" 
/dev/sda6: UUID="4b87b251-652b-4966-9f60-e487487cc411" TYPE="ext4"

[user1@localhost dev]$ sudo pvdisplay
[sudo] password for user1: 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos
  PV Size               10.21 GiB / not usable 3.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              2612
  Free PE               1
  Allocated PE          2611
  PV UUID               9GDPNw-xTSk-1eAL-ykft-fpli-0sJf-5fUIzg
Create physical volume, pv1, using UUID for /dev/sda5:
Code:
[user1@localhost dev]$ sudo pvcreate --norestorefile -u 8aa209c9-8550-4e76-9d1c-878fc6f5b160 pv1
  Device pv1 not found (or ignored by filtering).

[user1@localhost dev]$ sudo pvcreate --norestorefile -u 8aa209c9-8550-4e76-9d1c-878fc6f5b160
  Can only set uuid on one volume at once
  Run `pvcreate --help' for more information.
Not able to create pv1.
What did I missed?
Thanks.

Last edited by fanoflq; 06-01-2016 at 09:24 PM.
 
Old 06-01-2016, 09:31 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,151

Rep: Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203
Well, I don't do this too much, but it certainly appears that you're trying to assign the same UUID to two volumes.

Every volume must have a unique UUID. While you can use the -u option to specify the UUID that is to be assigned, instead of letting pvcreate coin one for you at random, the ID that is finally assigned must be unique. It must refer to one, and only one, volume.

You do not need to specify a UUID unless you particularly want to ...
 
Old 06-01-2016, 09:59 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,930

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
You need to specify the physical device i.e.
Code:
sudo pvcreate --norestorefile -u 8aa209c9-8550-4e76-9d1c-878fc6f5b160 /dev/sda5
pvcreate will automatically generate a random UUID. I see no reason why the existing uuid can not be reused. You might want to change the partition ID to LVM for /dev/sda5.

Backup any existing data on sda5 if necessary.

Last edited by michaelk; 06-01-2016 at 10:35 PM.
 
1 members found this post helpful.
Old 06-01-2016, 11:53 PM   #4
fanoflq
Member
 
Registered: Nov 2015
Posts: 235

Original Poster
Rep: Reputation: Disabled
I misunderstood the purpose of UUID in the command line.
I thought if I specify the UUID of the physical device, then pvcreate will
look for the physical device and label it a physical volume.

Instead, it is using the UUID provided in the command line as the new UUID
for the newly created physical volume.

Addendum:
UUID for physical volume can be the same as its associated physical device.

Thanks.

Last edited by fanoflq; 06-01-2016 at 11:55 PM.
 
Old 06-02-2016, 12:01 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,959

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by fanoflq View Post
UUID for physical volume can be the same as its associated physical device.
"Can be" in the sense that nothing checks whether you are doing that. That doesn't change the fact that it's a really bad idea.
 
  


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
Problems with pvcreate to create a physical volume on RAID 1 georgexd Linux - Software 3 07-30-2010 06:16 AM
Problems with pvcreate to create a physical volume for RAID 1 georgexd Linux - General 1 07-29-2010 09:25 AM
Problems With LVM i cant create physical Volume msanguino Linux - Software 4 03-23-2009 06:12 PM
LVM: How to create logical (physical) volume with extent sie 32 Mb consistgd Linux - Software 4 11-14-2006 06:03 PM


All times are GMT -5. The time now is 02:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration