Archive for the ‘Debian GNU/Linux’ Category.

Tips: Configurar apt.conf para no instalar paquetes recomendados/sugeridos en Debian

i_love_debian
Despues de tantos años de utilizar Debian en servidores y Desktops he llegado a tener un checklist de tareas que cumplo a rajatabla cada vez que necesito hacer una nueva instalación.

Este post tiene como finalidad compartir uno de estos tips:

Administración de paquetes

Amo Debian… Hago alarde de un verdadero derroche de satisfacción al utilizar Debian dia a dia pero no todo es color de rosas y como sabemos la perfección no existe.
Y es verdad que tengo que darle la razón a amigos que cordial y salvajemente me recuerdan a la mínima posibilidad de lo poco optimizado que está implementado el sistema de dependencias en Debian (y derivados), no es ningún secreto que una instalación promedio instala muchas mas cosas de las necesarias y eso hasta a mí me molesta porque con el tiempo la cantidad de librerias innecesarias crece incesantemente y los updates/upgrades bajan cada vez mayor cantidad de paquetes.

Por ese motivo incluso cuando instalo Debian desde cero en una notebook/desktop y siempre con el netinstaller, nunca jamás selecciono la opción “Desktop Environment”, sino que sólo dejo tildada la opción “Standard System Utilities”

Wheezy Virtual Machine_501

Siempre! hago un párate y termino la instalación con lo mínimo e indispensable, cuando reinicio por primera vez lo primero que hago es editar/crear el archivo /etc/apt/apt.conf y le agrego estas opciones:

1
2
APT::Install-Recommends "0";
APT::Install-Suggests "0";
APT::Install-Recommends "0";
APT::Install-Suggests "0";

En qué cambia todo…?
Es mucho mejor explicarlo con un ejemplo, algo que automáticamente hago apenas tengo shell post-instalación disponible es instalar esta lista de paquetes:

1
2
3
4
5
6
7
8
root@wheezy:~# aptitude install ssh screen rsync sysv-rc-conf less telnet dnsutils whois mc mlocate sudo vim iperf iftop iptraf zip unzip bzip2
The following NEW packages will be installed:
  iftop iperf iptraf libcurses-perl{a} libcurses-ui-perl{a} libffi5{a} libglib2.0-0{a} 
  libglib2.0-data{a} libpcap0.8{a} libterm-readkey-perl{a} mc mc-data{a} rsync screen 
  shared-mime-info{a} sudo sysv-rc-conf unzip vim vim-runtime{a} zip 
0 packages upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.3 MB of archives. After unpacking 54.2 MB will be used.
Do you want to continue? [Y/n/?]
root@wheezy:~# aptitude install ssh screen rsync sysv-rc-conf less telnet dnsutils whois mc mlocate sudo vim iperf iftop iptraf zip unzip bzip2
The following NEW packages will be installed:
  iftop iperf iptraf libcurses-perl{a} libcurses-ui-perl{a} libffi5{a} libglib2.0-0{a} 
  libglib2.0-data{a} libpcap0.8{a} libterm-readkey-perl{a} mc mc-data{a} rsync screen 
  shared-mime-info{a} sudo sysv-rc-conf unzip vim vim-runtime{a} zip 
0 packages upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.3 MB of archives. After unpacking 54.2 MB will be used.
Do you want to continue? [Y/n/?]

14.3 MB con un apt.conf vacío, veamos cuántos MBs bajaría indicándole al sistema que no instale recomendados ni sugeridos.

1
2
3
4
5
6
7
8
9
10
root@wheezy:~# aptitude install ssh screen rsync sysv-rc-conf less telnet dnsutils whois mc mlocate sudo vim iperf iftop iptraf zip unzip bzip2 
The following NEW packages will be installed:
  iftop iperf iptraf libcurses-perl{a} libcurses-ui-perl{a} libffi5{a} libglib2.0-0{a} 
  libpcap0.8{a} libterm-readkey-perl{a} mc mc-data{a} rsync screen sudo sysv-rc-conf unzip vim 
  vim-runtime{a} zip 
The following packages are RECOMMENDED but will NOT be installed:
  libglib2.0-data shared-mime-info 
0 packages upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.1 MB of archives. After unpacking 42.2 MB will be used.
Do you want to continue? [Y/n/?]
root@wheezy:~# aptitude install ssh screen rsync sysv-rc-conf less telnet dnsutils whois mc mlocate sudo vim iperf iftop iptraf zip unzip bzip2 
The following NEW packages will be installed:
  iftop iperf iptraf libcurses-perl{a} libcurses-ui-perl{a} libffi5{a} libglib2.0-0{a} 
  libpcap0.8{a} libterm-readkey-perl{a} mc mc-data{a} rsync screen sudo sysv-rc-conf unzip vim 
  vim-runtime{a} zip 
The following packages are RECOMMENDED but will NOT be installed:
  libglib2.0-data shared-mime-info 
0 packages upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.1 MB of archives. After unpacking 42.2 MB will be used.
Do you want to continue? [Y/n/?]

12.1 MB! sólo es una pequeña diferencia con tan poco paquetes, pero veamos hasta qué punto podemos optimizar esto instalando un entorno completo de escritorio como XFCE.

Selection_006

/etc/apt/apt.conf vacío

Selection_007

/etc/apt/apt.conf optimizado

Sin la optimización en /etc/apt/apt.conf toda la descarga de XFCE serían 562MB contra los 324MB si no instalamos paquetes recomendados ni sugeridos, creo que está mas que clara la ventaja de utilizar esta configuración en un servidor para no solamente ocupar menos espacio sino que al tener menos paquetes y librerias disminuimos las posibilidades de sufrir vulnerabilidades en nuestro sistema.

