This is an old revision of the document!
The syntax is:
growpart /dev/DEVICE_NAME PARTITION_NUMBER
growpart is part of the package cloud-utils-growpart
Please note that there is a space between the DEVICE_NAME and the PARTITION_NUMBER. For example:
# growpart --dry-run /dev/sdb 1 CHANGE: partition=1 start=2048 old: size=419428352 end=419430400 new: size=838858719,end=838860767 # === old sfdisk -d === label: dos label-id: 0xd3a4f1f7 device: /dev/sdb unit: sectors /dev/sdb1 : start= 2048, size= 419428352, type=83 # === new sfdisk -d === label: dos label-id: 0xd3a4f1f7 device: /dev/sdb unit: sectors /dev/sdb1 : start= 2048, size= 838858719, type=83
To apply the change:
# growpart /dev/sdb 1 CHANGE: partition=1 start=2048 old: size=419428352 end=419430400 new: size=838858719,end=838860767
Can be dangerous !
1. delete partition table
fdisk /dev/sdb d w
2. recreate partition table
fdisk /dev/sdb n 1 enter p enter t 8e (for LVM) w
3. rescan
rescan-scsi-bus.sh
4.
kpartx -av /dev/mapper/sdb1
5. resize PV
resizepv /dev/sdb1
You must resize the LVM physical volume after you have reduced the partition on the filesystem with fdisk.
I have not the possibility to confirm the exact steps right now, so you should get someone to review the steps before you perform them.
In case something goes wrong, make sure you have your data backed up.
2. Resize the filesystem
resize2fs -p /dev/VolGroup00/LogVol00 50GB
3. Resize the logical volume
lvresize -L50G /dev/VolGroup/LogVol00
4. Backup partition table
sfdisk -d /dev/sda > /var/tmp/partition-table.txt
5. Delete /dev/sda2 partition
Use fdisk to delete the partition /dev/sda2
6. Create a new /dev/sda2 partition
Create a new partion with the exact same starting offset as your former partition (this should be default) and make it only 50G
7. Resize the LVM Physical Volume
pvresize /dev/sda2