Error messages when using pvcreate on CentOS 6.5

General support questions
Post Reply
OtagoHarbour
Posts: 30
Joined: 2014/05/10 11:35:34

Error messages when using pvcreate on CentOS 6.5

Post by OtagoHarbour » 2014/06/01 20:53:35

I have a dual boot system where I partitioned the HD: ~30 GB for Ubuntu 11.4 and ~47 GB for CentOS 6.5. I would like to make a separate logical partition for /tmp and /home on the CentOS side. However, when I enter.

Code: Select all

sudo vgs
I get

Code: Select all

No volume groups found
When I enter

Code: Select all

sudo fdisk -l
I get the following

Code: Select all

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8b8e8b8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2            5953        9730    30336001    5  Extended
/dev/sda3              64        5953    47300608   83  Linux
/dev/sda5            5953        9600    29296640   83  Linux
/dev/sda6            9601        9730     1038336   82  Linux swap / Solaris

Partition table entries are not in disk order
So I try to set up physical volumes with pvcreate and get the following results.

Code: Select all

$ sudo pvcreate /dev/sda1
  Physical volume "/dev/sda1" successfully created
$ sudo pvcreate /dev/sda2
  dev_is_mpath: failed to get device for 8:2
  dev_is_mpath: failed to get device for 8:2
  Device /dev/sda2 not found (or ignored by filtering).
$ sudo pvcreate /dev/sda3
  Can't open /dev/sda3 exclusively.  Mounted filesystem?
$ sudo pvcreate /dev/sda5
  dev_is_mpath: failed to get device for 8:5
  Physical volume "/dev/sda5" successfully created
$ sudo pvcreate /dev/sda6
  dev_is_mpath: failed to get device for 8:6
  Can't open /dev/sda6 exclusively.  Mounted filesystem?
I'm guessing /dev/sda2 is the physical partition I am using for Ubuntu and I have not mouted that for security reasons. So I am guessing that is the reason for the error message.

I'm thiking /dev/sda1 is the boot partition but it forms a physical volume successfully. However, I would have thought that /dev/sda3 is the root partition so I thought it would be mounted already. Do I need to unmount it to make a physical volume from it? /dev/sda6 is presumably swap space. From what I have read, this could have its own partition or share an existing logical volume. However it is not clear to me why I was unable to form a physical volume from it. Does it also need to be unmounted?

Many thanks in advance,
OH

User avatar
TrevorH
Forum Moderator
Posts: 23665
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Error messages when using pvcreate on CentOS 6.5

Post by TrevorH » 2014/06/01 21:07:18

Congratulations, this
$ sudo pvcreate /dev/sda1
Physical volume "/dev/sda1" successfully created
almost certainly just overwrote your /boot partition starting sectors with junk. Running pvcreate is a destructive process and writes to the first few sectors of the partition in question. Any data that was there, is not any more.

Luckily, /dev/sda2 is your extended partition, dev/sda3 is already mounted so it refused to do anything to it and /dev/sda6 is your swap partition which is also in use so was saved. However, /dev/sda5 has also suffered the same fate as /dev/sda1 and you should treat it as potentially compromised data :-( That was your Ubuntu partition by the looks of it since you say that had 30GB and that's the only partition you listed that's close to that size.

If you want to create an LVM physical volume then it wants to own the entire partition that you use for it. It should also be tagged as type 0x8e in fdisk.

What you have on your system right now are a bunch of 'MSDOS' style partitions that contain filesystems. You cannot use those for LVM without destroying the filesystems and data that reside on them at the present time.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

OtagoHarbour
Posts: 30
Joined: 2014/05/10 11:35:34

Re: Error messages when using pvcreate on CentOS 6.5

Post by OtagoHarbour » 2014/06/01 22:21:00

Does that mean I will not be able to reboot this computer? I am currently logged in. What would be the best way to fix the situation? I did see instructions about repairing a cirrpted boot partition here. Is that what I need to do or could I just copy files from the installation DVD to /boot?

What would be the correct way to go about setting up logical volumes? Would I need to back up everything and start from scratch? I did see here that the partition type should be converted to 0x8E using fdisk. Are there any things to be careful about there. I don;t want to make a bad situation worse.

I was able to explore the /boot directory using places:Computer but the Ubuntu partition seems to be gone. Whe I try to access it I get

Code: Select all

Unable to mount 524 MB Filesystem
Error mounting: mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
I think I have backed up the files from the Ubuntu side. Could I could use that partition for CentOS /tmp and /home?

Thanks,
OH

drk
Posts: 395
Joined: 2014/01/30 20:38:28

Re: Error messages when using pvcreate on CentOS 6.5

Post by drk » 2014/06/02 04:28:19

Different machine than what you were wrestling with here: viewtopic.php?f=13&t=46235 ?

giaitri321
Posts: 1
Joined: 2014/06/02 09:09:39
Contact:

Re: Error messages when using pvcreate on CentOS 6.5

Post by giaitri321 » 2014/06/02 09:13:28

You need unpartitioned space, not an empty partition.
Tai game cho de - Tải ngay Phong Van Truyen Ky cho điện thoại

OtagoHarbour
Posts: 30
Joined: 2014/05/10 11:35:34

Re: Error messages when using pvcreate on CentOS 6.5

Post by OtagoHarbour » 2014/06/02 12:04:08

drk wrote:Different machine than what you were wrestling with here: viewtopic.php?f=13&t=46235 ?
Yes. They are different. I thought I set them up the same way except, with this one, I needed to do a bit more manually since I wanted to dual boot with a different Linux distro whereas with the other one I just chose one of the defaults wich was to dual boot with a Windows dsitro. With the other one, it was already set up to LVM when I installed CentOS 6.5. But with this one it was not. This one is c.2001 whereas the other one is only a couple of years old. I'm not sure if that has anything to do with it.

Thanks,
OH

OtagoHarbour
Posts: 30
Joined: 2014/05/10 11:35:34

Re: Error messages when using pvcreate on CentOS 6.5

Post by OtagoHarbour » 2014/06/02 12:11:11

giaitri321 wrote:You need unpartitioned space, not an empty partition.
So far, it seems to be working.

Code: Select all

$ sudo vgcreate vg_web /dev/sda5
  Volume group "vg_web" successfully created
$ sudo vgs
  VG     #PV #LV #SN Attr   VSize  VFree 
  vg_web   1   0   0 wz--n- 27.94g 27.94g
Thanks,
OH

Post Reply