Instalación de OpenVSwitch en Debian Wheezy

Dado que Debian Wheezy (actual testing) está a la vuelta de la esquina antes de pasar a ser la versión estable en reemplazo de Squeeze, ya estoy haciendo pruebas para poder reemplazar mis servidores en los cuales virtualizo con KVM para poder utilizar las nuevas versiones de qemu + libvirt + spice.

Una de las cosas que deseo hacer es dejar de utilizar bridge-utils y reemplazarlo por openvswitch que es mas versátil y me provee a futuro de mejores opciones de configuración si tengo que trabajar en entornos con VLANS, QOS, NetFlow, etc.

Habiendo infinidad de posts en internet explicando el proceso de instalación de openvswitch para Debian Wheezy este no pretende ser la panacea, sino servir de ayudamemoria y documentar algunos tips con los que me fui encontrando a medida que voy realizando pruebas.

openvswitch features

En Debian tenemos 2 modos de instalar los módulos correspondientes a openvswitch en el kernel, uno es instalando el paquete openvswitch-datapath-dkms el otro es con openvswitch-datapath-source, para ver las diferencias ejecutamos el siguiente comando.

1
2
3
root@zama:~# aptitude search openvswitch |grep openvswitch-datapath
p   openvswitch-datapath-dkms       - Open vSwitch datapath module source - DKMS
p   openvswitch-datapath-source     - Open vSwitch datapath module source - module-assistant version
root@zama:~# aptitude search openvswitch |grep openvswitch-datapath
p   openvswitch-datapath-dkms       - Open vSwitch datapath module source - DKMS
p   openvswitch-datapath-source     - Open vSwitch datapath module source - module-assistant version

Como allí se ve, con la primera opción instalamos el modulo en el kernel si este tiene soporte para DKMS (x default en Debian) o utilizando module-assistant, queda a criterio de cada uno elegir el método apropiado de todas maneras aqui veremos ambos ejemplos pero vale mencionar que es conveniente utilizar la opción DKMS por si cambiamos en algún momento de kernel asi evitamos volver a compilar el modulo correspondiente.

Para ambos casos es necesario primero instalar estos paquetes:

1
root@zama:~# aptitude install build-essential module-assistant linux-headers-`uname -r`
root@zama:~# aptitude install build-essential module-assistant linux-headers-`uname -r`

Utilizando openvswitch-datapath-dkms

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
root@zama:~# aptitude install openvswitch-datapath-dkms
The following NEW packages will be installed:
  dkms{a} openvswitch-datapath-dkms 
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,036 kB of archives. After unpacking 12.6 MB will be used.
Do you want to continue? [Y/n/?] 
.
.
.
.
Creating symlink /var/lib/dkms/openvswitch/1.4.2+git20120612/source ->
                 /usr/src/openvswitch-1.4.2+git20120612
 
DKMS: add completed.
 
Kernel preparation unnecessary for this kernel.  Skipping...
 
Building module:
cleaning build area....(bad exit status: 2)
./configure --with-linux='/lib/modules/3.2.0-4-amd64/build' && make -C datapath/linux..........
cleaning build area....(bad exit status: 2)
 
DKMS: build completed.
 
openvswitch_mod:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/
 
brcompat_mod.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/
 
depmod...a.ptit.
 
DKMS: install completed.
root@zama:~# aptitude install openvswitch-datapath-dkms
The following NEW packages will be installed:
  dkms{a} openvswitch-datapath-dkms 
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,036 kB of archives. After unpacking 12.6 MB will be used.
Do you want to continue? [Y/n/?] 
.
.
.
.
Creating symlink /var/lib/dkms/openvswitch/1.4.2+git20120612/source ->
                 /usr/src/openvswitch-1.4.2+git20120612

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....(bad exit status: 2)
./configure --with-linux='/lib/modules/3.2.0-4-amd64/build' && make -C datapath/linux..........
cleaning build area....(bad exit status: 2)

DKMS: build completed.

openvswitch_mod:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

brcompat_mod.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

depmod...a.ptit.

DKMS: install completed.

Con el comando anterior tenemos disponible el soporte para openvswitch en nuestro kernel, resta solamente instalar los paquetes restantes y habilitar la carga del modulo brcomp en el inicio del sistema.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@zama:~# aptitude install openvswitch-brcompat openvswitch-common openvswitch-switch
.
.
.
.
[ ok ] Inserting openvswitch module.
[warn] /var/lib/openvswitch/conf.db does not exist ... (warning).
[ ok ] Creating empty database /var/lib/openvswitch/conf.db.
[ ok ] Starting ovsdb-server.
[ ok ] Configuring Open vSwitch system IDs.
[ ok ] Starting ovs-vswitchd.
Setting up openvswitch-brcompat (1.4.2+git20120612-9) ...
[ ok ] ovsdb-server is already running.
[ ok ] ovs-vswitchd is already running.
root@zama:~# aptitude install openvswitch-brcompat openvswitch-common openvswitch-switch
.
.
.
.
[ ok ] Inserting openvswitch module.
[warn] /var/lib/openvswitch/conf.db does not exist ... (warning).
[ ok ] Creating empty database /var/lib/openvswitch/conf.db.
[ ok ] Starting ovsdb-server.
[ ok ] Configuring Open vSwitch system IDs.
[ ok ] Starting ovs-vswitchd.
Setting up openvswitch-brcompat (1.4.2+git20120612-9) ...
[ ok ] ovsdb-server is already running.
[ ok ] ovs-vswitchd is already running.

Una vez instalados estos paquetes editamos el archivo /etc/default/openvswitch-switch descomentamos y cambiamos a “yes” la siguiente variable

