viernes, 18 de septiembre de 2009
Tomar un Backup Online de un File System utilizando fssnap o UFSdump
# fssnap -F ufs -o bs=/soft/root.snap /
2. Creamos el punto de montaje del snap
# mkdir /soft/rootfs
3. Montamos el snapshoot
# mount -F ufs -o ro /dev/fssnap/0 /soft/rootfs
4. Tomar el backup
# cd /soft/rootfs/
# tar cvf /dev/rmt/0 .
5. Desmontar el FS y borrar el snapshoot
# umount /soft/rootfs/
# rm /soft/root.snap
# fssnap -d /
Para realizar este backup con UFSdump podemos realizar:
1. Creamos el Snapshoot del FS (Verificar si hay espacio suficiente para la imagen)
# fssnap -F ufs -o bs=/soft/root.snap /
2. Tomamos el backup con UFSDUMP
# ufsdump 0cuf /dev/rmt/0 /dev/rfssnap/0
Nota: rfssnap -> RAW Device
fssnap -> Block Device
3. Borrar el snapshoot
# rm /soft/root.snap
# fssnap -d /
Agregar SWAP en solaris / Adding a Swap File on Solaris
1. Usar el mkfile para crear un archivo del tamaño del swap que queremos incorporar y asi poder añadirlo al sistema. Por ejemplo vamos a crear un archivo de 1GB para incrementar el swap:
# /usr/sbin/mkfile 1024m /swap
Donde /swap es el nombre del archivo que se utilizara en el espacio de swap. Las unidades posibles para utilizar son kilobytes (k), bloques (b), o megabytes (m).
2. Vamos a decirle al sistema que comience a utilizar el archivo de swap que creamos:
# /usr/sbin/swap -a /swap
Para verificar que se añadio correctamente el SWAP en el equipo lo verificamos con el comando swap -l.
IMPORTANTE: Esta operatoria es momentanea y manual, despues de un reboot el equipo inicia de manera normal, con lo cual tendriamos que pensar en dos cosas, planificar el agregar mas swap incorporando otro disco o dejar permanentemente en el /etc/vfstab la incorporacion del archivo /swap.
SalU2,
Análisis de la memoria libre utilizando el SAR y el VMSTAT
swap amount of swap space currently available (Kbytes)
free size of the free list (Kbytes)
Esto quiere decir que el 'free0 es la cantidad de memoria RAM libre en kilobytes.
Ej.:
root@consola # vmstat 2 2
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 s0 -- in sy cs us sy id
0 0 0 416184 72464 58 262 108 2 2 0 0 14 0 0 0 272 351 248 10 6 84
0 0 0 361808 59088 45 237 0 0 0 0 0 0 0 0 0 313 4843 284 26 5 69
SAR
$ man sar
-r Report unused memory pages and disk blocks:
freemem average pages available to user processes.
freeswap disk blocks available for page swapping.
La cantidad de memoria RAM libre en paginas es informada por el SAR -r, el tamanio de pagina utilizada se puede ver ejecutando el comando 'pagesize' generalmente es de 8k.
Ej.:
root@consola # sar -r 2 2
SunOS consola 5.8 Generic_117350-18 sun4u 06/28/06
10:22:21 freemem freeswap
10:22:23 7060 716848
10:22:25 7094 720432
Average 7077 718635
root@consola # pagesize
8192
root@consola # echo "7094 * 8" | bc
56752 <-- Memoria ram libre en K
y este valor es muy similar al reportado por el VMSTAT
root@consola # vmstat 2 2
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 s0 -- in sy cs us sy id
0 0 0 416184 72464 58 262 108 2 2 0 0 14 0 0 0 272 351 248 10 6 84
0 0 0 361808 59088 45 237 0 0 0 0 0 0 0 0 0 313 4843 284 26 5 69
Expandir un File Systems utilizando SVM y growfs
2. Verificar el tamaño del File System
# df -k /filesystem
3. Verificar el tamaño del metadevice
# metastat -s [diskgroup] d611 |grep Size
4. Expandir el metadevice.
# metattach -s [diskgroup] d611 20g
5. Hacer crecer el file system.
# growfs -M /filesystem /dev/md/[diskgroup]/rdsk/d611
6. Verificar el tamaño del File System
# df -k /filesystem
7. Verificar el tamaño del metadevice
# metastat -s [diskgroup] d611 |grep Size
Nota 1: Si el file system no esta montado, la opción -M no es requerida.
Nota 2: Si el comando growfs es abortado, para recuperar cualquier espacio perdido se tendrá que desmontar el FS y ejecutar un fsck o volver a ejecutar el comando growfs.
SalU2,
Como realizar una copia de discos via "dd"
# touch /reconfigure
# init 0
ok boot
# dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t2d0s2 bs=128k
# fsck /dev/rdsk/c0t2d0s2
# mount /dev/dsk/c0t2d0s2 /mnt
# cd /mnt/etc
# vi vfstab
(Modificar las entradas para el nuevo disco)
# cd /
# umount /mnt
# init 0
# boot disk2 -s
# sys-unconfig
# boot disk2
Salu2,
Realizar un Ugrade via LiveUpgrade
--------------------------
s10u1: Solaris 10 1/06
s10u2: Solaris 10 6/06
kilo: 192.168.1.2
infierno: 192.168.1.8
Slice Tag Version
------------------------------------------
c0t0d0s0 root Solaris 10u1 (Original)
c0t0d0s1 swap Solaris 10u1 (Original)
c0t1d0s0 root Solaris 10u2 (Actualizado)
c0t1d0s1 swap Solaris 10u2 (Actualizado)
DETALLE DEL PROCEDIMIENTO
-------------------------
01.- Mi server es una Netra T1 sin CDROM por esto comparto el DVD de instalacion de otra maquina.
root@infierno # share -o ro,anon=0 /cdrom/sol_10_606_sparc
02. Verificar desde el server que esta correctamente compartido
root@kilo # dfshares 192.168.1.8
RESOURCE SERVER ACCESS TRANSPORT
192.168.1.8:/cdrom/sol_10_606_sparc 192.168.1.8 - -
03. Clonar la tabla de particiones del disco a actualizar.
root@kilo # prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
04. Eliminarl los paquetes de LiveUpgrade viejos
root@kilo # pkginfo |grep -i "Live Upgrade"
application SUNWlur Live Upgrade (root)
application SUNWlur.2 Live Upgrade 2.0 08/01 (root)
application SUNWluu Live Upgrade (usr)
application SUNWluzone Live Upgrade (zones support)
root@kilo # pkgrm SUNWluu SUNWlur SUNWlur.2 SUNWluzone
05. Instalar los paquetes de Live Upgrade del DVD de Solaris 10
(/cdrom/sol_10_606_sparc/Solaris_10/Product)
(/cdrom/sol_10_106_sparc/Solaris_10/Tools/Installers/liveupgrade20)
root@kilo # pkgadd SUNWluu SUNWlur SUNWluzone
06. Eliminar cualquier lista previa de Boot Enviroments
root@kilo # mv /etc/lutab /etc/lutab.original
07. Crear una copia del actual BE (Boot Environment)
root@kilo # lucreate -c s10u1 -m /:/dev/dsk/c0t1d0s0:ufs -m -:/dev/dsk/c0t1d0s1:swap -n s10u2
08. Verificar el estado de los BE (s10u1 y s10u2)
root@kilo # lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
s10u1 yes yes yes no -
s10u2 yes no no no -
09. Comenzar el Upgade al nuevo OS
root@kilo # luupgrade -u -n s10u2 -s /net/192.168.1.8/cdrom/sol_10_606_sparc
Validating the contents of the media </net/192.168.1.8/cdrom/sol_10_606_sparc>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <s10u2>.
Determining packages to install or upgrade for BE <s10u2>.
Performing the operating system upgrade of the BE <s10u2>.
CAUTION: Interrupting this process may leave the boot environment unstable or unbootable.
Upgrading Solaris: 7% completed
...MIENTRAS TANTO EN OTRA SESION PODEMOS VERIFICAR LA ACTUALIZACION...
root@kilo # lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
s10u1 yes yes yes no -
s10u2 yes no no no UPDATING
...UN POCO MAS TARDE...
root@kilo # luupgrade -u -n s10u2 -s /net/192.168.1.8/cdrom/sol_10_606_sparc
Validating the contents of the media </net/192.168.1.8/cdrom/sol_10_606_sparc>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <s10u2>.
Determining packages to install or upgrade for BE <s10u2>.
Performing the operating system upgrade of the BE <s10u2>.
CAUTION: Interrupting this process may leave the boot environment unstable or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Updating package information on boot environment <s10u2>.
Package information successfully updated on boot environment <s10u2>.
Adding operating system patches to the BE <s10u2>.
The operating system patch installation is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot
environment <s10u2> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot
environment <s10u2> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files
are located on boot environment <s10u2>. Before you activate boot
environment <s10u2>, determine if any additional system maintenance is
required or if additional media of the software distribution must be installed.
The Solaris upgrade of the boot environment <s10u2> is complete.
root@kilo # lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
s10u1 yes yes yes no -
s10u2 yes no no yes -
10. Instalar los parches recomendados de solaris 10
root@kilo # unzip 10_Recommended.zip
root@kilo # cd /var/tmp/10_Recommended
root@kilo # luupgrade -n s10u2 -t -s . `cat patch_order`
Validating the contents of the media <.>.
The media contains 44 software patches that can be added.
Mounting the BE <s10u2>.
Adding patches to the BE <s10u2>.
Validating patches...
Loading patches installed on the system...
Done!
Loading patches requested to install.
......
Unmounting the BE <s10u2>.
The patch add to the BE <s10u2> completed.
11. Actival el nuevo Boot Environment
root@kilo # luactivate s10u2
**********************************************************************
The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the target BE.
**********************************************************************
In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:
1. Enter the PROM monitor (ok prompt).
2. Change the boot device back to the original boot environment by typing:
setenv boot-device /pci@1f,0/pci@1,1/scsi@2/disk@0,0:a
3. Boot to the original boot environment by typing:
boot
**********************************************************************
Activation of boot environment <s10u2> successful.
12. Verificar el BE
root@kilo # lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
s10u1 yes no no yes -
s10u2 yes yes yes no -
13. Reiniciar el equipo en Single-User para que se reconfigure
root@kilo # shutdown -g0 -y
Nota: No utilizar los comandos reboot, halt, init 0 para el reboot
14. Verificar que BE estamos utilizando
root@kilo # cat /etc/release
Solaris 10 6/06 s10s_u2wos_09a SPARC
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 09 June 2006
15. Si todo funciona correctamente, eliminar el antiguo BE (s10u1)
root@kilo # lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
s10u1 yes no no yes -
s10u2 yes yes yes no -
root@kilo # ludelete s10u1
WARNING: Boot environment <s10u1> has one or more slices mounted at </>.
Determining the devices to be marked free.
WARNING: The root slice </dev/md/dsk/d0> for BE <s10u1> is already mounted to </>.
WARNING: Unable to determine the devices to be freed for BE <s10u1>.
Updating boot environment configuration database.
Updating boot environment description database on all BEs.
Updating all boot environment configuration databases.
Boot environment <s10u1> deleted.
root@kilo # rm /etc/lutab
root@kilo # lustatus
ERROR: No boot environments are configured on this system
ERROR: cannot determine list of all boot environment names
Anexo - Para volver al BE antiguo ejecutar lo siguiente
root@kilo # luactivate s10u1
root@kilo # shutdown -g0 -y -i0
ok > boot [old BE] -s[x]
SalU2,