fdisk /dev/[unidad]
depués teclear 'p' para ver la tabla de particiones. Tomamos la partición que corresponde a la ampliación de disco y la borramos, después eliminamos también la partición de tipo lvm, guardando el cilindro de inicio. A continuación, tecleamos 'n', para crear una nueva partición, la creamos de tipo primario 'p' y fijamos como cilindro de inicio el que tenía la anterior partición lvm (por defecto nos dará este inicio), el cilindro final será el último del disco. Tecleamos 'p' para ver como queda la tabla de particiones, donde ya veremos que utiliza el espacio ampliado y, finalmente tecleamos 'w' para guardar la tabla de particiones y salimos de fdisk.
Para finalizar:
pvresize /dev/[numero_de_particion_ampliada]
Después hay reiniciar el sistema.
Sacado de:
Increase an existing LV
Taken from my LVM management notes. I had first used this when I imaged an 80GB drive to a 120GB drive and wanted to make use of the 40GB of free space.
1. fdisk /dev/sda then press p
Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 13 104391 83 Linux
/dev/sda2 14 1188 9438187+ 8e Linux LVM
2. Press d then 2 to remove the partition
3. Press n then primary p start cylinder 14 last cylinder 4865 to add the newly re-sized partition. WARNING: Make sure the old and new partition start at the same cylinder position, not doing so will destroy your data.
4. Press t partition 2 Hex code 8e
5. Press p
Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 13 104391 83 Linux
/dev/sda2 14 4865 38973690 8e Linux LVM
6. Finally press w write table to disk and exit and reboot
7. Use vgdisplay, pvdisplay, or lvdisplay to show the current and later ending size of your LV
8. Run pvresize /dev/sda2 to expand the PV on /dev/sda2 after enlarging the partition with fdisk
9. You could also extend the volume group across disks and partitions: pvcreate /dev/hdb1; vgextend videovg /dev/hdb1; vgdisplay videovg. With this method use fdisk to create a new partition instead of recreating the original one. This is certainly safer since there is less risk to your existing data and it makes it easier to break up volume groups in the future.
10. Use vgdisplay to find the Free PE / Size
Code:
--- Volume group ---
VG Name SystemVG
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 37.17 GB
PE Size 4.00 MB
Total PE 9515
Alloc PE / Size 2176 / 8.50 GB
Free PE / Size 7339 / 28.67 GB
VG UUID Bl4LEQ-R70i-3Qse-9z1p-BRcK-ibd7-2aelYx
11. Use lvdisplay to display current logical volumes
Code:
--- Logical volume ---
LV Name /dev/SystemVG/RootLV
VG Name SystemVG
LV UUID dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
LV Write Access read/write
LV Status available
# open 1
LV Size 8.00 GB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0
--- Logical volume ---
LV Name /dev/SystemVG/SwapLV
VG Name SystemVG
LV UUID vSRWGx-zy8N-FrXK-3HP5-7pwW-F6SQ-IRJNeA
LV Write Access read/write
LV Status available
# open 2
LV Size 512.00 MB
Current LE 128
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1
12. lvextend -l +7339 /dev/SystemVG/RootLV (you can use the following to reduce again lvreduce -l -7339 /dev/SystemVG/RootLV)
13. lvdisplay /dev/SystemVG/RootLV to see the result
Code:
--- Logical volume ---
LV Name /dev/SystemVG/RootLV
VG Name SystemVG
LV UUID dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
LV Write Access read/write
LV Status available
# open 1
LV Size 36.67 GB
Current LE 9387
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
14. ext2online /dev/SystemVG/RootLV while the filesystem is mounted or to be safe use resize2fs /dev/SystemVG/RootLV while the filesystem is unmounted. Note: resize2fs may require running e2fsck -f /dev/SystemVG/RootLV first.
Note: I did not have much luck with this on SLES 10 x86_64 (ext2online) however with Fedora Core 5 x86 this worked first try without errors.