Cisco ha traducido este documento combinando la traducción automática y los recursos humanos a fin de ofrecer a nuestros usuarios en todo el mundo contenido en su propio idioma. Tenga en cuenta que incluso la mejor traducción automática podría no ser tan precisa como la proporcionada por un traductor profesional. Cisco Systems, Inc. no asume ninguna responsabilidad por la precisión de estas traducciones y recomienda remitirse siempre al documento original escrito en inglés (insertar vínculo URL).
Este documento describe cómo agregar el espacio en disco a las máquinas virtuales de Linux (VM).
Linux (y Linux VM) están instalados en los discos duros, es real o virtual. Encima de esto se empila un administrador de volúmenes seguido por un filesystem que sea qué se utiliza típicamente.
Para Linux VM, estos pasos se requieren para aumentar el tamaño de un filesystem:
Nota: Muchas de las opciones que vuelven a clasificar según el tamaño son AVENTURADAS y pueden dejar el VM en un estado del unbootable o corromper los datos. Tenga cuidado.
Nota: Antes de que usted aumente el espacio en disco asegúrese que usted haya limpiado el filesystem existente. A menudo hay los archivos en /tmp, /var/tmp, /var/tmp/broadhop y /var/log que no son necesarios y se pueden borrar en vez de la adición de espacio en disco.
#df -hFilesystem: _____________________________Mounted encendido: _______________________
Ésta es salida de muestra para el df - comando h:
[root@sessionmgr02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 2.4G 15G 15% /
/dev/mapper/VolGroup00-LogVol02
5.7G 140M 5.3G 3% /home
/dev/mapper/VolGroup00-LogVol03
30G 27G 1.5G 97% /data
/dev/sda1 99M 40M 55M 43% /boot
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 8.0G 1.1G 7.0G 13% /data/sessions.1
# pvdisplayNombre PV: ___________________________________
Ésta es salida de muestra para el comando pvdisplay:
[root@sessionmgr02 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 69.89 GB / not usable 18.64 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 2236
Free PE 320
Allocated PE 1916
PV UUID HO3ICX-nRhO-FaBA-MvB3-Zlzv-JLG4-vNFQeU
Nota: El nombre PV (/dev/sda2) muestra dos cosas. La primera parte (/dev/sda) muestra que el dispositivo y la segunda parte (2) muestra el NÚMERO DE PARTICIÓN.
Espacio en disco para agregar el <amount>: __________________________________
# vgdisplay
Alloc PE/tamaño: ________________________Free PE/tamaño: _______________________
Esto muestra la salida de muestra para el comando vgdisplay:
[root@sessionmgr02 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.88 GB
PE Size 32.00 MB
Total PE 2396
Alloc PE / Size 1916 / 59.88 GB
Free PE / Size 480 / 15.00 GB
VG UUID pPSNBU-FRWO-z3aC-iAxS-ewaw-jOFT-dTcBKd
Nota: Si hay bastante espacio libre para esta extensión, continúe con la sección 4. Si no hay bastante espacio libre, pare este procedimiento y agregue el espacio en disco al datastore antes de que usted proceda.
# shutdown -h now
Esta muestra muestra la salida para el apagar - h ahora ordena:
[root@sessionmgr02 ~]# shutdown -h now
Broadcast message from root (pts/0) (Wed Dec 18 11:48:20 2013):
The system is going down for system halt NOW!
Nota: La cantidad creciente debe ser menos que la cantidad de espacio libre en el datastore. No hace la sobreasignación.
Nota: Espere 5 minutos el VM para cargar totalmente.
# ssh <vm_name>
Esta muestra muestra la salida para el comando ssh:
[root@pcrfclient01 ~]# ssh 172.10.1.30
\\Last login: Wed Dec 18 11:48:14 2013 from 172.10.1.9
Spacewalk kickstart on 2010-08-23
[root@sessionmgr02 ~]#
# fdisk -l /dev/sda
Tamaño del disco: _____________________________
Esta muestra muestra la salida para el fdisk - l comando de /dev/sda:
[root@sessionmgr02 ~]# fdisk -l /dev/sda
Disk /dev/sda2: 75.0 GB, 75047454720 bytes
255 heads, 63 sectors/track, 9124 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Esta salida de ejemplo muestra que /dev/sda2 tiene actualmente 75G afectado un aparato a él.
# fdisk <pv_name without the number on the end>
Esta muestra muestra la salida para el comando de /dev/sda del fdisk:
[root@sessionmgr02 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 9137.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):
Command (m for help): p
Este ejemplo muestra la salida que muestra la tabla de la división después de que usted teclee la carta “p”:
Command (m for help): p
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 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 9137 73288530 8e Linux LVM
Command (m for help):
Comienzo: _______________________Id: _______________________
Command (m for help): d
Este ejemplo muestra los resultados después de que usted ingrese d:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4):
Partition number (1-4): <number>
Este ejemplo muestra los resultados después de que usted ingrese el NÚMERO DE PARTICIÓN:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help):
Command (m for help): n
Este ejemplo muestra los resultados después de que usted ingrese n:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Command (m for help): n
Command (m for help): p
Este ejemplo muestra la salida después de que usted ingrese p:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Partition number (1-4): 2
Este ejemplo muestra los resultados después de que usted ingrese el NÚMERO DE PARTICIÓN:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9137, default 14):
Este ejemplo muestra los resultados después de que usted valide el valor predeterminado y el Presione ENTER:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Esta muestra muestra los resultados después de que usted valide el valor predeterminado y el Presione ENTER:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help):
Command (m for help): t
Este ejemplo muestra los resultados después de que usted ingrese t:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4):
Partition number (1-4): 2
Este ejemplo muestra los resultados después de que usted ingrese el NÚMERO DE PARTICIÓN:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes):
Hex code (type L to list codes): 8e
Este ejemplo muestra los resultados después de que usted ingrese el código hexadecimal:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help):
Command (m for help): w
Este ejemplo muestra los resultados después de que usted ingrese w en el prompt:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@sessionmgr02 ~]#
Esto sale el fdisk y le lleva al prompt de la raíz.
# init 6
[root@sessionmgr02 ~]# fdisk -l /dev/sda
Disk /dev/sda2: 80.4 GB, 80418562560 bytes
255 heads, 63 sectors/track, 9777 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Esta salida de ejemplo muestra que /dev/sda ahora tiene 80Gigabytes afectado un aparato a él.
Advertencia: Este procedimiento es algo AVENTURADO. Tenga cuidado.
# pvresize /dev/sda2
Este ejemplo muestra los resultados después de que usted ingrese el comando del pvresize:
[root@sessionmgr02 ~]# pvresize /dev/sda2
Physical volume "/dev/sda2" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
Este ejemplo muestra los resultados después de que usted ingrese el comando vgdisplay:
[root@sessionmgr02 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.88 GB
PE Size 32.00 MB
Total PE 2396
Alloc PE / Size 1916 / 59.88 GB
Free PE / Size 480 / 15.00 GB
VG UUID pPSNBU-FRWO-z3aC-iAxS-ewaw-jOFT-dTcBKd
El ejemplo muestra el espacio en disco agregado en la sección anterior.
Registre el filesystem y montado en los valores de la salida del comando df.
# df -h
Filesystem: _______________________Mounted encendido: ________________________
[root@sessionmgr02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 2.4G 15G 15% /
/dev/mapper/VolGroup00-LogVol02
5.7G 140M 5.3G 3% /home
/dev/mapper/VolGroup00-LogVol03
30G 27G 1.5G 97% /data
/dev/sda1 99M 40M 55M 43% /boot
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 8.0G 1.1G 7.0G 13% /data/sessions.1
Espacio en disco para agregar el <amount>: __________________________
# lvextend -L+5G /dev/mapper/VolGroup-LogVol-03
Este ejemplo muestra los resultados después de que usted ingrese el comando del lvextend:
[root@sessionmgr02 ~]# lvextend -L+5G /dev/mapper/VolGroup00-LogVol03
Extending logical volume LogVol03 to 45.00 GB
Logical volume LogVol03 successfully resized
[root@sessionmgr02 ~]#
Esto agrega el espacio nuevamente agregado al volumen lógico.
Advertencia: Este comando puede tardar un cierto tiempo para completar.
# resize2fs <filesystem>
Este ejemplo muestra los resultados después de que usted ingrese el comando resize2fs:
[root@sessionmgr02 ~]# resize2fs /dev/mapper/VolGroup00-LogVol03
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol03 is
mounted on /data; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol03
to 11796480 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol03 is now 11796480 blocks long.
[root@sessionmgr02 ~]#
# df -h
El ejemplo resulta de ingresar el df - comando h:
[root@sessionmgr02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 2.4G 15G 15% /
/dev/mapper/VolGroup00-LogVol02
5.7G 140M 5.3G 3% /home
/dev/mapper/VolGroup00-LogVol03
44G 22G 21G 52% /data
/dev/sda1 99M 40M 55M 43% /boot
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 8.0G 4.0K 8.0G 1% /data/sessions.1