Archivo para la categoría "chuletas"
Descomprimir tar absoluto en otro subdirectorio
Si que se echa de menos gnu tar.
En el itrc lo cuentan mejor, yo hago un copy-paste de lo esencial:
http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1235466947966+28353475&threadId=1269884
tar -cvf – -C /opt/myfiles/ourfiles everyonesfiles | gzip > files.tar.gz
Para quitarle el /opt y poderlo descomprimir donde se quiera
zcat files.tar.Z | pax -r -v -s ‘,^/,,’
Reparar arranque/mirror vg00
Mirror de boot en Itanium
1º Editar un fichero y meter las 4 lineas siguientes:
#vi /tmp/pdf
3
EFI 500MB
HPUX 100%
HPSP 400MB
2º Particionar el disco duro para crear la partición EFI
#idisk -f /tmp/pdf -w /dev/rdsk/c0t1d0
Verificar idisk /dev/rdsk/c0t1d0
Se crean /dev/dsk/c0t1d0s1 (EFI)
s2 (disco util)
s3 (partición de servicio)
3º Crear los devicefiles
#insf -e -H 0/1/1/0.1.0.0.0.1 (tambien se puede crear con insf -e)
4º Crear el physical volume
#pvbcreate -B /dev/rdsk/c0t1d0s2 (añadir -f si no deja)
5º Añadir el disco al vg
#vgextend /dev/vg00/ /dev/dsk/c0t1d0s2
6º Hacerlo arrancable
#mkboot -e -l /dev/rdsk/c0t1d0
7º Datos de autoarranque en EFI
# echo “boot vmunix” > ./AUTO
# efi_cp -d /dev/rdsk/c0t1d0s1 ./AUTO /efi/hpux/auto
8º Meter en mirror los lvoles
# pvdisplay -v /dev/dsk/c0t0d0s2 | grep ‘current.*0000 $’
00000 current /dev/vg00/lvol1 00000
00010 current /dev/vg00/lvol2 00000
00138 current /dev/vg00/lvol3 00000
00151 current /dev/vg00/lvol4 00000
00158 current /dev/vg00/lvol5 00000
00159 current /dev/vg00/lvol6 00000
00271 current /dev/vg00/lvol7 00000
# lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c0t1d0s2
Tantos como lvoles tengamos.
9º Actualizar el vg
# lvlnboot -R /dev/vg00
10º Verificar el arranque
# lvlnboot –v
11º Configurar en la NVRAM el nuevo disco
# setboot –a 0/1/1/0.1.0
12º Añadir a /stand/bootconf el disco
# vi /stand/bootconf
l /dev/dsk/c0t0d0s2
l /dev/dsk/c0t1d0s2f
Mirror de boot en Pa-risc
1º Verificar si el devicelink está creado, sino
# insf -e -H 0/0/1/0.1.1.0.1 o insf -e
2º Crear el physical volumen
# pvcreate -B /dev/rdsk/c0t1d0
3º Añadirlo al vg
# vgextend /dev/vg00 /dev/dsk/c0t1d0
4º Meterle el arranque
# mkboot /dev/rdsk/c0t1d0
5º Meterle el auto arranque
# mkboot -a “hpux” /dev/rdsk/c0t1d0
6º Mirrorear los lvoles
Sacar los lvoles del disco bueno
# pvdisplay -v /dev/dsk/c0t0d0 | grep ‘current.*0000 $’
00000 current /dev/vg00/lvol1 00000
00038 current /dev/vg00/lvol2 00000
00550 current /dev/vg00/lvol3 00000
00583 current /dev/vg00/lvol4 00000
00608 current /dev/vg00/lvol5 00000
00611 current /dev/vg00/lvol6 00000
00923 current /dev/vg00/lvol7 00000
01252 current /dev/vg00/lvol8 00000
# lvextend –m 1 /dev/vg00/lvol1 /dev/dsk/c0t1d0
Todos los demás.
7º Update la información del vg
# lvlnboot -R /dev/vg00
verificarlo
# lvlnboot –v
8º Añadir el path al NVRAM
# setboot –a 0/1/0.1.0
9º Añadir la linea al /stand/bootconf
# vi /stand/bootconf
l /dev/dsk/c0t0d0
l /dev/dsk/c0t1d0
NFS v4
NFS version 4
Cambios:
- todo va por el mismo protocolo, mas facil para los firewalls
- se empaquetan peticiones para una sola petición rpc
- se puede delegar en el cliente, cambios en ficheros sin que intervenga
inmediatamente el servidor. Está desactivado por defecto
- se aumenta la seguridad
- acls
- cada export tiene su nombre-path y se pueden montar trasversalmente. No en
hp-ux
- identificadores de nombres nombreusuario@dominio nombredegrupo@dominio (el
cambio a uid lo hace el demonio nfsmapid)
- mejora de locks
Configurar servidor
#vi /etc/default/nfs
NFS_SERVER_VERSMAX=4
#ps -ae|grep rpcbind
comprobar que está arrancado, si no #/sbin/init.d/nfs.core start
verificar que está todo arrancado
#ps -ae | grep rpc.lockd
#ps -ae | grep rpc.statd
si no están #/sbin/init.d/lockmgr start
por último
#/sbin/init.d/nfs.server start
Exportar
Ahora están los exports en /etc/dfs/dfstab no en /etc/exports
Se utiliza el comando share para exportar no exportfs
Cosas a tener en cuenta:
- Si están en el mismo filesystem / y /op no se podrán exportar los dos
a la vez.
- ante diferencia entre permisos del export y permisos unix, los
permisos que prevalecen son los del filesystem original, siempre se dejan los
mas restrictivos.
- Hay que tener cuidado con los links, porque en el cliente irán a su
propio filesystem si están fuera del export.
Procedimiento para exportar:
- Para que exporte en cada arranque, modificar /etc/dfs/dfstab con
share -F nfs -o rw=”Developers” -d “home dirs” /home
ejecutar #shareall para que se exporten
para verificar que está bien
#share
/home rw=Developers, ro= “home dirs”
- Para exportar a mano sin que se quede en el arranque
#share -F nfs -o rw=pepe:ro=juan /tmp
- Para desexportar
#unshare /loquesea
Extender lvol con Onlinejfs
lvdisplay lvolP
lvdisplay /dev/innvg/lvolP
lvextend -L 11264 /dev/innvg/lvolP
fsadm -F vxfs -b 11264M /export/usr/lvolP
bdf
exit
Configurar servicio dns
Configurar un master
1 Editar /etc/hosts con los nombres full-domain
192.168.1.1 localhost dnsmaster
192.168.1.2 host1.pepe.com.es host1
192.168.1.3 host2.pepe.com.es host2
2 #mkdir /etc/named.data
3 #chmod 755 /etc/named.data
4 #cd /etc/named.data
5 editar /etc/named.data/param
-d pepe.com.es
-n 192.168.1
-z 192.168.1.1
-b /etc/named.conf
(-d el nombre del dominio principal, -n la subnet del dominio, -z servidor, -b /fichero.conf “por
def. /etc/named.conf”)
6 Crear la bbdd hosts_to_named -f /etc/named.conf/param
7 bajarse por ftp db.cache y ponerlo en /etc/named.data
8 Modificar /etc/rc.config.d/namesrvrs
NAMED=1
NAMED_ARGS=”"
9 Arrancar el servicio
#/sbin/init.d/named start
Configurar esclavo
1 crear el /etc/named.data
2 copiar del maestro /etc/named.data/db.* en /etc/named.data
3 copiar del maestro /etc/named.data/conf.sec.save y moverla a /etc/named.conf
4 editar /etc/rc.config.d/namesvrs
NAMED=1
NAMED_ARGS=”"
5 Arrancar el servicio
#/sbin/init.d/named start
Solo caché
1 Crear /etc/named.data
2 chmod 755
3 copiar del maestro /etc/named.data/db.cache y db.127.0.0
4 copiar del maestro /etc/named.data/conf.cacheonly en /etc/named.conf
5 editar /etc/rc.config.d/namesvrs
NAMED=1
NAMED_ARGS=”"
5 Arrancar el servicio
#/sbin/init.d/named start
Probar el servidor
#nslookup host1.pepe.com.es o #nslookup 192.168.1.2
Clientes
#vi /etc/resolv.conf
search pepe.com.es
nameserver 192.168.1.1
nameserver 192.168.1.2
#vi /etc/nsswitch.conf
hosts: dns files
Recuperar sistema
Restaurar sistema
Recuperar ficheros, filesystems
fbackup -f dispositivo -i /home -I index.home
frestore -f dispositivo -i /home -xv (xv restaurar lo que se ponga en -i, -rv toda la cinta) Se
restaura en el path absoluto.
frestore -f dispositivo -i /home -xXV (lo restaura en el subdirectorio donde estés)
Filesystemcheck
1 umount /
2 fsck -F vxfs /dev/vg00/rlvol1
2 fsck -F vxfs -o full,nolog /dev/vg00/rvol1
2 fsck -F hfs -b 200 -y -f /dev/vg00/rlvol1 ( -b numero de superbloque, que están en /var/adm/sbtab)
3 mount
4 Mirar en lost+found los ficheros que se han creado
Defragmentación
fsadm -F vxfs -DE /filesystem (dá estadísticas)
fsadm -F vxfs -e /filesystem (reorganiza extends)
fsadm -F vxfs -d /filesystem (reorganiza subdirectorios)
fsadm -F vxfs -de /filesystem (reorganiza subdirectorios y extends)
Backup de LVM
vgcfgbackup /dev/vg01 crea en /etc/lvmconf/vg01.conf y si existe otro .conf lo renombra a
.conf.old)
Se hace backup cada vez que se hacen cambios
Restaurar
vgchange -a n vg01
vgcfgrestore -n /dev/vg01 /dev/rdsk/c0t3d0
vgchange -a y vg01
vgsync vg01 (si hubiera mirror)
mount -a
Recuperar de desastre en vg00
Ignite
Con cinta en /dev/rmt/0m (tape por defecto)
1 comprobar que está instalado el soft de ignite (swlist -l product Ignite-UX)
2 make_tape_recovery
3 revisar logs en /var/opt/ignite/recovery/datetime/recovery.log
Para recuperar de cinta
1 Arrancar la máquina y que arranque desde el path de la cinta.
PA-RISC (search ipl —-> boot p2 “donde esté la cinta” )
itanium (bootmanager)
Desde cinta
Antes tenemos que configurar un servidor de ignite, instalar el cliente y hacer un make_net_recovery
incluyendo el vg00.
Para restaurar, arrancar la máquina desde la tarjeta de red con la mac asociada en el servidor.
Checklist para tener un buen backup:
Full backups e incrementales
make_tape_recovery o make_net_recovery reciente.
/etc/lvmconf
print_manifest
vgdisplay -v de cada volumen
lvdisplay -v de cada lvol
pvdisplay -v de cada disco
lvlnboot -v del arranque
/etc/fstab
bdf
swapinfo
ioscan -fun
ioscan -kf
Chuleta de lvm
Esto es un copy-paste de otra página. Index: Regular tasks I) How to create a Volume Group (VG). II) How to create a Logical Volume (LV) and mount the filesystem. III) How to add a disk to a Volume Group IV) How to increase the size of a logical volume without OnlineJFS (advanced JFS) V) How to remove a Logical Volume VI) How to reduce the size of a logical volume without OnlineJFS (advanced JFS) VII) How to remove a disk from a volume group VIII) How to remove a volume group IX) How to increase the primary swap X) How to create a secondary boot disk LVM Mirroring XI) How to mirror a logical volume XII) How to unmirror a logical volume XIII) How to create a mirrored boot disk XIV) How to mirror a logical volume on a specific physical volume Physical Volume Group XV) How to create a Physical Volume Group (PVG) XVI) How to use PVG to mirror logical volumes on specific physical volumes. I) How to create a Volume Group (VG). Note The following example is using the disk c1t6d0, the volume group vg01 and the logical volume lvhome 1) Prepare the disk pvcreate /dev/rdsk/c1t6d0 Note if the disk was previously used in another VG use the following command instead: pvcreate -f /dev/rdsk/c1t6d0 2) Create the Volume Group (VG): a) mknod /dev/vg01/group c 64 0x010000 Note: the group number (last parameter) is in hexadecimal and should be different for each volume group. For vg02, that number would be 0x020000. The default limit is 10 volume groups as set by the kernel parameter maxvgs. b) vgcreate /dev/vg01 /dev/dsk/c1d0s2 Note: When a volume group is created the maximum physical extents per volume (max_pe parameter) will be set to the max_pe of the largest physical volume (PV) or 1016, which ever is greater, if no max_pe is specified. The effect of not setting the max_pe parameter would be that any PV added to the volume group in the future regardless of there size will be limited to the volume groug creation value of max_pe. Therefore, consider increasing the max_pe to accommodate PV’s that may likely be larger than the largest PV used to create the Volume Group. The formula to use to determine the value is: physical_extent_size * max_pe = size_of_the_disk. The default value for physical_extent_size is 4M and the maximum value for max_pe is 65535 (example for 18 gig disk use a value 4608 for max_pe: 4M * 4608 = 18 gig). There is also a default value of a maximum of 16 disks per volume group. The following is an example of the creation of a volume group modifying these two parameters (max_pe = 4608, maximum number of disk = 24): vgcreate -e 4608 -p 24 /dev/vg01 /dev/dsk/c1d0s2 II) How to create a Logical Volume (LV) and mount the filesystem. 1) Create the Logical Volume (LV) lvcreate -L 120 -n lvhome /dev/vg01 Note: this will create a logical volume of 120 meg. 2) Create the filesystem newfs -F vxfs /dev/vg01/rlvhome Note: to create an hfs filesystem change vxfs to hfs in the previous command. 3) Mount the Logical Volume: a) mkdir /home b) mount /dev/vg01/lvhome /home III) How to add a disk to a Volume Group Note The following examples is using the disk c1t6d0 and the volume group vg01 1) Prepare the disk pvcreate /dev/rdsk/c1t6d0 Note if the disk was previously used in another VG use the following command instead: pvcreate -f /dev/rdsk/c1t6d0 Note: Use caution when using pvcreate -f as this will overwrite the existing volume group information on the disk. 2) Add the disk to the Volume Group vgextend /dev/vg01 /dev/dsk/c1t6d0 IV) How to increase the size of a logical volume without online JFS (advanced JFS). Note: the following example is using the volume group vg01 and the logical volume lvhome Note: Increasing the root filesystem (/) is not feasible 1) lvextend -L 240 /dev/vg01/lvhome The new total size will be 240M. 2) umount /home Note: If the filesystem is in use, it is impossible to unmount it. Therefore stop all the processes (applications) that use the filesystem then unmount it. Processes that use /usr and /var cannot be all stopped, the only solution is to reboot in single user mode. 3) extendfs -F vxfs /dev/vg01/rlvhome 4) mount /dev/vg01/lvhome /home V) How to remove a Logical Volume Note: the following example is using the volume group vg01 and the logical volume lvhome 1) Backup all user data 2) Umount the filesystem umount /home 3) remove the Logical volume lvremove /dev/vg01/lvhome VI) How to reduce the size of a logical volume without online JFS (advanced JFS) Note: the following example is using the volume group vg01 and the logical volume lvhome 1) Backup all user data 2) Umount the filesystem umount /home 3) Reduce the size lvreduce -L 60 /dev/vg01/lvhome Note: the new total size will be 60M. 4) Re-create the filesystem newfs -F vxfs /dev/vg01/rlvhome Note: to create an hfs filesystem change vxfs by hfs in the previous command. 5) Mount the Logical Volume: mount /dev/vg01/lvhome /home 6) Restore the user data VII) How to remove a disk from a volume group Note: the following example is using the disk c1t6d0 and the volume group vg01 1) Make sure that the disk is not in use: pvdisplay /dev/dsk/c1t6d0 Look at line starting with Allocated PE the number at the end of the line should be 0. If it is not the disk is still in use. 2) Remove the disk vgreduce /dev/vg01 /dev/dsk/c1t6d0 VIII) How to remove a volume group Note: the following example is using the volume group vg01 and the logical volume lvhome 1) Backup all user data 2) Find the name of all logical volume in this volume group vgdisplay -v /dev/vg01 3) unmount all logical volumes Note: repeat the following command for each logical command umount /dev/vg01/lvhome 4) Remove the volume group: vgexport /dev/vg01 Note: using vgexport to remove a volume group is easier and faster than using the vgreduce on each physical volume except the last one, followed by a vgremove. The other advantage is that the /dev/vg01 directory is also removed. IX) How to increase the primary swap Note: Because of the contiguous allocation policy, create a bigger logical volume and modify the Boot Data Reserved Area (BDRA) to make it primary. 1) lvcreate -C y -L 240 /dev/vg00 The name of this new logical volume will be displayed on the screen, note it, it will be needed later. (let say it is /dev/vg00/lvol8) Note: This new logical volume has to be in vg00 2) lvlnboot -v /dev/vg00 This will display the current root and swap volumes Note: lvol2 is the default primary swap. 3) lvlnboot -s /dev/vg00/lvol8 /dev/vg00 Note: use the logical volume name from step 1 4) lvlnboot -R /dev/vg00 Recover any missing links to all of the logical volumes specified in the BDRA and update the BDRA of each bootable physical volume in the volume group 5) reboot the system X) How to create a secondary boot disk Note: This will create an identical copy of the current vg00. The new volume group needs to as big as vg00. This will also be a static version of the primary boot disk which could be use in case of problem. Note: The following example is using the disk c1t6d0 and the volume group vg01 1) Initialize the disk and make it bootable pvcreate -B /dev/rdsk/c1t6d0 Note: the -B parameter tells pvcreate that this will be a bootable disk. mkboot /dev/dsk/c1t6d0 mkboot -a "hpux" /dev/rdsk/c1t6d0 2) Create the volume group mkdir /dev/vg01 mknod /dev/vg01/group c 64 0x010000 vgcreate /dev/vg01 /dev/dsk/c1t6d0 3) Find the size of each logical volume in vg00 vgdisplay -v /dev/vg00 | more look at LV Size (Mbytes) for each logical volume and note it. Note: this example will use these value: lvol1 84M lvol2 256M lvol3 140M lvol4 500M lvol5 64M lvol6 20M lvol7 500M lvol8 500M Note: The size of the new logical volumes needs to be exactly the same as the size of the logical volumes on the primary root disk. 4) Create the first 3 logical volumes contiguous (needed by the system) lvol1: lvcreate -L 84 -C y -r n /dev/vg01 lvol2: lvcreate -L 256 -C y -r n /dev/vg01 lvol3: lvcreate -L 140 -C y -r n /dev/vg01 5) Now create the other logical volumes lvol4: lvcreate -L 500 /dev/vg01 lvol5: lvcreate -L 64 /dev/vg01 lvol6: lvcreate -L 20 /dev/vg01 lvol7: lvcreate -L 500 /dev/vg01 lvol8: lvcreate -L 500 /dev/vg01 6) Copy each logical volume except the swap which is usually lvol2. dd if=/dev/vg00/rlvol1 of=/dev/vg01/rlvol1 bs=1024k dd if=/dev/vg00/rlvol3 of=/dev/vg01/rlvol3 bs=1024k dd if=/dev/vg00/rlvol4 of=/dev/vg01/rlvol4 bs=1024k dd if=/dev/vg00/rlvol5 of=/dev/vg01/rlvol5 bs=1024k dd if=/dev/vg00/rlvol6 of=/dev/vg01/rlvol6 bs=1024k dd if=/dev/vg00/rlvol7 of=/dev/vg01/rlvol7 bs=1024k dd if=/dev/vg00/rlvol8 of=/dev/vg01/rlvol8 bs=1024k 7) Verify the integrity of all the new volume except swap. Note: The following lines are base on a system with vxfs filesystems except for /stand (lvol1) which needs to be hfs. fsck -F hfs /dev/vg01/rlvol1 fsck -F vxfs /dev/vg01/rlvol3 fsck -F vxfs /dev/vg01/rlvol4 fsck -F vxfs /dev/vg01/rlvol5 fsck -F vxfs /dev/vg01/rlvol6 fsck -F vxfs /dev/vg01/rlvol7 fsck -F vxfs /dev/vg01/rlvol8Now configure the Boot Data Reserved Area (BDRA) Note: The following commands assume that /stand is lvol1, swap is lvol2 and / is lvol3 lvlnboot -b /dev/vg01/lvol1 /dev/vg01 lvlnboot -r /dev/vg01/lvol3 /dev/vg01 lvlnboot -s /dev/vg01/lvol2 /dev/vg01 lvlnboot -d /dev/vg01/lvol2 /dev/vg01 9) Modify the fstab file on the new disk. a) If /tmp_mnt doesn't exist create it mkdir /tmp_mnt b) Mount the new root filesystem on /tmp_mnt mount /dev/vg01/lvol3 /tmp_mnt c) change to etc directory on the new disk. cd /tmp/etc d) Modify all occurence of vg00 in the fstab for vg01 sed "s/vg00/vg01/" fstab > fstab.out mv fstab fstab.BAK mv fstab.out fstab e) Unmount the new root filesystem cd / umount /tmp_mnt XI) How to mirror a logical volume Note: Data mirroring is provided by an additionnal purchasable software product called MirrorDisk/UX. Note: the following example is using the volume group vg01 and the logical volume lvhome To add a mirror to an existing logical volume: lvextend -m 1 /dev/vg01/lvhome This will add 1 mirror (2 copies of the filesystem). To add 2 mirrors (3 copies of the filesystem) use -m 2 instead. To create a new logical volume of 200M with 1 mirror: lvcreate -m 1 -L 200 /dev/vg01 XII) How to unmirror a logical volume Note: the following example is using the volume group vg01 and the logical volume lvhome lvreduce -m 0 /dev/vg01/lvhome XIII) How to create a mirrored boot disk Note the following example is using the disk c1t6d0 as the mirrored boot disk and c0t6d0 as the boot disk. 1) Initialize the disk and make it bootable pvcreate -B /dev/rdsk/c1t6d0 Note: the -B parameter tell pvcreate that this will be a bootable disk. 2) Add the physical volume to the volume group vgextend /dev/vg01 /dev/dsk/c1t6d0 3) Use mkboot to place the boot utilities in the boot area and add the AUTO file. mkboot /dev/dsk/c1t6d0 mkboot -a "hpux -lq" /dev/rdsk/c1t6d0 4) Use mkboot to update the AUTO file on the primary boot disk. mkboot -a "hpux -lq" /dev/rdsk/c0t6d0 5) Mirror the stand, root and swap logical volumes lvextend -m 1 /dev/vg00/lvol1 lvextend -m 1 /dev/vg00/lvol2 lvextend -m 1 /dev/vg00/lvol3 Note: LVM will resynchronize the new mirror copies. This step will takes several minutes Repeat the lvextend for all other logical volumes on the boot mirror. 6) Modify your alternate boot path to point to the mirror copy of the boot disk. setboot -a 8/8.6.0 # Use the Hardware path for your new boot disk. XIV) How to mirror a logical volume on a specific physical volume Note: the following example, is using the disk c1t6d0 for the primary copy, c2t6d0 for the mirror copy, the volume group vg01, the logical volume lvhome and the size will be 200M lvcreate -n lvhome /dev/vg01 lvextend -L 200 /dev/vg01/lvhome /dev/dsk/c1t6d0 lvextend -m 1 /dev/vg01/lvhome /dev/dsk/c2t6d0 XV) How to create a Physical Volume Group (PVG) create a file named /etc/lvmpvg with the following syntax: VG vg_name PVG pvg_name pv_path ... PVG pvg_name pv_path ... VG vg_name PVG pvg_name pv_path ... For example, to use two PVGs in vg01 with c1t6d0 and c2t6d0 in one PVG (PVG0), c3t6d0 and c4t6d0 in the other PVG (PVG1) the contents of the file (/etc/lvmpvg) should be: VG /dev/vg01 PVG PVG0 /dev/dsk/c1t6d0 /dev/dsk/c2t6d0 PVG PVG1 /dev/dsk/c3t6d0 /dev/dsk/c4t6d0 XVI) How to use PVG to mirror logical volumes on specific physical volumes. Note: in the following text, the volume group will be vg01 and the logical volume will be name lvhome After creating the /etc/lvmpvg file as describe above, each copy of your mirror could be force on different PVG. To achieve this if the logical volume is already created but not mirrored yet, use the following command: lvchange -s g /dev/vg01/lvhome lvextend -m 1 /dev/vg01/lvhome If the logical volume is not created yet: lvcreate -s g -m 1 -n lvhome -L 200 /dev/vg01