Anda di halaman 1dari 5

Inicializando o disco extra

# fdisk -l

Disk /dev/sdd: 1073 MB, 1073741824 bytes


255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

O disco /dev/sdd no possui nenhuma partio criada, esse nosso HD que adicionaremos ao
volume LVM existente.
# fdisk /dev/sdd

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by


w(rite)

Command (m for help): n

Command action
e extended
p primary partition (1-4)

p
Partition number (1-4): 1

Nota
O disco foi todo utilizado, portanto nas duas opes First cylinder e Last cylinder foi apertado
<ENTER> como opo Default.

First cylinder (1-130, default 1):


Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): t

Selected partition 1

Nota
8e corresponde a Linux LVM
Hex code (type L to list codes): 8e

Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.

Listando os volumes disponveis

Modo resumido

# vgdisplay -s

"system" 13.84 GB [13.78 GB used / 64.00 MB free]

Modo detalhado

# vgdisplay

--- Volume group ---


VG Name system
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 13.84 GB
PE Size 32.00 MB
Total PE 443
Alloc PE / Size 441 / 13.78 GB
Free PE / Size 2 / 64.00 MB
VG UUID 1NVjXy-d54s-62br-R31k-R8VA-iAAJ-4BzPXa

Listando os volumes lgicos


necessrio sabermos qual volume lgico queremos aumentar.
# lvdisplay -a
--- Logical volume ---
LV Name /dev/system/root
VG Name system
LV UUID M1uLX3-2W4u-3Pkv-4sM2-lg3b-duPt-dhxbQb
LV Write Access read/write
LV Status available
# open 1
LV Size 11.91 GB
Current LE 381
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---


LV Name /dev/system/var
VG Name system
LV UUID BOQbWB-lhIp-mRNX-mPzm-CLsG-lwno-mAkQiW
LV Write Access read/write
LV Status available
# open 1
LV Size 1.88 GB
Current LE 60
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

Vamos aumentar o /dev/system/root

Adicionando o novo disco ao Volume


Agora que vimos qual o volume que vamos expandir, iremos realizar os procedimentos para
aumentar o tamanho do volume online.
Antes de utlizarmos o disco como um volume fsico (physical volume), temos que inicializ-lo.
# pvcreate /dev/sdd1

Physical volume "/dev/sdd1" successfully created

Adicionar o disco inicilizado ao volume existente.


# vgextend system /dev/sdd1

/dev/cdrom: open failed: Read-only file system


/dev/cdrom: open failed: Read-only file system
Attempt to close device '/dev/cdrom' which is not open.
Volume group "system" successfully extended

Extendendo o volume com o novo disco


Executando novamente o comando vgdisplay ser nos informado quanto de espao temos
disponvel.
# vgdisplay

--- Volume group ---


VG Name system
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size 14.81 GB
PE Size 32.00 MB
Total PE 474
Alloc PE / Size 441 / 13.78 GB
Free PE / Size 33 / 1.03 GB
VG UUID 1NVjXy-d54s-62br-R31k-R8VA-iAAJ-4BzPXa

Repare no campo Free PE / Size , existe 1.03GB livres que corresponde ao novo disco adicionado.
Com essa informaes, podemos expandir o volume system.
# lvextend -L+1.03G /dev/system/root

Extending logical volume root to 12.94 GB


Logical volume root successfully resized

# vgdisplay

--- Volume group ---


VG Name system
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 3
Act PV 3
VG Size 14.81 GB
PE Size 32.00 MB
Total PE 474
Alloc PE / Size 474 / 14.81 GB
Free PE / Size 0 / 0
VG UUID 1NVjXy-d54s-62br-R31k-R8VA-iAAJ-4BzPXa

No existe mais espao livre para ser alocado. Tudo est alocado.
Aviso
Se voc est utlizando um kernel antigo, talvez no suporte aumentar o filesystem ext3
online.A verso do programa resize2fs 1.35 (28-Feb-2004) tambm no tem esse suporte.
# resize2fs /dev/system/root

resize2fs 1.39 (29-May-2006)


Filesystem at /dev/system/root is mounted on /; on-line resizing required
Performing an on-line resize of /dev/system/root to 3391488 (4k) blocks.
The filesystem on /dev/system/root is now 3391488 blocks long.

Antes

# df -h

Filesystem Size Used Avail Use% Mounted on


/dev/mapper/system-root
13G 3.5G 7.5G 30% /

Depois

# df -h

Filesystem Size Used Avail Use% Mounted on


/dev/mapper/system-root
13G 3.5G 8.5G 30% /

Be Sociable, Share!

Anda mungkin juga menyukai