1
BRCOMPAT=yes
BRCOMPAT=yes

Cargamos el modulo brcomp y verificamos el estatus de los diferentes servicios.

1
2
3
4
5
6
7
8
9
root@zama:~# modprobe brcomp
root@zama:~# lsmod |grep brcomp
brcompat_mod           13031  0 
openvswitch_mod        67948  1 brcompat_mod
 
root@zama:~# /etc/init.d/openvswitch-switch status
ovsdb-server is running with pid 2627
ovs-vswitchd is running with pid 2686
ovs-brcompatd is running with pid 2727
root@zama:~# modprobe brcomp
root@zama:~# lsmod |grep brcomp
brcompat_mod           13031  0 
openvswitch_mod        67948  1 brcompat_mod

root@zama:~# /etc/init.d/openvswitch-switch status
ovsdb-server is running with pid 2627
ovs-vswitchd is running with pid 2686
ovs-brcompatd is running with pid 2727

Y listo! con eso tenemos soporte completo para openvswitch en nuestro servidor.

Utilizando openvswitch-datapath-source

Con este método utilizaremos module-assistant para compilar el modulo para nuestro kernel, comenzaremos instalando los paquetes apropiados.

1
root@zama:~# aptitude install openvswitch-datapath-source
root@zama:~# aptitude install openvswitch-datapath-source

Ejecutamos module-assistant donde en algún momento del proceso veremos algo como esto:

building_openvswitch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@zama:~# module-assistant auto-install openvswitch-datapath
.
.
.
.
Updated infos about 1 packages
unpack 
Extracting the package tarball, /usr/src/openvswitch-datapath.tar.bz2, please wait...
"/usr/share/modass/packages/default.sh" build KVERS=3.2.0-4-amd64 KSRC=/lib/modules/3.2.0-4-amd64/build KDREV=3.2.39-2 kdist_image
Done with /usr/src/openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb .
dpkg -Ei /usr/src/openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb 
Selecting previously unselected package openvswitch-datapath-module-3.2.0-4-amd64.
(Reading database ... 51924 files and directories currently installed.)
Unpacking openvswitch-datapath-module-3.2.0-4-amd64 (from .../openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb) ...
Setting up openvswitch-datapath-module-3.2.0-4-amd64 (1.4.2+git20120612-9)
root@zama:~# module-assistant auto-install openvswitch-datapath
.
.
.
.
Updated infos about 1 packages
unpack 
Extracting the package tarball, /usr/src/openvswitch-datapath.tar.bz2, please wait...
"/usr/share/modass/packages/default.sh" build KVERS=3.2.0-4-amd64 KSRC=/lib/modules/3.2.0-4-amd64/build KDREV=3.2.39-2 kdist_image
Done with /usr/src/openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb .
dpkg -Ei /usr/src/openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb 
Selecting previously unselected package openvswitch-datapath-module-3.2.0-4-amd64.
(Reading database ... 51924 files and directories currently installed.)
Unpacking openvswitch-datapath-module-3.2.0-4-amd64 (from .../openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb) ...
Setting up openvswitch-datapath-module-3.2.0-4-amd64 (1.4.2+git20120612-9)

Haciendo esto vemos que se ha generado un *.deb y se ha instalado.

1
2
3
4
5
root@zama:~# aptitude search openvswitch |grep datapath
p   openvswitch-datapath-dkms       - Open vSwitch datapath module source - DKMS
v   openvswitch-datapath-module     -                                           
i   openvswitch-datapath-module-3.2 - Open vSwitch Linux datapath kernel module 
i   openvswitch-datapath-source     - Open vSwitch datapath module source - module-assistant version
root@zama:~# aptitude search openvswitch |grep datapath
p   openvswitch-datapath-dkms       - Open vSwitch datapath module source - DKMS
v   openvswitch-datapath-module     -                                           
i   openvswitch-datapath-module-3.2 - Open vSwitch Linux datapath kernel module 
i   openvswitch-datapath-source     - Open vSwitch datapath module source - module-assistant version

Sólo resta instalar los paquetes openvswitch-brcompat openvswitch-common openvswitch-switch editar el archivo /etc/default/openvswitch-switch, cargar el modulo brcomp y reiniciar para verificar que todo esté ok.

Este post me ha sido de ayuda para publicar mi propio tutorial explicando ambos métodos para instalar openvswitch:

http://phenobarbital.wordpress.com/2012/12/08/instalando-y-usando-openvswitch-en-debian-gnulinux/

Upgrade Redmine 2.1.x > 2.2.x en Debian

Lo prometido es deuda…

En mi anterior post Instalar Redmine en Debian guía definitiva documenté el proceso completo para instalar Redmine de una forma eficiente y sin problemas de dependencias en Debian, me quedaba pendiente el procedimiento para hacer un upgrade de Redmine y este es el tutorial.

En la instalación anterior utilicé la versión 2.1.6 una de las versiones estables en ese momento, hoy solamente tenemos la versión 2.2.3 y en los próximos dias seguramente esté disponible la 2.3.0

Importante! Antes de realizar un upgrade deben verificar que todos los plugins funcionan correctamente y/o están soportados por la nueva versión de Redmine.

Mi instalación base está en /var/lib/redmine, verificamos el repositorio SVN y vemos que la URL es http://svn.redmine.org/redmine/branches/2.1-stable

