Quantcast
Viewing all articles
Browse latest Browse all 36162

Shrinking LVM problems

Hello guys,

I am having problem shrinking an LVM and the physical volume afterwards.

My goal is to get to a step where I can shrink the free space with gparted and use it later for another operating system.

The volume group partition is /dev/sda2

The volume group name is VolGroup

I tried this

With Fedora 17 live cd.

Code:

lvm vgchange -ay

//Checked for errors
e2fsck -f /dev/mapper/VolGroup-lv_home

//Resized the logical volume
resize2fs /dev/mapper/VolGroup-lv_home 150G

//Resized lvm slightly larger
lvm lvresize /dev/mapper/VolGroup-lv_home --size 151G

resize2fs /dev/mapper/VolGroup-lv_home

//Then I tried to resize the physical volume

pvresize --setphysicalvolumesize 213G /dev/sda2

//But I got an error about the extends and I tried using pmove

pvmove -v --alloc anywhere /dev/sda2

//But pvresize failed again

pvresize --setphysicalvolumesize 213G /dev/sda2

// I tried also removing and recreating the swap but it didn't work

swapoff -a

lvm lvremove /dev/mapper/VolGroup-lv_swap
lvm lvcreate --size 9.81G --name lv_swap VolGroup
mkswap /dev/mapper/VolGroup-lv_swap

I have this at the moment


Code:

# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_home
  VG Name                VolGroup
  LV UUID                GVw4KW-mgkN-AvL9-tqNr-PT48-umYJ-6o8Ukt
  LV Write Access        read/write
  LV Status              available
  # open                1
  LV Size                151.00 GiB
  Current LE            4832
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          253:2
 
  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_root
  VG Name                VolGroup
  LV UUID                iPBL21-WDec-kAjF-CInN-qPWQ-GvBC-FSZAdm
  LV Write Access        read/write
  LV Status              available
  # open                1
  LV Size                50.00 GiB
  Current LE            1600
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          253:0
 
  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_swap
  VG Name                VolGroup
  LV UUID                EZ37qb-M5v5-hcYY-4BFd-GHhx-b1J7-06mmoM
  LV Write Access        read/write
  LV Status              available
  # open                2
  LV Size                9.81 GiB
  Current LE            314
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          253:1

And the Physical volume


Code:

# pvdisplay
  --- Physical volume ---
  PV Name              /dev/sda2
  VG Name              VolGroup
  PV Size              585.94 GiB / not usable 31.00 MiB
  Allocatable          yes
  PE Size              32.00 MiB
  Total PE              18749
  Free PE              12003
  Allocated PE          6746
  PV UUID              MI4jX3-zHpK-CiU9-yQeR-lcQ1-94y8-632E8H

Any ideas thanks in advance.

Viewing all articles
Browse latest Browse all 36162

Trending Articles