Page 1 of 1

Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/01 20:53:35
by OtagoHarbour
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

Re: Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/01 21:07:18
by TrevorH
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.

Re: Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/01 22:21:00
by OtagoHarbour
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

Re: Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/02 04:28:19
by drk
Different machine than what you were wrestling with here: viewtopic.php?f=13&t=46235 ?

Re: Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/02 09:13:28
by giaitri321
You need unpartitioned space, not an empty partition.

Re: Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/02 12:04:08
by OtagoHarbour
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

Re: Error messages when using pvcreate on CentOS 6.5

Posted: 2014/06/02 12:11:11
by OtagoHarbour
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