você está aqui: Home  → Arquivo de Mensagens

Verificar e Extender Memoria Swap - SUN

Colaboração: Allan Jones

Data de Publicação: 02 de Janeiro de 2006

Recentemente me deparei com um problema em uma maquina SUN (Sun Blade 100).

Alguns servicos da minha gerencia nao estavam "startando", entao apos tanto buscar informacoes no site da Sun e analisar algumas mensagens (/var/adm/) descobri que o problema estava na insuficiencia de memoria swap, o erro que estava retornando para todos os servicos que nao "startavam" era => failed: Resource temporarily unavailable.

Um bom teste para saber se isso ocorre e tentar mover um arquivo grande de uma pasta para outra, retornara o seguinte codigo de erro => No space left on device.

Abaixo segue um script para coletar as informacoes (rodei o script no home do usuario root):

  #! /bin/sh
  < A NAME="note" HREF="#textnote">< SUP>
  #
  # Developer: Allan Jones
  #
  < A NAME="note" HREF="#textnote">< SUP>
  
  mkdir swap_tmp_check
  
  CHECK_FILE="swap_tmp_check/check_file.log"
  
  echo "< A NAME="note# BEGIN: swap -s " HREF="#textnote# BEGIN: swap -s ">< SUP># BEGIN: swap -s #" >> $CHECK_FILE
  swap -s >> $CHECK_FILE
  echo "< A NAME="note# END: swap -s " HREF="#textnote# END: swap -s ">< SUP># END: swap -s #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: swap -l " HREF="#textnote# BEGIN: swap -l ">< SUP># BEGIN: swap -l #" >> $CHECK_FILE
  swap -l >> $CHECK_FILE
  echo "< A NAME="note# END: swap -l " HREF="#textnote# END: swap -l ">< SUP># END: swap -l #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: df " HREF="#textnote# BEGIN: df ">< SUP># BEGIN: df #" >> $CHECK_FILE
  df >> $CHECK_FILE
  echo "< A NAME="note# END: df " HREF="#textnote# END: df ">< SUP># END: df #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: df -t " HREF="#textnote# BEGIN: df -t ">< SUP># BEGIN: df -t #" >> $CHECK_FILE
  df -t >> $CHECK_FILE
  echo "< A NAME="note# END: df -t " HREF="#textnote# END: df -t ">< SUP># END: df -t #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: df -k " HREF="#textnote# BEGIN: df -k ">< SUP># BEGIN: df -k #" >> $CHECK_FILE
  df -k >> $CHECK_FILE
  echo "< A NAME="note# END: df -k " HREF="#textnote# END: df -k ">< SUP># END: df -k #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: df -n " HREF="#textnote# BEGIN: df -n ">< SUP># BEGIN: df -n #" >> $CHECK_FILE
  df -n >> $CHECK_FILE
  echo "< A NAME="note# END: df -n " HREF="#textnote# END: df -n ">< SUP># END: df -n #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: df /tmp " HREF="#textnote# BEGIN: df /tmp ">< SUP># BEGIN: df /tmp #" >> $CHECK_FILE
  df /tmp >> $CHECK_FILE
  echo "< A NAME="note# END: df /tmp " HREF="#textnote# END: df /tmp ">< SUP># END: df /tmp #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: df /swap " HREF="#textnote# BEGIN: df /swap ">< SUP># BEGIN: df /swap #" >> $CHECK_FILE
  df /swap >> $CHECK_FILE
  echo "< A NAME="note# END: df /swap " HREF="#textnote# END: df /swap ">< SUP># END: df /swap #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: vmstat 10 10 " HREF="#textnote# BEGIN: vmstat 10 10 ">< SUP># BEGIN: vmstat 10 10 #" >> $CHECK_FILE
  vmstat 10 10 >> $CHECK_FILE
  echo "< A NAME="note# END: vmstat 10 10 " HREF="#textnote# END: vmstat 10 10 ">< SUP># END: vmstat 10 10 #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: vmstat -p 10 10 " HREF="#textnote# BEGIN: vmstat -p 10 10 ">< SUP># BEGIN: vmstat -p 10 10 #" >> $CHECK_FILE
  vmstat -p 10 10 >> $CHECK_FILE
  echo "< A NAME="note# END: vmstat -p 10 10 " HREF="#textnote# END: vmstat -p 10 10 ">< SUP># END: vmstat -p 10 10 #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: iostat 10 10 " HREF="#textnote# BEGIN: iostat 10 10 ">< SUP># BEGIN: iostat 10 10 #" >> $CHECK_FILE
  iostat 10 10 >> $CHECK_FILE
  echo "< A NAME="note# END: iostat 10 10 " HREF="#textnote# END: iostat 10 10 ">< SUP># END: iostat 10 10 #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: ipcs -mb " HREF="#textnote# BEGIN: ipcs -mb ">< SUP># BEGIN: ipcs -mb #" >> $CHECK_FILE
  ipcs -mb >> $CHECK_FILE
  echo "< A NAME="note# END: ipcs -mb " HREF="#textnote# END: ipcs -mb ">< SUP># END: ipcs -mb #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: cat /etc/vfstab " HREF="#textnote# BEGIN: cat /etc/vfstab ">< SUP># BEGIN: cat /etc/vfstab #" >> $CHECK_FILE
  cat /etc/vfstab >> $CHECK_FILE
  echo "< A NAME="note# END: cat /etc/vfstab " HREF="#textnote# END: cat /etc/vfstab ">< SUP># END: cat /etc/vfstab #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: cat /etc/system " HREF="#textnote# BEGIN: cat /etc/system ">< SUP># BEGIN: cat /etc/system #" >> $CHECK_FILE
  cat /etc/system >> $CHECK_FILE
  echo "< A NAME="note# END: cat /etc/system " HREF="#textnote# END: cat /etc/system ">< SUP># END: cat /etc/system #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  echo "< A NAME="note# BEGIN: cat /var/adm/messages " HREF="#textnote# BEGIN: cat /var/adm/messages ">< SUP># BEGIN: cat /var/adm/messages #" >> $CHECK_FILE
  cat /var/adm/messages >> $CHECK_FILE
  echo "< A NAME="note# END: cat /var/adm/messages " HREF="#textnote# END: cat /var/adm/messages ">< SUP># END: cat /var/adm/messages #" >> $CHECK_FILE
  echo "" >> $CHECK_FILE
  
  
  tar -cvf swap_tmp_check.tar /swap_tmp_check
  
  rm -R /swap_tmp_check

