Recent Updates RSS Toggle Comment Threads | Keyboard Shortcuts

  • Gabriel Francisco 15:26 on 15/03/2012 Permalink | Reply
    Tags: , , , , replace, ,   

    Replacing disk in LVM 

    To replace a disk in LVM follow the steps below.

    Locate the disk to be replaced with the command:

    
    [root@intranet ~]# pvs -o +devices

    you get a result like the one below, remember in which it belongs,

    PV         VG       Fmt  Attr PSize   PFree Devices
      /dev/sda2   lvm2 a--  185.82g 1.00g /dev/sda2(0)
      /dev/sda2  pool00 lvm2 a--  185.82g 1.00g /dev/sda2(12800)
      /dev/sda2  pool00 lvm2 a--  185.82g 1.00g /dev/sda2(38400)
      /dev/sda2  pool00 lvm2 a--  185.82g 1.00g
      /dev/sda2  pool00 lvm2 a--  185.82g 1.00g /dev/sda2(45057)
    

    add the new disk in the same volume group:

    # vgextend pool00 /dev/sdb
    

    And move the old disk data to the new:

    # pvmove /dev/sda /dev/sdb
    

    PS: remember that if the disk where the / boot will have to recreate grub.

     
  • Gabriel Francisco 16:52 on 24/10/2011 Permalink | Reply
    Tags: , , mac, , samba, slow, smb, solved,   

    How to Fix Slow transfer Mac OS X and Samba 

    Start Terminal.app as root and set net.inet.tcp.delayed_ack=0:

    sudo sysctl -w net.inet.tcp.delayed_ack=0

    Make the change permanent creating the file /private/etc/sysctl.conf

    echo ‘net.inet.tcp.delayed_ack=0′ >> /private/etc/sysctl.conf

    ;)

     
  • Gabriel Francisco 14:13 on 30/08/2011 Permalink | Reply
    Tags: , , , ,   

    How to convert ext3 into ext4 filesystem 

    Using kernel 2.6.28 or above it.
    Umount filesystem that will be converted.ex: we will convert sda3

    # umount /dev/sda3

    Let’s to convertion /dev/sda3

    # tune2fs -O extents,uninit_bg,dir_index /dev/sda3

    Convertion process is not long, just a few second. Because we use command “uninit_bg”, It can shorten the time of fsck because it only checks inode that has changed.

    We will scan filesystem that has converted, and error message will appear, but don’t worry about it.

    # fsck -pDf /dev/sda3

    Mounting filesystem and Edit fstab to change UUID

    Mount partition:

    # mount /dev/sda3 /media/myext4

    Edit fstab and find:

    # / was on /dev/sda3 during installation

    UUID=922239b6-3eff-4c09-9e55-bf4023ec6358 / ext3 realtime,error s=remount-ro 0 1

    change to be:

    UUID=922239b6-3eff-4c09-9e55-bf4023ec6358 / ext4 realtime,error s=remount-ro 0 1

    Save your configuration and reboot pc.

    Enjoy your EXT4 Filesystem!
    ;)

     
  • Gabriel Francisco 11:40 on 30/08/2011 Permalink | Reply  

    How to fix Samba Symlinks and Mac OSX Lion, Snow Leopard 

    To solve a problem that osx can not browse samba symlinks is simple:

    Add to your smb.conf:

    unix extensions = no

    wide links = yes

     

    :)

     
  • Gabriel Francisco 17:42 on 16/08/2011 Permalink | Reply
    Tags: howto, ,   

    How to replace a falling disk on CentOS 6 

    How to replace a falling disk on centos

    create a identical partition map from the original disk:

    sfdisk -d /dev/sda | sfdisk –force /dev/sdb

    create a same filesystem type in new disk:

    mkfs.ext4 /dev/sdb1

    copy /boot content to new disk mounted at /mnt:

    rsync -avr /boot /mnt umount /mnt

    install grub on the new device:

    #grub

    #grub> find /grub/stage1

    set the new disk as hd0 on grub to:

    grub> device (hd0) /dev/sdb

     

    OBS: “We made the second drive /dev/sdb device (hd0) because  putting grub on it this way puts a bootable mbr on the 2nd drive and when the first drive is missing the second drive will boot.”
    install grub on new device:

    grub> root (hd0,0)

    grub> setup (hd0)

    grub> quit

    add the new disk partition to volume group:

    vgextend VolGroup00 /dev/sdb2

    move content from old to new disk with pvmove command:

    pvmove /dev/sda2 /dev/sdb2

    remove old disk partition from volume group:

    vgreduce VolGroup00 /dev/sda2

    get the UUID from new /boot partition of new disk:

    blkid

    edit the /boot entry on the /etc/fstab:

    UUID=’put here the new UUID’  /boot blabla…

    remount the /boot:

    umount /boot && mount /boot

    OBS: “mount -o remount not works, he mount the same old disk”
    Reboot and enjoy! ;-)

     
  • Gabriel Francisco 22:44 on 11/07/2011 Permalink | Reply
    Tags: apple, brilho, , , teclas, tela,   

    Resolvendo brilho da tela no MacBook Pro com Ubuntu 10.10/11.04 

    Resolvendo o problema do brilho com Ubuntu no macbook pro

    Para voltar a ter as funcionalidades de brilho da tela nas teclas F1 e F2, você primeiro deve instalar o DMKS e o pacote que contém o complilador e suas respectivas bibliotecas:

    #apt-get install dkms build-essential

    após isso, adicione o ppa do mactel:

    #add-apt-repository ppa:mactel-support && sudo apt-get update

    instale o pacote nvidia-bl-dkms e aguarde o dkms fazer o trabalho:

    #apt-get install nvidia-bl-dkms

    Se você estiver usando algum kernel mais recente não precisará reiniciar, basta carregar o modulo com o comando:

    #modprobe nvidia_bl

    e suas teclas F1 e F2 ja estará funcionando, testado no MacbookPro 7,1 com o Ubuntu 10.10 e 11.04.

    fonte: Google, UbuntuForum

     
  • Gabriel Francisco 15:49 on 11/07/2011 Permalink | Reply
    Tags: , conntrack, nginx, , servidor, , time_wait, , varnish,   

    Melhorar performance servidor web com sockets TIME_WAIT em excesso 

    TCP_TW_RECYCLE
    Ele permite a reciclagem rápida de sockets TIME_WAIT. O valor padrão é 0 (desativado). A documentação sysctl afirma incorretamente o padrão comohabilitado. Ele pode ser alterado para 1 (habilitado) em muitos casos. Conhecido por causar alguns problemas com hoststated (balanceamento de carga e fail over) se habilitado, deve ser usado com cautela.

    echo 1> / proc/sys/net/ipv4/tcp_tw_recycle

    (boolean, padrão: 0)

    TCP_TW_REUSE
    Isto permite a reutilização de soquetes em estado TIME_WAIT para novas conexõesquando é seguro do ponto de vista protocolo. Valor padrão é 0 (desativado).Geralmente, é uma alternativa mais segura para tcp_tw_recycle

    echo 1> / proc/sys/net/ipv4/tcp_tw_reuse

    (boolean, padrão: 0)

    Nota: A configuração tcp_tw_reuse é particularmente útil em ambientes ondenumerosas conexões curtas estão abertas e acabam ficando com o status TIME_WAIT , como servidores web. Reutilizando os sockets pode ser muito eficaz na redução da carga do servidor.

     

     

    Para setar as opções, utilize:

    sysctl -w net.ipv4.tcp_tw_reuse=1

    sysctl -w net.ipv4.tcp_tw_recycle=1

    ou

     

    echo 1> / proc/sys/net/ipv4/tcp_tw_reuse

    echo 1> / proc/sys/net/ipv4/tcp_tw_recycle

     

    verifique as mudanças com o netstat.

    Ao reiniciar as configurações são perdidas, para mantê-las coloque nos scripts de inicialização do sistema (ex: rc.local)

     

    fonte: SpeedGuide, man pages.

     

     
  • Gabriel Francisco 0:15 on 04/07/2011 Permalink | Reply
    Tags: deface, fail, Microsoft,   

    Site Microsoft Brasil sofre deface 

    O site brasileiro da Microsoft sofreu defacement no dia 4 de julho por volta das 22 horas. Trata-se de um IIS/7 o qual dizem não haver vulnerabilidades conhecidas até hoje.

    Uma imagem vale mais que mil palavras:

    deface microsoft brasil

     

     

     

     
  • Gabriel Francisco 23:14 on 21/06/2011 Permalink | Reply
    Tags: cache, , mysql, , query   

    Melhorar a Performance do MySQL com Query cache 

    Uma das melhores maneiras de acelerar seu aplicativo da web é habilitar o cache de consulta em seu banco de dados, o cache  armazena os resultados consultas SQL em memória para acesso praticamente instantâneo pela próxima página que faz com que o mesmo pedido.
    Este método é tão eficaz que você não precise fazer qualquer alteração no seu aplicativo web, você só tem que sacrificar um pouco de memória. Isso é ideal para um aplicativo que faz bastantes consultas no banco de dados, como um blog em WordPress.
    Antes de tudo, você deve verificar se sua versão tem suporte a cache de consultas. Para isso abra um terminal, conecte no mysql e digite:



    mysql> show variables like ‘have_query_cache’;
    +——————+——-+
    | Variable_name    | Value |
    +——————+——-+
    | have_query_cache | YES   |
    +——————+——-+
    1 row in set (0.00 sec)

    Agora que você ja sabe que tem suporte, habilite o cache com o seguinte comando:



    mysql> show variables like ‘query%’;
    +——————————+———+
    | Variable_name                | Value   |
    +——————————+———+
    | query_alloc_block_size       | 8192    |
    | query_cache_limit            | 1048576 |
    | query_cache_min_res_unit     | 4096    |
    | query_cache_size             | 0       |
    | query_cache_type             | ON      |
    | query_cache_wlock_invalidate | OFF     |
    | query_prealloc_size          | 8192    |
    +——————————+———+
    7 rows in set (0.00 sec)

    o que importa aqui e o que significa:
    query_cache_size – é o tamanho do cache em bytes. O valor como 0 desativa o cache.
    query_cache_type – este valor deve ser ON ou 1 para que o cache de consulta seja habilitado.
    query_cache_limit – tamanho máximo de consulta (em bytes) que vai ser armazenada em cache.
    Sabendo que o valor é em bytes, então para 8MB calcula-se  1024*1024*8 = 8388608.
    Para calcular o tamanho em MegaBytes “preguiçosamente” use:




    mysql> select sum(1024*1024*8);
    +——————+
    | sum(1024*1024*8) |
    +——————+
    |          8388608 |
    +——————+
    1 row in set (0.00 sec)

    use o seguinte comando para setar os valores para as variáveis:



    mysql> SET GLOBAL query_cache_size = 8388608;

    Da mesma forma, as outras opções podem ser definidas com a mesma sintaxe:



    mysql> SET GLOBAL query_cache_limit = 1048576;
    mysql> SET GLOBAL query_cache_type = 1;

    Agora você pode verificar se está obtendo acertos de cache (hits) com o comando:

    mysql> SHOW STATUS like ‘Qc%’;
    +————————-+———+
    | Variable_name | Value |
    +————————-+———+
    | Qcache_free_blocks | 1 |
    | Qcache_free_memory | 8378312 |
    | Qcache_hits | 290 |
    | Qcache_inserts | 1 |
    | Qcache_lowmem_prunes | 0 |
    | Qcache_not_cached | 1 |
    | Qcache_queries_in_cache | 1 |
    | Qcache_total_blocks | 4 |
    +————————-+———+
    8 rows in set (0.00 sec)

    Para manter essas configurações quando MySQL for iniciado, adicione essas opções no seu /etc/mysql/my.cnf, o local do arquivo pode mudar dependendo da sua distro.



    query_cache_size = 134217728
    query_cache_type = 1
    query_cache_limit = 1048576

    Monitore com o tempo para verificar os resultados.
    Abraço.
     
  • Gabriel Francisco 14:24 on 08/06/2011 Permalink | Reply
    Tags: cli, , grep, linha de comando, , terminal   

    Removendo a linha extra do ps + grep 

    Sempre que você usa o comando ps seguido de grep, na saída do comando aparece uma linha extra, referente próprio comando grep, como no exemplo:

     

    gabrielfrancisco@macbookpro:~$ ps xa| grep smbd

    26953   ??  Ss     0:00.59 /usr/sbin/smbd -F

    26955   ??  S      0:00.00 /usr/sbin/smbd -F

    53467 s000  S+     0:00.00 grep –color=yes smbd

    Para evitar isso, basta colocar um regex “[ ]” em qualquer letra da string que deseja procurar, assim você terá apena o que você quer:

     

    gabrielfrancisco@macbookpro:~$ ps xa| grep smb[d]

    26953   ??  Ss     0:00.59 /usr/sbin/smbd -F

    26955   ??  S      0:00.00 /usr/sbin/smbd -F

     

     


     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel