Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I had a Linux LVM volume that was about 400 GB. I shrank it to 217 GB following the steps below.

umount /local
e2fsck -f /dev/mapper/vg00-lvol2
resize2fs /dev/mapper/vg00-lvol2 217G
lvresize -L 217G /dev/mapper/vg00-lvol2
lvdisplay /dev/mapper/vg00-lvol2
mount /local

And then I resized the physical volume to 260 GB with pvresize. If I do pvdisplay and lvdisplay now, I get:

lvm> pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg00
  PV Size               260.00 GB / not usable 31.81 MB
  Allocatable           yes 
  PE Size (KByte)       32768
  Total PE              8319
  Free PE               250
  Allocated PE          8069
  PV UUID               6itmL0-3HAd-tmhA-a3u3-ketO-H7OO-MahFc7

lvm> lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg00/lvol1
  VG Name                vg00
  LV UUID                JFATdC-lqxK-wsBc-VgL1-33Xv-PUfb-Y28fk2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                35.16 GB
  Current LE             1125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/vg00/lvol2
  VG Name                vg00
  LV UUID                F81eoe-xokM-Jqwr-NXND-VujX-BwN6-Kh0zZa
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                217.00 GB
  Current LE             6944
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

How can I revert these steps? That is, to resize the physical volume and the logical volume back to their original sizes.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I'd suggest that you reverse the sequence:

 pvresize
 lvresize
 resize2fs

Am I missing something here?

share|improve this answer
    
Does vgresize revert the pvresize? vg commands are for volumes groups, pg for physical volumes, aren't they? –  rturrado Nov 3 '11 at 19:02
    
changed to pvresize –  mdpc Nov 3 '11 at 19:05
2  
Efectiviwonder, following the steps below did the trick beautifully: pvresize /dev/sda3, lvresize -l +100%FREE /dev/sda3, umount /local, e2fsck -f /dev/mapper/vg00-lvol2, resize2fs /dev/mapper/vg00-lvol2, mount /local –  rturrado Nov 3 '11 at 19:58

Your Answer

 
discard

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.