Para extender a memoria swap, siga o seguinte procedimento:

  1. Criar um diretorio para a criacao do arquivo para a memoria swap

      # mkdir /swap/files
      # cd /swap/files
      # pwd
      /swap/files
    

  2. Verificar o tamanho da memoria swap disponivel

      # swap -s
      total: 815216k bytes allocated + 1030792k reserved =
      1846008k used, 3640k available
    

  3. Criar o arquivo para memoria swap

      # mkfile -v 3000m swap_extend_20050915
      swap_extend_20050915 3145728000 bytes
      # ls -l
      total 6147024
      -rw------T 1 root other 3145728000 Sep 15 10:12 swap_extend_20050915
    

  4. Extender memoria swap

      # swap -a /swap/files/swap_extend_20050915
    

  5. Verificar se a memoria swap foi extendida corretamente

      # swap -l
      swapfile             dev  swaplo blocks   free
      /dev/dsk/c0t0d0s1   136,1      16 2101184 1781456
      /swap/files/swap_extend_20050915  -       16 6143984 6143984
      # swap -s
      total: 815376k bytes allocated + 1030904k reserved 
      = 1846280k used, 3073616k available
    

    Pode-se verificar no item (2) e (5) a diferencia de memoria disponivel. Apos esse procedimento os servicos de minha gerencia "startaram" corretamente.


Veja a relação completa dos artigos de Allan Jones

 

 

Opinião dos Leitores

Seja o primeiro a comentar este artigo
*Nome:
Email:
Me notifique sobre novos comentários nessa página
Oculte meu email
*Texto:
 
  Para publicar seu comentário, digite o código contido na imagem acima
 


Powered by Scriptsmill Comments Script