MAL - Memória Auxiliar do Lutieri

quarta-feira, novembro 04, 2009

Resizing physical disk and logical volumes

This is a VM which had the HD resized. Now it's time to resize the LVM partition, actually you don't do that, you will resize the PV.


sles11_php:~ # fdisk -l /dev/sda

Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005035d

Device Boot Start End Blocks Id System
/dev/sda1 * 2 9 64260 83 Linux
/dev/sda2 10 74 522112+ 82 Linux swap / Solaris
/dev/sda3 75 1958 15133230 8e Linux LVM



Here you can see sda3 now with 15Gb

Now it's time to resize the PV



sles11_php:~ # pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name VGroot
PV Size 9.43 GB / not usable 263.50 KB
Allocatable yes
PE Size (KByte) 4096
Total PE 2414
Free PE 238
Allocated PE 2176
PV UUID LGgBQf-sw8J-fbnu-1EHL-0z1G-J31k-eAJoXc

sles11_php:~ # pvscan
PV /dev/sda3 VG VGroot lvm2 [9.43 GB / 952.00 MB free]
Total: 1 [9.43 GB] / in use: 1 [9.43 GB] / in no VG: 0 [0 ]

sles11_php:~ # pvresize /dev/sda3
Physical volume "/dev/sda3" changed
1 physical volume(s) resized / 0 physical volume(s) not resized

sles11_php:~ # pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name VGroot
PV Size 14.43 GB / not usable 2.36 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 3694
Free PE 1518
Allocated PE 2176
PV UUID LGgBQf-sw8J-fbnu-1EHL-0z1G-J31k-eAJoXc

sles11_php:~ #


sles11_php:~ # vgdisplay
--- Volume group ---
VG Name VGroot
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size 14.43 GB
PE Size 4.00 MB
Total PE 3694
Alloc PE / Size 2176 / 8.50 GB
Free PE / Size 1518 / 5.93 GB
VG UUID CexmBK-uOq6-fnjo-qxFV-SIWW-04ZM-LENpdq


The VG didn't need any changes.



sles11_php:~ # lvresize -l +50%FREE /dev/VGroot/LVusr
Extending logical volume LVusr to 5.46 GB
Logical volume LVusr successfully resized



sles11_php:~ # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VGroot-LVroot
1014M 357M 658M 36% /
udev 248M 104K 247M 1% /dev
/dev/sda1 61M 16M 42M 28% /boot
/dev/mapper/VGroot-LVhome
1014M 4.3M 1010M 1% /home
/dev/mapper/VGroot-LVopt
1014M 60M 955M 6% /opt
/dev/mapper/VGroot-LVtmp
1014M 5.5M 1009M 1% /tmp
/dev/mapper/VGroot-LVusr
2.5G 2.4G 140M 95% /usr
/dev/mapper/VGroot-LVvar
2.0G 235M 1.8G 12% /var


sles11_php:~ # xfs_growfs /usr/
meta-data=/dev/mapper/VGroot-LVusr isize=256 agcount=4, agsize=163840 blks
= sectsz=512 attr=2
data = bsize=4096 blocks=655360, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=0
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 655360 to 1432576



sles11_php:~ # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VGroot-LVroot
1014M 357M 658M 36% /
udev 248M 104K 247M 1% /dev
/dev/sda1 61M 16M 42M 28% /boot
/dev/mapper/VGroot-LVhome
1014M 4.3M 1010M 1% /home
/dev/mapper/VGroot-LVopt
1014M 60M 955M 6% /opt
/dev/mapper/VGroot-LVtmp
1014M 5.5M 1009M 1% /tmp
/dev/mapper/VGroot-LVusr
5.5G 2.4G 3.2G 44% /usr
/dev/mapper/VGroot-LVvar
2.0G 235M 1.8G 12% /var



Here is a list of tools you need to extend each partition's type:

http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html


An excellent howto in LVM:
http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/LVM-HOWTO.html


Resizing a ext3 partition with progress bar :)

e2fsck -f -C 0 /dev/xxx


If you forget the -C 0(zero) option you can send a SIGUSR1 signal to the process, like this:

kill -SIGUSR1 e2fsc_PID


Now it's time to actually resize:

resize2fs -p /dev/xxx

Marcadores:

0 Comentários:

Postar um comentário

<< Home



Chat with Lutieri G. B.

Subscribe in a reader