Linux - NewbieThis 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
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 14 103424 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 14 1306 10380288 8e Linux LVM
/dev/sda3 1306 2610 10480089 8e Linux LVM
/dev/sda4 2611 5221 20972857+ 8e Linux LVM
If I try to create a new partition I'm told that I have to delete one to do that. Unfortunately this isn't possible as the data is live. I'm really at a loss here :-(
This is not related to LVM. You've hit the 4 partition limit of the MBR partition table.
The MBR only has room for four entries, limiting you to a maximum of four primary partitions. A workaround exists; one of the four primary partitions can be a so-called extended partision, which in turn can contain a number of sub-partitions ("logical" partitions).
Unfortunately, you've already created four primary partitions. You will need to convert the last of these to an extended partition containing a logical partition. This typically involves backing up data and deleting and recreating the partition in question, although various utilities exist which claim to be able to do a non-destructive conversion.
In either case, your existing /dev/sda4 partition will become /dev/sda5, so you'll need to reconfigure LVM.
These partitions are PVs in an LVM Volume Group, right? No, there's no way to simply merge the partitions. Each partition contains LVM metadata that identifies it as an LVM Physical Volume.
However, it is possible to add a temporary drive (say, an external USB drive) to the VG, use pvmove to migrate all data from /dev/sda4, and then remove /dev/sda4 from the VG with vgreduce.
You could then create an extended partition (/dev/sda4, which should take up all available disk space) and any number of logical partitions (/dev/sda5++), which you could then add back to the VG before using pvmove/vgreduce again to get rid of the temporary drive.
Actually, if that's not possible, if I add another physical HDD to the OS. Can I then create it as a new partition (I assume /dev/sdb1) and add that to the LVM without losing anything? If so, can someone please tell me the commands to do this?
Actually, if that's not possible, if I add another physical HDD to the OS. Can I then create it as a new partition (I assume /dev/sdb1) and add that to the LVM without losing anything?
Sure you can. Create a partition with fdisk (or whatever), run pvcreate on the partition, add it to the volume group with vgextend and extend any logical volume in the volume group with lvextend.
(Or use the new partition as temporary storage to migrate data from /dev/sda4, as I suggested in my previous post, which would allow you to repartition /dev/sda without losing data.)
So you'll wind up wasting half that (original) disk - no big deal I suppose these days. Allocating multiple pv's like that is limiting in a LVM setup.
In future you would be better off to have one large pv (maybe even the entire disk in the case of the new disk), and use vg's to carve it up if you wish; that way you can expand at will, and not waste disk real estate.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.