How can I resize an active LVM partition?
Most of the disk is in an LVM partition already, which lvm calls a physical volume. LVM then divides up the space from physical volumes into logical volumes. You can use the pvs
or pvdisplay
commands to show stats on the physical volumes and lvs
or lvdisplay
to see information on all of the logical volumes. You should see that there is plenty of free space in the physical volume. You then can use lvresize
to expand a logical volume to use more of the space, as in:
sudo lvresize vg00/slash -L +10g
That will add 10 gb to the logical volume named slash in the volume group vg00, which is apparently your root volume. After that, you need to expand the filesystem to use that space, which assuming you are using the default ext4 filesystem with:
sudo resize2fs /dev/mapper/vg0-slash
lvdisplay
gave me :
--- Logical volume ---
LV Path /dev/VolGroup/lv_root
then
sudo lvextend -L+10g /dev/VolGroup/lv_root
sudo resize2fs /dev/VolGroup/lv_root
solved my problem
It looks like you're trying to add a new primary partition in-between your current /dev/sda1
and /dev/sda2
. (Evidence: fdisk
is saying that the acceptable ranges of end points are 499712-501757, default 501757
, which is between those two partitions.) There simply isn't enough space there to do that. Instead, tell fdisk
to begin the partition at 104855552
(or later) and give it the default end value (unless you want to save some space for some other purpose). This should give you a partition that uses the rest of the available disk space, minus a bit of wastage near the beginning.
Alternatively, you could use cfdisk
, GParted, or some other tool that provides a more visual approach to partitioning, which will make such an error less likely.