1
2
3
4
5
6
7
8
9
10
11
www-data@trackersvn:/var/lib/redmine$ svn info
Path: .
URL: http://svn.redmine.org/redmine/branches/2.1-stable
Repository Root: http://svn.redmine.org/redmine
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 11578
Node Kind: directory
Schedule: normal
Last Changed Author: jplang
Last Changed Rev: 11152
Last Changed Date: 2013-01-09 11:03:28 -0300 (Wed, 09 Jan 2013)
www-data@trackersvn:/var/lib/redmine$ svn info
Path: .
URL: http://svn.redmine.org/redmine/branches/2.1-stable
Repository Root: http://svn.redmine.org/redmine
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 11578
Node Kind: directory
Schedule: normal
Last Changed Author: jplang
Last Changed Rev: 11152
Last Changed Date: 2013-01-09 11:03:28 -0300 (Wed, 09 Jan 2013)

Según leemos en la documentación oficial, la url del repositorio SVN para la versión 2.2.3 es http://svn.redmine.org/redmine/branches/2.2-stable por lo tanto debemos cambiarla (esto nos hará un update de todos los archivos también).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
www-data@trackersvn:/var/lib/redmine$ svn switch http://svn.redmine.org/redmine/branches/2.2-stable
U    test/unit/issue_relation_test.rb
U    test/unit/version_test.rb
U    test/unit/issue_test.rb
U    test/unit/time_entry_activity_test.rb
U    test/unit/repository_bazaar_test.rb
.
.
.
Updated to revision 11578.
 
www-data@trackersvn:/var/lib/redmine$ svn info
Path: .
URL: http://svn.redmine.org/redmine/branches/2.2-stable
Repository Root: http://svn.redmine.org/redmine
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 11578
Node Kind: directory
Schedule: normal
Last Changed Author: tmaruyama
Last Changed Rev: 11557
Last Changed Date: 2013-03-07 22:02:47 -0300 (Thu, 07 Mar 2013)
www-data@trackersvn:/var/lib/redmine$ svn switch http://svn.redmine.org/redmine/branches/2.2-stable
U    test/unit/issue_relation_test.rb
U    test/unit/version_test.rb
U    test/unit/issue_test.rb
U    test/unit/time_entry_activity_test.rb
U    test/unit/repository_bazaar_test.rb
.
.
.
Updated to revision 11578.

www-data@trackersvn:/var/lib/redmine$ svn info
Path: .
URL: http://svn.redmine.org/redmine/branches/2.2-stable
Repository Root: http://svn.redmine.org/redmine
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 11578
Node Kind: directory
Schedule: normal
Last Changed Author: tmaruyama
Last Changed Rev: 11557
Last Changed Date: 2013-03-07 22:02:47 -0300 (Thu, 07 Mar 2013)

Como podemos verificar arriba con svn info la URL del repositorio se ha actualizado y tambien todos los archivos en nuestro path de instalación.

Al realizar al switch de repositorio no es necesario guardar los archivos de configuración de la instalación: Gemfile, config/database.yml, config/configuration.yml ya que no se modifican.

El siguiente paso (como root) es actualizar todas las dependencias directamente con bundle.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@trackersvn:/var/lib/redmine# bundle update
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3)
Installing i18n (0.6.4)
Installing multi_json (1.6.1)
Installing activesupport (3.2.12)
.
.
.
.
Installing rails (3.2.12)
Installing rmagick (2.13.2) with native extensions
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
root@trackersvn:/var/lib/redmine# bundle update
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3)
Installing i18n (0.6.4)
Installing multi_json (1.6.1)
Installing activesupport (3.2.12)
.
.
.
.
Installing rails (3.2.12)
Installing rmagick (2.13.2) with native extensions
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.

Y luego solamente queda ejecutar los siguientes comandos para generar el token y actualizar la DB.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@trackersvn:/var/lib/redmine# rake generate_secret_token
root@trackersvn:/var/lib/redmine# rake db:migrate RAILS_ENV=production
==  AddJournalsPrivateNotes: migrating ========================================
-- add_column(:journals, :private_notes, :boolean, {:null=>false, :default=>false})
   -> 0.4683s
==  AddJournalsPrivateNotes: migrated (0.4685s) ===============================
 
==  AddEnumerationsPositionName: migrating ====================================
-- add_column(:enumerations, :position_name, :string, {:limit=>30})
   -> 0.0075s
==  AddEnumerationsPositionName: migrated (0.0076s) ===========================
 
==  PopulateEnumerationsPositionName: migrating ===============================
==  PopulateEnumerationsPositionName: migrated (0.0229s) ======================
root@trackersvn:/var/lib/redmine# rake generate_secret_token
root@trackersvn:/var/lib/redmine# rake db:migrate RAILS_ENV=production
==  AddJournalsPrivateNotes: migrating ========================================
-- add_column(:journals, :private_notes, :boolean, {:null=>false, :default=>false})
   -> 0.4683s
==  AddJournalsPrivateNotes: migrated (0.4685s) ===============================

==  AddEnumerationsPositionName: migrating ====================================
-- add_column(:enumerations, :position_name, :string, {:limit=>30})
   -> 0.0075s
==  AddEnumerationsPositionName: migrated (0.0076s) ===========================

==  PopulateEnumerationsPositionName: migrating ===============================
==  PopulateEnumerationsPositionName: migrated (0.0229s) ======================

Actualizamos en la DB el listado de plugins

1
2
root@trackersvn:/var/lib/redmine# rake redmine:plugins:migrate RAILS_ENV=production
Migrating redmine_work_time (Redmine Work Time plugin)...
root@trackersvn:/var/lib/redmine# rake redmine:plugins:migrate RAILS_ENV=production
Migrating redmine_work_time (Redmine Work Time plugin)...

Limpiamos la cache y sesiones activas.

1
2
root@trackersvn:/var/lib/redmine# rake tmp:cache:clear
root@trackersvn:/var/lib/redmine# rake tmp:sessions:clear
root@trackersvn:/var/lib/redmine# rake tmp:cache:clear
root@trackersvn:/var/lib/redmine# rake tmp:sessions:clear

Reiniciamos Apache2 y verificamos que todo esté bien desde el propio Redmine (Administration -> Information)
redmine_2.2.3

Instalar Redmine en Debian Squeeze guía definitiva

Uno de los problemas cruciales que tiene instalar Redmine es lo jodidamente difícil de encontrar una buena guía que explique todos los pormenores, la culpa de todo esto no es de Redmine propiamente dicho sino de las dependencias y librerias necesarias no solamente para instalarlo sino también para mantenerlo actualizado con cada nueva versión disponible.
Y es muy común debido a que las librerias/dependencias/gems que se instalan generalmente se hacen desde el sistema de paquetes de cada distribución en vez de hacerlo desde el propio sistema interno que rubygems incorpora

Con las sucesivas instalaciones que he necesitado hacer he ido poco a poco afinando el proceso de instalación/upgrade de Redmine y el objetivo de este post es servir de ayuda memoria para mí y de guía general a cualquier sysadmin interesado en Redmine.

En el Wiki oficial de Redmine: Installing Redmine tienen lo básico y necesario para instalar Redmine.

Vemos en la siguiente tabla que para la versión 2.1.6 (la que estamos instalando en este tutorial) necesitamos ruby 1.8.7, rails 3.2.11 (se instala mas adelante), y rubygems 1.8.

redmineinstall_table

Primero a lo primero instalar subversion, apache2, passenger, ruby & rubygems 1.8 (NO INSTALAR el paquete rake)

1
:~# aptitude install subversion apache2 libapache2-mod-passenger libapache2-mod-fcgid ruby rubygems libmysqlclient15-dev libmagick9-dev
:~# aptitude install subversion apache2 libapache2-mod-passenger libapache2-mod-fcgid ruby rubygems libmysqlclient15-dev libmagick9-dev

Cuando se instala Redmine, se utilizan varias aplicaciones que vienen con ruby, rubygems y que también se pueden instalar como paquetes aparte, tal es el caso de gem y rake que NO debemos instalar ya que usaremos el propio binario que se instaló con rubygems.
Para evitar tener que hacer links simbólicos manualmente a /usr/bin Debian incorpora una excelente utilidad en el paquete dpkg que se llama update-alternatives que se utiliza para establecer el valor por defecto de un ejecutable que proporcionan o pueden proporcionar diferentes aplicaciones.

En nuestro caso lo utilizaremos para los binarios gem, con el cual instalaremos rake.

1
2
3
4
5
6
7
8
9
10
11
:~# update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 180
update-alternatives: using /usr/bin/gem1.8 to provide /usr/bin/gem (gem) in auto mode.
 
:~# gem install rake
Successfully installed rake-10.0.3
1 gem installed
Installing ri documentation for rake-10.0.3...
Installing RDoc documentation for rake-10.0.3...
 
:~# update-alternatives --install /usr/bin/rake rake /var/lib/gems/1.8/bin/rake 180
update-alternatives: using /var/lib/gems/1.8/bin/rake to provide /usr/bin/rake (rake) in auto mode.
:~# update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 180
update-alternatives: using /usr/bin/gem1.8 to provide /usr/bin/gem (gem) in auto mode.

:~# gem install rake
Successfully installed rake-10.0.3
1 gem installed
Installing ri documentation for rake-10.0.3...
Installing RDoc documentation for rake-10.0.3...

:~# update-alternatives --install /usr/bin/rake rake /var/lib/gems/1.8/bin/rake 180
update-alternatives: using /var/lib/gems/1.8/bin/rake to provide /usr/bin/rake (rake) in auto mode.

Bajamos la versión 2.1.6 de Redmine (lo pueden instalar donde quieran, yo lo estoy haciendo en /var/lib/redmine)

1
2
:~# cd /var/lib
:/var/lib# svn co http://svn.redmine.org/redmine/branches/2.1-stable redmine/
:~# cd /var/lib
:/var/lib# svn co http://svn.redmine.org/redmine/branches/2.1-stable redmine/

Ahora que tenemos Redmine descargado haremos un repaso por los archivos que necesitaremos modificar

  • Gemfile
  • config/database.yml
  • config/configuration.yml

config/Gemfile

Está en el raiz de redmine, en nuestro ejemplo en /var/lib/redmine/Gemfile, se definen aqui qué gems o dependencias se necesitan para poder instalar Redmine y aconsejo editarlo y eliminar las gems que no vamos a utilizar.

Por ejemplo, si no necesitamos soporte para OpenID perfectamente podemos eliminar el bloque correspondiente:

1
2
3
4
5
# Optional gem for OpenID authentication
group :openid do
  gem "ruby-openid", "~> 2.1.4", :require => "openid"
  gem "rack-openid"
end
# Optional gem for OpenID authentication
group :openid do
  gem "ruby-openid", "~> 2.1.4", :require => "openid"
  gem "rack-openid"
end

Lo mismo si no necesitamos soporte PostgreSQL ni SQLite

1
2
3
4
5
6
7
8
9
10
# Database gems
platforms :mri, :mingw do
  group :postgresql do
    gem "pg", ">= 0.11.0"
  end
 
  group :sqlite do
    gem "sqlite3"
  end
end
# Database gems
platforms :mri, :mingw do
  group :postgresql do
    gem "pg", ">= 0.11.0"
  end

  group :sqlite do
    gem "sqlite3"
  end
end

Un detalle importante respecto a MySQL, en Gemfile se especifican 2 gems distintas :mysql y :mysql2 y esto está directamente relacionado con la versión de ruby que instalamos al principio del tutorial, mysql2 por ejemplo lo mantendremos si instalamos ruby-1.9 que no es nuestro caso por ende eliminaremos de Gemfile toda referencia a mysql2 y dejaremos sólo mysql quedando asi:

1
2
3
4
5
platforms :mri_18, :mingw_18 do
  group :mysql do
    gem "mysql", "~> 2.8.1"
  end
end
platforms :mri_18, :mingw_18 do
  group :mysql do
    gem "mysql", "~> 2.8.1"
  end
end

He puesto en http://blog.ngen.com.ar/public/Gemfile.tgz una copia del archivo Gemfile que estoy utilizando en la instalación de este tutorial.

config/database.yml

Donde definiremos el usuario y password de la base de datos MySQL.

1
2
3
4
5
6
7
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: redminepass
  encoding: utf8
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: redminepass
  encoding: utf8

Obviaré el paso de creación de la base de datos, información que puede consultarse en el siguiente link: http://www.redmine.org/projects/redmine/wiki/RedmineInstall#MySQL

config/configuration.yml

Aqui se definen valores de configuración tales como SMTP (para enviar los mails de notificaciones), path para los attachments, cookies, soporte para SCM (subversion, git, etc) y otros valores mas. En la instalación que estoy haciendo para este tutorial los valores han quedado asi:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: localhost       
      port: 25
      domain: tracker.aper.net
 
  # Absolute path to the directory where attachments are stored.
  # The default is the 'files' directory in your Redmine instance.
  # Your Redmine instance needs to have write permission on this
  # directory.
  # Examples:
  # attachments_storage_path: /var/redmine/files
  # attachments_storage_path: D:/redmine/files
  attachments_storage_path: /var/lib/redmine/files
 
  # Configuration of the autologin cookie.
  # autologin_cookie_name: the name of the cookie (default: autologin)
  # autologin_cookie_path: the cookie path (default: /)
  # autologin_cookie_secure: true sets the cookie secure flag (default: false)
  autologin_cookie_name:
  autologin_cookie_path:
  autologin_cookie_secure: true
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: localhost       
      port: 25
      domain: tracker.aper.net

  # Absolute path to the directory where attachments are stored.
  # The default is the 'files' directory in your Redmine instance.
  # Your Redmine instance needs to have write permission on this
  # directory.
  # Examples:
  # attachments_storage_path: /var/redmine/files
  # attachments_storage_path: D:/redmine/files
  attachments_storage_path: /var/lib/redmine/files

  # Configuration of the autologin cookie.
  # autologin_cookie_name: the name of the cookie (default: autologin)
  # autologin_cookie_path: the cookie path (default: /)
  # autologin_cookie_secure: true sets the cookie secure flag (default: false)
  autologin_cookie_name:
  autologin_cookie_path:
  autologin_cookie_secure: true

Si no quisieramos soporte para mercurial por ejemplo podemos eliminar las lineas correspondientes y dejar sólo lo que necesitemos, para el que no lo sabe dentro de cada proyecto individual de Redmine se puede asociar una url/uri de SCM de manera que podamos ver integrado dentro del proyecto un repositorio SVN (por ejemplo) de forma muy parecida a como se ve con websvn.
En mi caso la configuración SCM quedó así (sólo con soporte para subversion & git):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  # Configuration of SCM executable command.
  #
  # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
  # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.
  #
  # On Windows + JRuby 1.6.2, path which contains spaces does not work.
  # For example, "C:\Program Files\TortoiseHg\hg.exe".
  # If you want to this feature, you need to install to the path which does not contains spaces.
  # For example, "C:\TortoiseHg\hg.exe".
  #
  # Examples:
  # scm_subversion_command: svn                                       # (default: svn)
  # scm_mercurial_command:  C:\Program Files\TortoiseHg\hg.exe        # (default: hg)
  # scm_git_command:        /usr/local/bin/git                        # (default: git)
  # scm_cvs_command:        cvs                                       # (default: cvs)
  # scm_bazaar_command:     bzr.exe                                   # (default: bzr)
  # scm_darcs_command:      darcs-1.0.9-i386-linux                    # (default: darcs)
  #
  scm_subversion_command:
  scm_git_command:
  # Configuration of SCM executable command.
  #
  # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
  # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.
  #
  # On Windows + JRuby 1.6.2, path which contains spaces does not work.
  # For example, "C:\Program Files\TortoiseHg\hg.exe".
  # If you want to this feature, you need to install to the path which does not contains spaces.
  # For example, "C:\TortoiseHg\hg.exe".
  #
  # Examples:
  # scm_subversion_command: svn                                       # (default: svn)
  # scm_mercurial_command:  C:\Program Files\TortoiseHg\hg.exe        # (default: hg)
  # scm_git_command:        /usr/local/bin/git                        # (default: git)
  # scm_cvs_command:        cvs                                       # (default: cvs)
  # scm_bazaar_command:     bzr.exe                                   # (default: bzr)
  # scm_darcs_command:      darcs-1.0.9-i386-linux                    # (default: darcs)
  #
  scm_subversion_command:
  scm_git_command:

Redmine Setup

LLegó la hora hacer el setup de Redmine, una de las utilidades o gems necesarias para resolver las dependencias es bundle, lo instalaremos y tambien agregaremos el path al sistema con update-alternatives.

1
2
3
:~# gem install bundler
:~# update-alternatives --install /usr/bin/bundle bundle /var/lib/gems/1.8/bin/bundle 180
update-alternatives: using /var/lib/gems/1.8/bin/bundle to provide /usr/bin/bundle (bundle) in auto mode.
:~# gem install bundler
:~# update-alternatives --install /usr/bin/bundle bundle /var/lib/gems/1.8/bin/bundle 180
update-alternatives: using /var/lib/gems/1.8/bin/bundle to provide /usr/bin/bundle (bundle) in auto mode.

Debemos movernos al directorio donde descargamos Redmine y ejecutar bundle.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
:~# cd /var/lib/redmine
:/var/lib/redmine# bundle install --without development test
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3) 
Installing i18n (0.6.1) 
Installing multi_json (1.5.0) 
Installing activesupport (3.2.11) 
Installing builder (3.0.0) 
Installing activemodel (3.2.11) 
Installing erubis (2.7.0) 
Installing journey (1.0.4) 
Installing rack (1.4.4) 
Installing rack-cache (1.2) 
Installing rack-test (0.6.2) 
Installing hike (1.2.1) 
Installing tilt (1.3.3) 
Installing sprockets (2.2.2) 
Installing actionpack (3.2.11) 
Installing mime-types (1.19) 
Installing polyglot (0.3.3) 
Installing treetop (1.4.12) 
Installing mail (2.4.4) 
Installing actionmailer (3.2.11) 
Installing arel (3.0.2) 
Installing tzinfo (0.3.35) 
Installing activerecord (3.2.11) 
Installing activeresource (3.2.11) 
Using bundler (1.2.3) 
Installing coderay (1.0.8) 
Installing fastercsv (1.5.5) 
Installing rack-ssl (1.3.3) 
Installing json (1.7.6) with native extensions 
Installing rdoc (3.12) 
Installing thor (0.17.0) 
Installing railties (3.2.11) 
Installing jquery-rails (2.0.3) 
Installing mysql (2.8.1) with native extensions 
Installing net-ldap (0.3.1) 
Installing rails (3.2.11) 
Installing rmagick (2.13.1) with native extensions 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
 
<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
:~# cd /var/lib/redmine
:/var/lib/redmine# bundle install --without development test
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3) 
Installing i18n (0.6.1) 
Installing multi_json (1.5.0) 
Installing activesupport (3.2.11) 
Installing builder (3.0.0) 
Installing activemodel (3.2.11) 
Installing erubis (2.7.0) 
Installing journey (1.0.4) 
Installing rack (1.4.4) 
Installing rack-cache (1.2) 
Installing rack-test (0.6.2) 
Installing hike (1.2.1) 
Installing tilt (1.3.3) 
Installing sprockets (2.2.2) 
Installing actionpack (3.2.11) 
Installing mime-types (1.19) 
Installing polyglot (0.3.3) 
Installing treetop (1.4.12) 
Installing mail (2.4.4) 
Installing actionmailer (3.2.11) 
Installing arel (3.0.2) 
Installing tzinfo (0.3.35) 
Installing activerecord (3.2.11) 
Installing activeresource (3.2.11) 
Using bundler (1.2.3) 
Installing coderay (1.0.8) 
Installing fastercsv (1.5.5) 
Installing rack-ssl (1.3.3) 
Installing json (1.7.6) with native extensions 
Installing rdoc (3.12) 
Installing thor (0.17.0) 
Installing railties (3.2.11) 
Installing jquery-rails (2.0.3) 
Installing mysql (2.8.1) with native extensions 
Installing net-ldap (0.3.1) 
Installing rails (3.2.11) 
Installing rmagick (2.13.1) with native extensions 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

Como podemos ver todo está ok, algo importante respecto a la utilidad bundle es que si mantienen todo el contenido original del archivo Gemfile bundle instalará las gems o dependencias que pueda, pero en algunos casos no será posible porque se necesitan los paquetes *-dev de por ejemplo PostgreSQL, SQLite o MySQL (instaladas al inicio del tutorial).

Los pasos finales son generar un token (se hace cada vez que se instala y se hace upgrade de versión), ejecutar el script de verificación de la base de datos y/o plugins si los hubiera, limpiar las sesiones y caché.

1
2
3
4
5
:/var/lib/redmine# rake generate_secret_token
:/var/lib/redmine# rake db:migrate RAILS_ENV=production
:/var/lib/redmine# rake redmine:plugins:migrate RAILS_ENV=production
:/var/lib/redmine# rake tmp:cache:clear
:/var/lib/redmine# rake tmp:sessions:clear
:/var/lib/redmine# rake generate_secret_token
:/var/lib/redmine# rake db:migrate RAILS_ENV=production
:/var/lib/redmine# rake redmine:plugins:migrate RAILS_ENV=production
:/var/lib/redmine# rake tmp:cache:clear
:/var/lib/redmine# rake tmp:sessions:clear

Como último paso queda configurar Apache, reiniciarlo y listo!
Este es mi VirtualHost de ejemplo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<VirtualHost *:80>
    ServerAdmin cmiranda@aper.net
    ServerName  tracker.aper.net
    ServerAlias 172.16.10.204
 
    Redirect permanent / https://tracker.aper.net
 
</VirtualHost>
 
 
 
<VirtualHost *:443>
    ServerAdmin cmiranda@aper.net
    ServerName  tracker.aper.net
    ServerAlias 172.16.10.204
 
    DefaultInitEnv RAILS_ENV production
    DefaultInitEnv GEM_PATH /var/lib/gems/1.8
 
    DocumentRoot /var/lib/redmine/public
    <Directory /var/lib/redmine/public>
        Options +FollowSymLinks +ExecCGI
        RewriteEngine On
        RewriteRule ^$ index.html [QSA]
        RewriteRule ^([^.]+)$ $1.html [QSA]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
        ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
        AllowOverride None
        #AllowOverride all
        Order allow,deny
        allow from all
    </Directory>
    
    LogLevel warn
 
    CustomLog /var/log/apache2/tracker.access.log combined
    ErrorLog /var/log/apache2/tracker.error.log
 
    ServerSignature Off
 
    SSLEngine on
 
    SSLCertificateFile    /etc/apache2/ssl/tracker.aper.net.crt
    SSLCertificateKeyFile /etc/apache2/ssl/tracker.aper.net.key
 
    SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
 
</VirtualHost>
<VirtualHost *:80>
	ServerAdmin cmiranda@aper.net
	ServerName  tracker.aper.net
	ServerAlias 172.16.10.204

	Redirect permanent / https://tracker.aper.net

</VirtualHost>



<VirtualHost *:443>
	ServerAdmin cmiranda@aper.net
	ServerName  tracker.aper.net
	ServerAlias 172.16.10.204

	DefaultInitEnv RAILS_ENV production
	DefaultInitEnv GEM_PATH /var/lib/gems/1.8

	DocumentRoot /var/lib/redmine/public
	<Directory /var/lib/redmine/public>
		Options +FollowSymLinks +ExecCGI
		RewriteEngine On
		RewriteRule ^$ index.html [QSA]
		RewriteRule ^([^.]+)$ $1.html [QSA]
		RewriteCond %{REQUEST_FILENAME} !-f
		RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
		ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
		AllowOverride None
		#AllowOverride all
		Order allow,deny
		allow from all
	</Directory>
	
	LogLevel warn

	CustomLog /var/log/apache2/tracker.access.log combined
	ErrorLog /var/log/apache2/tracker.error.log

	ServerSignature Off

	SSLEngine on

	SSLCertificateFile    /etc/apache2/ssl/tracker.aper.net.crt
	SSLCertificateKeyFile /etc/apache2/ssl/tracker.aper.net.key

	SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem

</VirtualHost>

Verificamos que todo esté ok dando por terminada la instalación de Redmine 2.1.6 en Debian, en un próximo post mostraré cómo hacer un upgrade a las versiones mas nuevas.

redmine_2.1.16

Western Digital Green Hard disks sucks!

Recientemente compré 7 discos Western Digital SATA 3 del modelo Green para utilizarlos en un storage con OpenIndiana, sin motivo aparente el raidz1 se corrompía (muy raro me dije).
Hice un cambio de motherboard por una Gigabyte GA-890GPA-UD3H pensando que la anterior motherboard (con unos cuantos años encima) podía ser el problema, no hubo caso las fallas en pool ZFS continuaban.

Para asegurarme decido instalarle Debian Squeeze en un raid5 dándome un total de 8.8tb pero la sincronización del raid con mdadm tomó 2 dias en completarse (hay gato encerrado me dije).

  • Hago algunas pruebas con smartcl a cada uno de los discos con idéntico resultado en todos: PASSED
  • Cambio todos y cada uno de los cables SATA con los que se conectan a la motherboard, pero el resultado era el mismo.

 

 

Sólo me quedaba hacer una batería de pruebas de lectura/escritura a cada uno de los discos para cerciorarme si el problema eran los discos u otra cosa.

Con unos simples tests de lectura/escritura con hdparm y dd obtuve lo siguiente:

1
2
3
4
5
root@bkpserver:~# hdparm -tT /dev/md0
 
/dev/md0:
 Timing cached reads:   4728 MB in  2.00 seconds = 2364.79 MB/sec
 Timing buffered disk reads: 934 MB in  3.00 seconds = 311.29 MB/sec
root@bkpserver:~# hdparm -tT /dev/md0

/dev/md0:
 Timing cached reads:   4728 MB in  2.00 seconds = 2364.79 MB/sec
 Timing buffered disk reads: 934 MB in  3.00 seconds = 311.29 MB/sec

Nada mal para un raid5 con 7 discos, pero hagamos una de escritura con dd

1
2
3
4
root@bkpserver:~# dd if=/dev/zero of=/output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 145.657 s, 14.7 MB/s
root@bkpserver:~# dd if=/dev/zero of=/output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 145.657 s, 14.7 MB/s

WTF! 14.7MB/s….?
Decido hacer la misma prueba de escritura en otros servers que tengo

6x1TB WD Black Edition en raid10

1
2
3
4
cmiranda@zama:~$ dd if=/dev/zero of=output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 5.11164 s, 420 MB/s
cmiranda@zama:~$ dd if=/dev/zero of=output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 5.11164 s, 420 MB/s

Wow! 420 MB/s en raid10, ESO es perfomance de escritura, pero hagamos la misma prueba con un sólo disco 1TB WD Black Edition (en desktop de casa)

1
2
3
4
cmiranda@lheeze:~$ dd if=/dev/zero of=output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 18.6397 s, 115 MB/s
cmiranda@lheeze:~$ dd if=/dev/zero of=output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 18.6397 s, 115 MB/s

115 MB/s, nada mal… Pero cómo es la perfomance en un disco de 80gb de hacen 7 años….?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@cerberus:~# hdparm -I /dev/sda
 
/dev/sda:
 
ATA device, with non-removable media
    Model Number:       HITACHI HDS7280SASUN80G  0713MM7PDK     
    Serial Number:      PFDB30EMRM7PDK      
    Firmware Revision:  PF2OA6EA
*
*
*
cmiranda@cerberus:~$ dd if=/dev/zero of=output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 40.8032 s, 52.6 MB/s
root@cerberus:~# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       HITACHI HDS7280SASUN80G  0713MM7PDK     
	Serial Number:      PFDB30EMRM7PDK      
	Firmware Revision:  PF2OA6EA
*
*
*
cmiranda@cerberus:~$ dd if=/dev/zero of=output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 40.8032 s, 52.6 MB/s

52.6 MB/s, nada mal para un disco tan viejo, definitivamente esos WD Green no estan funcionando correctamente, a reclamar la garantía!