Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I setup default Fedora partitioning with LVM. Now, I would like to shrink my partition to create 1 new partition. Could you please help me understand why I am getting such error?

[root@host]# lvm pvresize /dev/sda2 --setphysicalvolumesize 60G
  /dev/sda2: cannot resize to 1919 extents as 22340 are allocated.
  0 physical volume(s) resized / 1 physical volume(s) not resized

Some details on my partitioning:

[root@host]# lvm pvs
  PV         VG        Fmt  Attr PSize   PFree
  /dev/sda2  vg_andrew lvm2 a--  698.12g    0

[root@host]# pvs --segments
  PV         VG        Fmt  Attr PSize   PFree Start SSize
  /dev/sda2  vg_andrew lvm2 a--  698.12g    0      0   310
  /dev/sda2  vg_andrew lvm2 a--  698.12g    0    310 20430
  /dev/sda2  vg_andrew lvm2 a--  698.12g    0  20740  1600

[root@host]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
rootfs                          50G  6.5G   43G  14% /
devtmpfs                       3.9G     0  3.9G   0% /dev
tmpfs                          3.9G  816K  3.9G   1% /dev/shm
tmpfs                          3.9G  1.1M  3.9G   1% /run
/dev/mapper/vg_andrew-lv_root   50G  6.5G   43G  14% /
tmpfs                          3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs                          3.9G     0  3.9G   0% /media
/dev/sda1                      485M   96M  364M  21% /boot
/dev/mapper/vg_andrew-lv_home  629G   53G  545G   9% /home

Sorry if the answer is obvious, I am new to LVM. Thank you for your help.

share|improve this question
Rule #1 of using LVM, don't pre-allocate all of your space. As in, you really shouldn't have created a huge /home. Instead you should make small filesystems and add space as needed, leaving all your extra space un-allocated, so you have flexibility in the future. – Zoredache Oct 3 '12 at 16:51
up vote 2 down vote accepted

First of all, you can't resize the physical volume if you have booted from it. Boot from a rescure CD, run pvscan, vgscan and lvscan and then follow those steps:

  1. Resize the filesystems in all your logical volumes in the volume group vg_andrew
  2. Resize the logical volumes so that the sum of all volumes are smaller then the size you want the physical volume to be
  3. Now resize the volume group vg_andrew (which is he comtainers for all of your logical volumes)
  4. Now you can resize the physical volume itself. After that you still need to resize the partition which holds your physical volume.

Alltogether this is not a trivial task. You have to take care to resize the filesystems in your logical volumes correctly so that you don't lose any data.

If you'd post the output of lvdisplay, vgdisplay and pvdisplay we might be able to give further details, but the process which I described above would be the correct way to do it.

share|improve this answer
Also, be sure to resize the filesystem itself (eg resize2fs) before resizing the logical volume. See… for what happens when you don't – DerfK Oct 3 '12 at 16:37
@DerfK phew, while reading your comment I realized I had a blatant error in step 1. Wrote partitions where I meant filesystems. – Alexander Janssen Oct 3 '12 at 16:40
Thank you all for help. – Andrew Oct 9 '12 at 18:27
@Andrew Did you manage to solve your issues? – Alexander Janssen Oct 9 '12 at 19:07
@AlexanderJanssen Yes and I set accepted status of your answer as comprehensive and helpful. I appreciate your time spent to help other not-experienced people. – Andrew Oct 10 '12 at 9:48

The best approach is to do following:

# yum install system-config-lvm
# system-config-lvm

and then do it through GUI), but be careful whenever you're doing changes such as LVM (make sure you have backup!)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.