Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 6271 50056192 83 Linux
/dev/sda3 6271 6528 2064384 82 Linux swap / Solaris
[root@example ~]# pvcreate /dev/sda1
Can't open /dev/sda1 exclusively. Mounted filesystem?
[root@example ~]# pvcreate /dev/sda2
Can't open /dev/sda2 exclusively. Mounted filesystem?
[root@example ~]# pvcreate /dev/sda3
Can't open /dev/sda3 exclusively. Mounted filesystem?
Last edited by LittleMaster; 06-15-2012 at 08:46 AM.
The message is clearly suggesting it thinks your partitions are already in use.
What do you see when you run "df -h"? What do you see when you run "swapon -s"? What is in your /etc/fstab?
Also your partition TYPES are incorrect. Linux is for use as normal partition - You need to use fdisk to change the type to Linux LVM. Linux Swap is a special partition type used for swap devices and won't show up in df but may be in your /etc/fstab.
In essence your virtual machine (VM) appears to have been laid using standard partitioning on the assumption you'll use partitions for your devices rather than logical volumes (LVs).
swapon confirms you're using /dev/sda3 for swap so it can't be used for LVM unless you remove it as a swap device then change its type as previously mentioned.
Your other filesystems are in fstab using UUID rather than device. However you can find the UUID for your partitions by running:
blkid <device>
e.g.
blkid /dev/sda1
You will likely see that the UUIDs shown by blkid for the partitions matches what you have in /etc/fstab which would mean the devices are in fact used for filesystem.
Your issue isn't knowing how to do LVM but rather that you don't understand basic setups such as fdisk partitioning and filesystems creation. You need to go back to some basics. LVM lives on top of disks/partitions. To set it up you must have free disk space/partitions and what you've shown so far indicates that you don't.
Usually you setup the initial layout during the OS installation. When installing the OS on the VM you should see a choice for how to lay things out and it may default to partitioning but allow you to do LVM (or meta disks for software RAID). How that is done depends on lot on your distribution so I'd suggest you review the documentation for installing your distribution.
It isn't impossible to remove existing filesystems and redo setup for LVM but this gets a bit complicated so it would be simpler if you did the correct choices during installation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.