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.
I'm having a hell of a time here, not sure what is needed. So I've created a Centos VM on VirtualBox with the original HDD size of 8GB. I've since needed to make it larger, which was made to 25GB. After trying to increase the
"/dev/mapper/VolGroup-lv_root" filesystem I get the following error:
[user@services ~]$ sudo lvextend -L+5GB /dev/mapper/VolGroup-lv_root
Extending logical volume lv_root to 11.71 GiB
Insufficient free space: 1280 extents needed, but only 0 available
What am I missing here? I see that "/dev/sda" has increased but nothing to "/dev/mapper/VolGroup-lv_root". I'm lost of what needs to be completed.
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1045 7875584 8e Linux LVM
block device called a Logical Volume, created from
a Volume Group, which is a pool of
Physical Volumes, which in turn are either
devices and/or partitions
You've extended the device. You must now:
either extend the existing partition (with fdisk or parted or whatever) and the Physical Volume (with pvresize), or create a new partition and Physical Volume from the available free space
add the new Physical Volume to the existing Volume Group (with vgextend), or do nothing if you extended the existing Physical Volume, as that will cause the Volume Group to grow automatically
extend the Logical Volume (with lvextend)
extend the file system (with resize2fs if your're using ext2/3/4, or the equivalent tool for your filesystem of choice)
Well I want to extend the existing partition. So running fdisk -l shows the following:
Disk /dev/sda: 26.8 GB, 26843545600 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1045 7875584 8e Linux LVM
Disk /dev/mapper/VolGroup-lv_root: 7205 MB, 7205814272 bytes
Disk /dev/mapper/VolGroup-lv_swap: 855 MB, 855638016 bytes
This is where I'm still confused in this Linux world. So does this show that my system acts like there is 3 different drives? And that sda is partitioned twice to sda1 and sda2?
Yes, the (virtualised) /dev/sda is partitioned into 2 partitions - presumably sda1 for /boot, and sda2 is for your LVM vg (currently holding lvs root and swap). For what you need to do, re-read post #2, then have a look at Logical_Volume_Manager_Administration on the RHEL site for a description of the LVM architecture as well as commands for admin. LVM is another layer of (device) virtualisation on top of everything else you've got virtualised.
/dev/sda is the drive, and it contains the partitions /dev/sda1 (a small boot partition with a file system containing the kernel and an initrd) and /dev/sda2 (an LVM Physical Volume).
The device nodes in /dev/mapper represent virtual LVM devices, and do not point to physical drives. The names indicate that you have one Volume Group called "VolGroup", and from this volume group, two Logical Volumes have been created: "VolGroup-lv_root" (must be the root file system) and "VolGroup-lv_swap" (a swap partition).
So you have one drive with two partitions, the latter of which is an LVM Physical Volume, serving as the only member of a Volume Group.
According to fdisk, the 2nd partition starts at block 64 and ends at block 7875584. You need to alter this partition so that it still starts at block 64, but covers the entire disk. Here's how you can do that:
Start fdisk with fdisk /dev/sda
Delete partition 2 by typing
d [Enter] (delete partition)
2 [Enter] (the partition number)
Recreate partition 2 by typing
n [Enter] (new partition)
p [Enter] (primary partition)
2 [Enter] (the partition number)
64 [Enter] (the start sector)
[Enter] (the end sector; the default is the end of the disk)
View the partition table with p [Enter]
If all looks OK, write the partition table to disk with w [Enter]
The partition has now been extended. fdisk doesn't touch the actual data on the disk when partitions are deleted and created, so as long as you create a new partition with the same number (2) starting at the same sector (64), the data inside that partition will still be valid.
The next step is to extend the data structures inside the Physical Volume to cover the entire partition, but you'll probably have to reboot first. You could try running partprobe, but you'll most likely get a message saying the partitions are in use, so the kernel will still be using the old partition table.
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 3263 25697023+ 83 Linux
sudo lvextend -L+5G /dev/mapper/VolGroup-lv_root
Extending logical volume lv_root to 11.71 GiB
Insufficient free space: 1280 extents needed, but only 0 available
I've noticed the the ID for sda2 has changed, along with the System stating Linux instead of LVM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.