I have resized lvm partitions in the past, but after the resize there is space at the end of the partition. What I want to achive is to have the space at the beginning of the partition instead.
The reason for this is that I want to use grub2, but the size of the grub image is bigger than the size of the MBR, so I want to move my partition a little bit to give it more space.
Here is my configuration:
fdisk:
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa2f2ca9b
Device Boot Start End Blocks Id System
/dev/sda1 63 125949599 62974768+ 8e Linux LVM
/dev/sda2 * 125949600 230436359 52243380 7 HPFS/NTFS/exFAT
/dev/sda3 230436360 234436544 2000092+ 82 Linux swap / Solaris
pvdisplay:
--- Physical volume ---
PV Name /dev/sda1
VG Name vg1
PV Size 60.00 GiB / not usable 832.00 KiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 15360
Free PE 0
Allocated PE 15360
PV UUID 6O3e7e-0ofs-mqpW-QyKM-H8yL-CwFf-zBkNES
vgdisplay:
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 60.00 GiB
PE Size 4.00 MiB
Total PE 15360
Alloc PE / Size 15360 / 60.00 GiB
Free PE / Size 0 / 0
VG UUID RhdcOf-b1xm-QNQT-7cou-ctNA-eO4b-5p2nmq
lvdisplay:
--- Logical volume ---
LV Name /dev/vg1/lvroot
VG Name vg1
LV UUID xKbY2T-kyat-Ane0-guYy-ub2a-i8Gh-cUdSgZ
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GiB
Current LE 5120
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:3
--- Logical volume ---
LV Name /dev/vg1/lvhome
VG Name vg1
LV UUID 3PPBuA-iCpW-BXVG-F00F-VO6P-oUOB-Nct4Sc
LV Write Access read/write
LV Status available
# open 0
LV Size 40.00 GiB
Current LE 10240
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:4
What I want to do is resize lvroot by a little bit ... 1MB will be sufficient in this case, then shrink it at the beginning, then shrink the pv, delete the partition and recreated at a new start location with the same end location.