Вы находитесь на странице: 1из 27

******* PARAMETROS GRUB *********************

GRUB_CMDLINE_LINUX_DEFAULT=" intel_idle.max_cstate=0 processor.max_cstate=0 inte


l_pstate=enable quiet splash rootflags=data=writeback threadirqs numa=on zswap.e
nabled=1 idle=halt acpi_backlight=vendor"

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nohz=off lapic=notscdeadline video=SVID


EO-1:d modprobe.blacklist=toshiba_bluetooth options i915 video=i915:modeset=1 co
mmit=600 i915.i915_enable_rc6=0 edp_vswing=2 i915.lvds_downclock=1 i915.i915_ena
ble_fbc=1 pcie_aspm=force i915.semaphores=1 intel_idle.max_cstate=0 rootflags=da
ta=writeback threadirqs numa=on zswap.enabled=1 acpi_osi="Windows\2006" rootflag
s=noatime tsc=reliable lapic=notscdeadline notsc nolapic_timer clock=hpet hpet=f
orce etc_on processor.max_cstate=0 clocksource=tsc idle=halt usbcore.autosuspend
=-1"
**********************************************

IO-Scheduler MODIFICACIN
Se comprueba la velocidad del disco con:
hdparm -Tt /dev/sdX
Para comprobrar el scheduler por defecto:
cat /sys/block/sdX/queue/scheduler # X es la letra de nuestra SSD
noop deadline [cfq] # aparece entre corchetes
Esto comprueba y saca por pantalla scheduler todos los discos:
for f in /sys/block/sd?/queue/scheduler; do printf "$f is "; cat $f; done
Para cambiar scheduler de forma manual:
sudo echo noop > /sys/block/sdX/queue/scheduler # X letra de la SSD
o aadiendo al archivo /etc/sysfs.conf
block/sdX/queue/scheduler = deadline
Si el sistema est compuesto de diferentes tipos de discos duros, SSD y HDD
podra ser interesante ajustar un scheduler diferente a cada uno de ellos con una
regla UDEV:
Creamos:
/etc/udev/rules.d/60-ssd-scheduler.rules
Dentro de este archivo introducimos lo siguiente:
set deadline scheduler for non-rotating disks
# seleccion de deadline como scheduler para los HDD, (discos rotativos)
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue
/scheduler}="deadline"

***** SWAP ******-


Editamos el archivo /etc/sysctl.conf
vm.swappiness=1 # tendencia a usar la swap. 60 (de 100) por defecto
vm.vfs_cache_pressure=50 # tendencia del kernel a reclamar la memora usada para
cachear el sistema de archivos en lugar de otras cachs. Bajamos de 100 a 50, para
que no se reclame con tanta urgencia.
vm.dirty_writeback_centisecs=1500 # frecuencia con la que se escriben en el dis
co los datos guardados temporalmente en la cach. 500 por defecto, incrementamos p
ara limitar las escrituras
******************************************
************ TRIM AL ARRANQUE ************
editar el archivo /etc/rc.local
date > /home/javier/.trim/registroTrim.txt
echo "**********************************" >>/home/javier/.trim/registroTrim.txt
echo "Registro de actividad trim en disco SSD al arranque" >> /home/javier/.trim
/registroTrim.txt
echo "" >> /home/javier/.trim/registroTrim.txt
fstrim -v /boot >> /home/javier/.trim/registroTrim.txt
fstrim -v / >> /home/javier/.trim/registroTrim.txt
echo "**********************************" >>/home/javier/.trim/registroTrim.txt
echo "habilitar hdparm" >> /home/javier/.trim/registroTrim.txt
/sbin/hdparm -B 254 /dev/sda >> /home/javier/.trim/registroTrim.txt
/sbin/hdparm -B 254 /dev/sdc >> /home/javier/.trim/registroTrim.txt
echo "**********************************" >>/home/javier/.trim/registroTrim.txt
#DESHABILITAR TRANSPARENT HUGEPAGE ####################
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
exit 0

********* TRIM SEMANAL ***************************


/etc/cron.weekly/fstrim
#!/bin/sh
# trim all mounted file systems which support it
echo "Registro trim semanal" > /home/javier/.trim/registroTrim.txt
echo "*********************************" >> /home/javier/.trim/registroTrim.txt
date >> /home/javier/.trim/registroTrim.txt
/sbin/fstrim --all -v >> /home/javier/.trim/registroTrim.txt || true
echo "*********************************" >> /home/javier/.trim/registroTrim.txt
echo "" >> /home/javier/.trim/registroTrim.txt

********** ****** EJEMPLO /fstab *******************


GNU nano 2.2.6 Archivo: /e
tc/fstab

# /etc/fstab: static file system information.


#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb2 during installation
UUID=e11b4f8b-5f4d-4438-afeb-ae1892ec0bf4 / ext4 noatime,nodira
time,discard,errors=remount-ro 0 1
# /boot was on /dev/sdb1 during installation
UUID=3e581b0a-2c12-4090-8674-1deda39a1db6 /boot ext4 noatime,nodira
time,discard,errors=remount-ro 0 2
# /home was on /dev/sda3 during installation
UUID=1be86fb9-ab24-4351-a1ee-08ff95e3de61 /home xfs defaults
0 2
# /var was on /dev/sda1 during installation
UUID=d4a79e1e-39c2-4b7e-8ee7-d1cc0091cd88 /var xfs defaults
0 2
# swap was on /dev/sda2 during installation
UUID=d1745346-cae9-429f-bf29-15bba59db6ab none swap sw
0 0
#MONTO DISCO DURO EXTERNO AL ARRANQUE
#UUID="2E2E-A2A9" /home/javier/Toshiba_external_HDD vfat rw,auto,user,asyn
c,suid,dev,exec,umask=0000 0 2
tmpfs /tmp tmpfs noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs noatime,mode=1777 0 0
tmpfs /home/javier/.cache/google-chrome tmpfs noatime,nosuid,nodev,mode=1777
0 0
tmpfs /var/spool tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
#tmpfs /var/log/apt tmpfs defaults,noatime 0 0
tmpfs /var/cache/apt/archives tmpfs defaults,noexec,nosuid,nodev,mode=0755
0 0
#tmpfs /home/javier/.config/google-chrome tmpfs noatime,mode=1777 0 0
#FTP
#curlftpfs#jmarp1:jmarp1@77.27.131.129 /home/javier/FTP_ruben21.d fuse auto,user
,noatime,uid=1000,allow_other,_netdev 0 0
*******************************************************************
*** CONEXION RED *******************
Configure the following /etc/sysctl.conf settings for faster TCP
GNU nano 2.2.6 Archivo: /etc/sysctl.conf

#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
##############################################################3
# Functions previously found in netbase
#
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1

###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)

********* REPOSITORIO **************


sudo add-apt-repository ppa:graysky/utils # profile-sync-daemon
systemctl --user enable psd
*********************************
systemctl status hdparm.service

************* MONTAR DISCO DURO EXTERNO DESDE fstb ***********************


***** OBTENER UUID DE LOS DISCOS **********
Varias formas
ls -l /dev/disk/by-uuid
o tambin:
blkid /dev/sdX
*************************
montar disco:
#MONTO DISCO DURO EXTERNO AL ARRANQUE
UUID="2E2E-A2A9" /home/javier/Toshiba_external_HDD vfat rw,auto,user,async
,suid,dev,exec,umask=0000 0 2
**************

******* CPU frequency scaling ******************


PAGINA: http://wiki.linuxaudio.org/wiki/system_configuration
CPU frequency scaling
If your CPU supports frequency scaling and the CPU frequency scaling governor is
set to ondemand (which is the default on a lot of distros) you could run into x
runs. The ondemand governor scales the frequency according to the CPU load, the
more the load, the higher the frequency. But this is happening independently fro
m the DSP load on your system so it could happen that the DSP load suddenly rise
s for instance, demanding more CPU power, and that the scaling daemon kicks in t
oo late, resulting in xruns because the DSP load maxes out. A solution would be
to use a CPU frequency scaling daemon that scales the frequency according to the
DSP load on your system like jackfreqd or to simply disable CPU frequency scali
ng altogether. The latter can be achieved by setting the scaling governor to per
formance.
To check which governor is active:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Setting the governor to performance:
echo -n performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_gove
rnor
You could also add a line to your /etc/rc.local file for instance to set the gov
ernor to performance at boot time:
echo -n performance > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Ubuntu
On Ubuntu systems the command in your /etc/rc.local file only works if you disab
le the ondemand service:
sudo update-rc.d ondemand disable
Another option would be to modify the ondemand init script and rename it to perf
ormance:
sudo sed -i 's/ondemand/performance/g' /etc/init.d/ondemand
sudo update-rc.d ondemand disable
sudo cp /etc/init.d/ondemand /etc/init.d/performance
sudo update-rc.d performance defaults
Debian
On Debian you can control the scaling governor with the cpufreq-set utility whic
h is part of the cpufrequtils package:
sudo cpufreq-set -r -g performance
On installation the package also installs an init script in /etc/init.d/cpufrequ
tils and a configuration file in /etc/default/cpufrequtils. To have the governor
always set to performance make sure the configuration file looks as follows:
ENABLE="true"
GOVERNOR="performance"
MAX_SPEED="0"
MIN_SPEED="0"
**INFORMACION SOBRE PROCESADOR ****
cat /sys/devices/system/cpu/cpu*/cpufreq/*cur_freq or /proc/cpuinfo

****** DESPUES DE INSTALAR RESTRICTED-AREAS UBUNTU ************


hai que actualizar cache:
sudo fc-cache

************** DE VEZ EN CUANDO ***************


sudo rm /var/lib/ureadahead/pack
***********************************************
************* LANZADOR APLICACIONES UNITY *****************
sudo nano /usr/share/applications/eclipse.desktop

[Desktop Entry]
Name=Eclipse
Comment=Eclipse
Exec=/home/lince/eclipse/eclipse
Icon=/home/lince/eclipse/icon.xpm
Terminal=false
Type=Application

*********************************************************

**************** FUENTES INFINITY ***********************


First let add the infinality font repository from launchpad.
sudo nano /etc/apt/sources.list
#Infinality Fonts
deb http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
deb-src http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main

First we have to add keys to access the repository. To do that, we have to run,
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E985B27B

Now lets update & install infinality font.


sudo apt-get update
sudo apt-get install fontconfig-infinality

To configure infinality font, follow these steps


cd /etc/fonts/infinality/
sudo bash infctl.sh setstyle
Select a style:
1) debug 3) linux 5) osx2 7) win98
2) infinality 4) osx 6) win7 8) winxp
#?
I chose 3 (i.e. linux).

Now lets change the font style.


sudo vi /etc/profile.d/infinality-settings.sh
#################################################################
########################### EXAMPLES ############################
#################################################################
#
# Set the USE_STYLE variable below to try each example.
# Make sure to set your style in /etc/fonts/infinality.conf too.
#
# Possible options:
#
# DEFAULT Use above settings. A compromise that should please most people.
# OSX Simulate OSX rendering
# IPAD Simulate iPad rendering
# UBUNTU Simulate Ubuntu rendering
# LINUX Generic Linux style no snapping or certain other tweaks
# WINDOWS Simulate Windows rendering
# WINDOWS7 Simulate Windows rendering with normal glyphs
# WINDOWS7LIGHT- Simulate Windows 7 rendering with lighter glyphs
# WINDOWS Simulate Windows rendering
# VANILLA Just subpixel hinting
# CUSTOM Your own choice. See below
# Infinality styles
# CLASSIC Infinality rendering circa 2010. No snapping.
# NUDGE CLASSIC with lightly stem snapping and tweaks
# PUSH CLASSIC with medium stem snapping and tweaks
# SHOVE Full stem snapping and tweaks without sharpening
# SHARPENED Full stem snapping, tweaks, and Windows-style sharpening
# INFINALITY Settings I use
# DISABLED Act as though running without the extra infinality enhancements (just
subpixel hinting).
USE_STYLE=UBUNTU
Now search for USE_STYLE or scroll (around line 710) till you see the option to se
t the style.
Now change the value of USE_STYLE as per your preference & save the file. Im usin
g UBUNTU style in this example.

LCD Filter Setting


We need to set the LCD filter setting in our home directory using a file called .
Xresources.
Method 1
Create a new file and name it as .Xresources.
Open the file (If you cant see the file, then you need to change setting to show
hidden files), add the following line, save & close the file
Xft.lcdfilter: lcddefault
Method 2
Run the following command
echo "Xft.lcdfilter: lcddefault" >> ~/.Xresources
Note: In my LCD display, font rendering look best with hinting set to slight. Yo
u may change this value medium or full as per your preference.

Xfce
Go to Settings -> Appearance.
Tick the checkbox to Enable anti-aliasing
Set Sub-pixel order to RGB
Set Hinting to Slight
Xfce4 Font Setting

Gnome
Gnome does not have options to configure font rendering methods. So you need to
install gnome-tweak-tool which can be done by running the following command.
sudo apt-get install gnome-tweak-tool
Then change the settings
Open Gnome tweak tool and to fonts setting.
Set Antialiasing to RGB
Set Hinting to Slight

Logout & login back to see the new font rendering.

Check Font Rendering Settings


You can check the current font rendering settings by running the following comma
nd,
xrdb -query
On running the above command, you should see the following settings.
Xft.dpi: 96
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
***************************************************************
****************** PRELINK ***********************************
En la mayora de distribuciones Linux prelink viene en los repositorios oficiales.
Por lo tanto para instalar prelink abrimos un terminal y tecleamos:
sudo apt-get install prelink
Seguidamente para activar prelink tenemos que acceder a su archivo de configurac
in. Para acceder a su archivo de configuracin tecleamos el siguiente comando en la
terminal:
sudo gedit /etc/default/prelink
Se abrir el editor de textos. Ahora tenemos que modificar los siguientes parmetros
del archivo de configuracin:
Dentro del fichero veremos que hay el siguiente texto:
PRELINKING=unknown
Tenemos que modificar esta linea y dejarla como podis ver a continuacin:
PRELINKING=yes
Nota: Es posible que en vuestra distro el valor estndard de la variable PRELINKIN
G sea NO en vez de UNKNOWN. Si es este el caso lo nico que hay que hacer es cambiar e
l no por yes
Dentro del mismo archivo de configuracin tambin podemos modificar las opciones de
funcionamiento de prelink. Dentro del archivo de configuracin veremos una linea q
ue pone:
PRELINK_OPTS=-mR
-mR son las opciones de configuracin estndard de prelink. En mi caso las modifico
quedando del siguiente modo:
PRELINK_OPTS=-amR
El significado de cada una de las opciones de configuracin es:
a: Especifica que se haga un prelink de la totalidad de binarios y de las librera
s especificadas en el directorio /etc/prelink.conf.
m: Opcin que permite un ahorro de memoria cuando se enlazan los ficheros binarios
y las libreras compartidas. Lo consigue de la siguiente manera. Antes hemos dich
o que prelink asigna una direccin virtual nica a cada una de las libreras compartid
as. Pero bajo determinadas circunstancias prelink har que distintas librerias pue
dan tener la misma direccin virtual nica con el consecuente ahorro de memoria. Est
a opcin es sobretodo til en el caso que el nmero de enlaces a realizar sea alto.
R: El proceso de asignar direcciones a las librearas compartidas lo hace de forma
aleatoria.
Para tener una explicacin ms detallada del funcionamiento y de las diferentes opci
ones que tiene prelink podemos abrir una terminal y teclear:
man prelink
De este modo podemos ver y comprender la totalidad de opciones que nos ofrece pr
elink.
EJECUTAR PRELINK POR PRIMERA VEZ
Seguidamente iniciaremos prelink por primera vez. Para iniciarlo por primera vez
tenemos abrir una terminal e introducir el siguiente comando:
sudo prelink -amvR
Seguramente tendris que esperar un buen rato ya que en este momento se estn enlaza
ndo nuestras librearas compartidas con nuestros binarios. El proceso puede termin
ar con xito tal y como me paso con Xubuntu. Si el proceso termina con exito ya po
demos decir que la totalidad de nuestro binarios y nuestras libreras estn enlazado
s.
Tambin puede ser que se generen errores durante el proceso como me paso en Debian
Testing y en Debian Sid. En el caso que se den errores en medio del proceso de
enlace actuar del siguiente modo:
RESOLUCIN DE PROBLEMAS LA PRIMERA VEZ QUE EJECUTAMOS PRELINK
El tpico error que se puede dar es el que podis observar en la siguiente captura d
e pantalla:
Error Tpico de Prelink
Como podis ver se trata de una librera que no puede prelinkar. Se trata de la libr
era /usr/lib/apt/methods/rred. Como no puede enlazar esta librera se para el proce
so, y por lo tanto el proceso de preenlazar queda incompleto. Una solucin que ten
emos para hacer que se se termine el proceso es introducir las libreras que paran
el proceso de enlace a la lista negra de prelink. Para introducir a la lista ne
gra la totalidad de libreras que nos dan problemas tenemos que seguir los siguien
tes pasos:
Paso 1- Dar permisos de escritura al archivo /etc/prelink.conf. Este fichero es
el que contiene las rutas de los los binarios y libreras a preenlazar y donde deb
eremos introducir las excepciones. Para darle permisos de escritura abrimos una
terminal y tecleamos:
sudo chmod 666 /etc/prelink.conf
Paso 2- Ejecutamos prelink con el siguiente comando:
sudo prelink -amvR
Prelink se ejecuta hasta que nos da el error. Vemos que por ejemplo el error est
a en la librera /usr/lib/apt/methods/rred.
Paso 3- Introducimos la librera que contiene el error en la lista negra introduci
endo el siguiente comando en la terminal:
sudo echo -b /usr/lib/apt/methors/rred >> /etc/prelink.conf
Nota: La parte de color rojo del comando se tiene que modificar en funcin de la l
ibrera que se quiera introducir a la lista negra.
A continuacin dejo una captura de pantalla para que puedan observar como realice
los pasos 2 y 3:
Solucin de los errores de salida de Prelink
Paso 4- Seguidamente hay que ejecutar los pasos 2 y 3 tantas veces como sea nece
sario hasta que se pueda finalizar el proceso de enlazado.
Una vez finalizado el proceso si queremos podemos ver la totalidad de libreras in
troducidas en la lista negra. Solo tenemos que introducir el siguiente comando e
n la terminal:
gedit /etc/prelink.conf
La totalidad de libreras que en el editor de textos empiezan por -b estn en la lis
ta negra de prelink.
Nota: Es posible que tengis que introducir bastantes rutas de libreras en la lista
negra. Por lo tanto este proceso requiere de bastante paciencia.
ASEGURAR QUE PRELINK NO HAGA INESTABLE NUESTRO SISTEMA
Como hemos visto en la explicacin inicial estamos modificando los binarios de nue
stro sistema operativo para que puedan acceder a las libreras compartidas mucho ms
rpido de lo habitual. Esto significa que en el momento que actualicemos o recomp
ilemos un programa se perder el efecto de prelink ya que estaremos reemplazando e
l fichero binario modificado por otro completamente nuevo.
Por lo tanto despus de cualquier utilizacin es recomendable volver a ejecutar el c
omando:
sudo prelink -amvR
De este modo estaremos reconstruyendo los enlaces de las libreras compartidas con
los binarios. Este proceso es necesario realizarlo peridicamente para no perder
el efecto de prelink.
Si queremos evitar tener que rehacer los prenlaces cada vez que modifiquemos los
paquetes de nuestro sistema tenemos una solucin fcil. En el archivo de configurac
in /etc/default/prelink vemos que prelink viene configurado para ejecutarse automt
icamente cada 7 das a travs de cron.daily. Conociendo esto podemos hacer que se re
visen los enlaces automticamente cada vez que se modifiquen los ficheros de nuest
ro sistema. Para ello abrimos una terminal y tecleamos:
sudo gedit /etc/apt/apt.conf
Se abrir el editor de texto. Una vez dentro del fichero de configuracin de apt tan
solo tenemos que copiar el siguiente texto al final de fichero:
DPkg::Post-Invoke {"echo Ejecutando prelink, por favor espere...;/etc/cron.daily
/prelink";}
Guardamos, salimos y listo. De este modo cada vez que se actualicemos un paquete
, ya sea con synaptic o con apt-get , se ejecutar prelink automticamente y todos l
os binarios sern pre enlazados con las libreras correspondientes.
DESINSTALAR PRELINK
En el caso que no estemos satisfechos con el rendimiento de prelink podemos desh
acer la totalidad de acciones que hemos realizado siguiendo el siguiente proceso
:
Abrimos una terminal y tecleamos:
sudo gedit /etc/default/prelink
Una vez tengamos abierto el editor de texto buscamos la linea:
PRELINKING=yes
y la modificamos por:
PRELINKING=no
Guardamos el fichero. Abrimos una terminal y ejecutamos el siguiente comando:
sudo /etc/cron.daily/prelink
Seguidamente abrimos el archivo de configuracin de apt introduciendo el siguiente
comando en la terminal:
sudo gedit /etc/apt/apt.conf
Una vez abierto el editor de texto borramos la siguiente linea:
DPkg::Post-Invoke {"echo Ejecutando prelink, por favor espere...;/etc/cron.daily
/prelink";}
Mas Ejemplos Pre-Invoke, Post-Invoke
DPkg::Pre-Invoke {"echo Montando /tmp como ejecutable...;mount -o remount,exec /
tmp";};
DPkg::Post-Invoke {"echo Revirtiendo cambios en /tmp, montando directorio como n
o ejecutable...;mount -o remount /tmp";};
***************************************************
DPkg::Post-Invoke, which is invoked after every execution of dpkg (by an apt
tool, not manually);
APT::Update::Post-Invoke-Success, which is invoked after successful updates
(i.e. package information updates, not upgrades);
APT::Update::Post-Invoke, which is invoked after updates, successful or othe
rwise (after the previous hook in the former case).
***************************************************

Finalmente ya solo nos queda ejecutar los siguientes comandos para no dejar rast
ro de prelink en nuestro sistema:
prelink -au
sudo apt-get remove --purge prelink
PROBLEMAS CONOCIDOS CON PRELINK
No se aconseja usar prelink en sistemas operativos que tengan un versin de kernel
inferior a 2.4.10. Creo que a da de hoy prcticamente no quedan sistemas que funci
onen con esta versin de Kernel.
Como hemos comentado prelink estar modificando los binarios de nuestras aplicacio
nes. Por lo tanto si tenemos instalados los paquetes checksecurity y tripwire no
s estarn dando advertencias constantemente. En principio estos paquetes no vienen
instalados de serie. Los 2 paquetes realizan comprobaciones bsicas de seguridad
en el sistema y tambin comprueban la integridad de los archivos y de las carpetas
.
Se aconseja no usar prelink en ordenadores en que tengamos problemas de espacio
en el disco duro. Se recomienda un espacio mnimo de al menos 50 MB. El motivo es
que prelink aade informacin tanto a nuestras libreras compartidas como en nuestros
ficheros binarios. Por lo tanto si no hay espacio suficiente para poder realizar
estas modificaciones podemos llegar a romper nuestro sistema.
Nota: Con todo lo citado en el post prelink puede llegar a parecer peligroso. No
obstante llevo tiempo usndolo y nunca me ha dado ningn problema. Tampoco he encon
trado casos en Internet de gente que le haya destrozado el sistema por el uso de
prelink. En definitiva prelink siempre me ha funcionado correctamente tanto en
sistemas de 32 bits como en sistemas de 64 bits.
INCREMENTO DE RENDIMIENTO PROPORCIONADO POR PRELINK
La verdad es que ha sido difcil encontrar gente que reporte sobre las mejoras obt
enidas con prelink. nicamente he hallado una fuente que reporta resultados. Los
resultados son los siguientes:

**************************************************************

******************** DPkg::Pre-Invoke ************************


/etc/apt/apt.conf.d
DPkg::Pre-Invoke {" date >> /home/javier/.trim/registroTrimInstalaciones.txt; e
cho Ejecutando fstrim antes de instalar paquete >> /home/javier/.trim/registroTr
imInstalaciones.txt; fstrim -v / >> /home/j$
**************************************************************

******SEMAPHORES***********************
Ver semaforos:
sysctl -A | grep kernel.sem
ipcs -ls
vi /etc/sysctl.conf
kernel.sem = 250 32000 100 128
or
sysctl -w "kernel.sem = 250 32000 100 128"
or
sysctl -w "kernel.sem=4096 512000 1600 2048" [ Value reducing your CPU usage
from avg 50% to 20%]
kernel.sem: max_sem_per_id max_sem_total max_ops_sem_call max_sem_ids
**********************************************

# TRANSPARENT HUGEPAGE *******************


Ubuntu/Debian: /sys/kernel/mm/transparent_hugepage
cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
*********************************************

******* OPTIMIZAR MAS UBUNTU ***************


Removing Ubuntu One client
Saves >100 MB ram.
The following steps can be followed to completely remove the Ubuntu One client s
oftware.
killall ubuntuone-login ubuntuone-preferences ubuntuone-syncdaemon
sudo rm -rf ~/.local/share/ubuntuone
rm -rf ~/.cache/ubuntuone
rm -rf ~/.config/ubuntuone
rm ~/Ubuntu\ One
sudo apt-get purge ubuntuone-client python-ubuntuone-storage*
Remove unused Unity lenses
sudo apt-get purge \
unity-lens-friends \
unity-lens-music \
unity-lens-photos \
unity-lens-shopping \
unity-lens-video \
unity-lens-radios
*********************************************************
Remove orphaned libraries
Over time most Ubuntu/Debian installations acquire packages which are no longer
required - they ve just been pulled in to satisfy dependencies of software you v
e since removed - deborphan package is probably the simplest way to get rid of o
rphaned and unused packages.
sudo apt-get install deborphan
sudo apt-get remove --purge deborphan; sudo apt-get autoremove
Clean browsers cache etc and vacuum browser databases.
sudo apt-get install bleachbit
bleachbit -c bleachbit -l | grep cache
bleachbit -c bleachbit -l | grep tmp
bleachbit -c bleachbit -l | grep vacuum
Clean rotated log files
sudo bleachbit -c system.rotated_logs
*****************************************************************
Clean temp and backup files
First do a dry-run and check that everything is good to go. bleachbit -p deepsca
n.*
and then do the real one bleachbit -c deepscan.*
********************************************************************

#PROBLEMAS CON LIBRERIAS, NO ABRIA GPARTED NI MONITOR-SYSTEM


nano /etc/ld.so.conf.d/LD_LIBRARY_PATH.conf
BORRO EL CONTENIDO DEL ARCHIVO ANTERIOR
posteriormente ejecuto:
sudo ldconfig
*******************************************
/bin/systemctl daemon-reload
*******************************************
****** fallo google-chrome ************
/opt/google/chrome/chrome --user-data-dir="$HOME/.config/google-chrome-backup" -f
irst-run
Borrar ~/.config/google-chrome
CAMBIAR PERMISOS DIRECTORIO PROBLEMAS GOOGLE-CHROME
sudo chown -R user:user ~/.pki/
sudo chown -R javier:javier /home/javier/.cache/dconf/user
*********************************
CAMBIAR VERSIN JAVA INSTALADA
sudo update-alternatives --config java
***********************************
*********** SABER METODO ACELERACION GRAFICAS USADO ******************
grep -i uxa /var/log/Xorg.0.log
********************************************

tmpfs /home/javier/.cache/google-chrome tmpfs noatime,nosuid,nodev,mode=1777


0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
tmpfs /home/javier/.cache/spotify/Storage tmpfs noatime,nosuid,nodev,mode=1777
0 0
tmpfs /var/cache/apt/archives tmpfs defaults,noexec,nosuid,nodev,mode=0755
0 0
none /dev/shm tmpfs defaults,noexec,nosuid 0 0
#FTP
#curlftpfs#jmarp1:jmarp1@77.27.131.129 /home/javier/FTP_ruben21.d fuse auto,user
,noatime,uid=1000,allow_other,_netdev 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
#tmpfs /ramdisk tmpfs nodev,nosuid,noatime,mode=1777,
size=100M 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0
0
tmpfs /var/spool tmpfs defaults,noatime,mode=1777 0
0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0
0
#.thumbnails files are never deleted and can grow quite large over time.
#tmpfs /root/.thumbnails tmpfs defaults,noatime,mode=1777 0
0
#tmpfs ~/.thumbnails tmpfs defaults,noatime,mode=1777 0 0

*********************************************

# Controls IP packet forwarding


net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
# Disables IP source routing
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Increase maximum amount of memory allocated to shm
# Only uncomment if needed!
# kernel.shmmax = 67108864
# Disable ICMP Redirect Acceptance
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
# Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.all.log_martians = 1
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 25
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1200
# Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 1
# Turn on the tcp_sack
net.ipv4.tcp_sack = 1
# tcp_fack should be on because of sack
net.ipv4.tcp_fack = 1
# Turn on the tcp_timestamps
net.ipv4.tcp_timestamps = 1
# Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Make more local ports available
# net.ipv4.ip_local_port_range = 1024 65000
# Set TCP Re-Ordering value in kernel to 5
net.ipv4.tcp_reordering = 5
# Lower syn retry rates
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 3
# Set Max SYN Backlog to 2048
net.ipv4.tcp_max_syn_backlog = 2048
# Various Settings
net.core.netdev_max_backlog = 1024
# Increase the maximum number of skb-heads to be cached
net.core.hot_list_length = 256
# Increase the tcp-time-wait buckets pool size
net.ipv4.tcp_max_tw_buckets = 360000
# This will increase the amount of memory available for socket input/output queu
es
net.core.rmem_default = 65535
net.core.rmem_max = 8388608
net.ipv4.tcp_rmem = 4096 87380 8388608
net.core.wmem_default = 65535
net.core.wmem_max = 8388608
net.ipv4.tcp_wmem = 4096 65535 8388608
net.ipv4.tcp_mem = 8388608 8388608 8388608
net.core.optmem_max = 40960
#Deshabilita ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
vm.dirty_background_ratio = 50
vm.dirty_ratio = 80

/********************** UBUNTU 16.04 *******************/


PLANK
--------
Versin desarrollo dock plank:
web: https://launchpad.net/~ricotz/+archive/ubuntu/docky
sudo add-apt-repository ppa:ricotz/docky
sudo apt-get update
deb http://ppa.launchpad.net/ricotz/docky/ubuntu yakkety main
deb-src http://ppa.launchpad.net/ricotz/docky/ubuntu yakkety main
/*********************************************************/
QUITAR EL ANCLA DE PLANK
Se accede con un editor tipo dconf-editor o gconf-editor en la variable /net/lau
nchpad/plank/docks/dock1/
Se pone el valor del ancla en false.

************* CAMBIOS QUE HICE *************


Para el panel de mate
nano /usr/share/applications/marco.desktop

*** Verificar estos datos *************


X-MATE-Autostart-Phase=Applications
X-MATE-Autostart-Delay=2
X-MATE-Provides=windowmanager
X-MATE-Autostart-Notify=true
***************************************
********* HIBERNAR ******************
/etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-
key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;or
g.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
*********************************************
CORRCIONES MATE PANEL
cd /usr/share/themes/BlackMATE/gtk-2.0
nano gtkrc

******************
abrir chrome con
--disable-gpu-driver-bug-workarounds" --enable-native-gpu-memory-buffers

/************************************
the_simple_computer
About
Oh /dev/sda! How Have I Displeased Thee?
Updated October, 14, 2014.
This site is no longer being maintained so anything below could still be accurat
e, or very outdated.
/etc/fstab is the primary file which tell a Linux box what partitions, drives an
d devices to mount and at which places in the filesystem to do so. When you star
t your computer, the command mount -a is run from a boot script and this invokes
fstab, bringing your disk partitions to life.
What else is fstab? A compromise. Its a one-size-fits-all solution to give the be
st general performance on the largest amount of hardware possible. Hard drives (
including SSDs) and filesystems are finicky things which can behave inconsistent
ly under similar circumstances. It boils down to the fact that for optimal setti
ngs, you must benchmark your own setup because if you really want to tune your e
quipment, theres no quick copy & paste fix.
Having said that, fstab changes do not give a large performance increase and the
re is nothing shameful about a default fstab. Besides, if you really want to fin
e-tune the I/O performance of your system s storage, you ll need to go further t
han just fstab tweaks.
The Arch Linux and Ubuntu wikis are helpful introductions to fstab which you sho
uld definitely read through. The mount command s man page (or run man mount in a
terminal) gives you most of what you need to know but to Linux nooblets, its co
ntents are abstractions from a distant universe.
Using a few basic fstab tweaks, it is possible to squeeze out some extra securit
y and performance from the filesystem without any negative effects. What I attem
pt in this installation of tSc goodness is to condense the fstab experience into
something more palatable for new(ish) users yet more advanced than the wiki int
ro pages. I have for you a range of settings to choose from and Ive done some lig
ht benchmarks for some of those settings, but keep in mind that your results WIL
L vary and just because a setting is available, doesn t mean you should use it.
I always put / and /home on separate partitions unless a different setup is spec
ifically needed. Why? Because this allows better control of each partition indiv
idually through fstab, LUKS encryption and backup imaging. Not that those are al
ways needed simultaneously, but I highly suggest you take advantage of them as m
uch as possible.
For this writeup Im using Ubuntu 13.04 with both the default ext4 filesystem and
3.8 kernel. The light testing I did on a bare metal installed system but the two
screenshots below are from a virtual machine. Most of this also applies to othe
r distros using ext4 and some with ext3.
Get to Know Your fstab
Before all else, let us familiarize ourselves with the filesystem in its default
state. Open up a terminal window and enter:

cat /proc/mounts

The exact readout will vary depending on your distro, partition setup and kernel
of choice, but you will see something like this:
Since I installed the VM to two partitions, / is labeled with /dev/disk/by-uuid/
huge_device_identifier and /home is just /dev/sda2. If you encrypted your partit
ions with Cryptsetup and dm_crypt, they will each show as /dev/mapper/device_nam
e. In the screenshot, you can see that / is mounted with the options rw, relatim
e, errors=remount-ro, and data=ordered. Then /home is mounted with rw, relatime,
data=ordered.
Now lets go over to fstab.

cat /etc/fstab

Rarings default fstab looks like below. In addition to what we saw in /proc/mount
s, /home also uses the mount option "defaults".

Confusingly, / also uses defaults even though its not listed. Mounts man page tell
s of mount options specified directly by the kernel. These are suid, dev, exec,
auto, nouser, async and relatime and theyre summed up into the one defaults optio
n. Now combine these kernel options with what you see for each partition in fsta
b and /proc/mounts; these are your filesystems default mount options.
Ok, so what do these mount options mean? No need for me to reinvent the wheel he
re, the Arch and Ubuntu wikis clearly lay out the basics. For the bigger picture
, mounts man page to the rescue and the two areas you want to focus on are Filesy
stem Independent Mount Options and then ext4 under Filesystem Dependent Mount Op
tions.
Mount Option Etiquette
Before we start changing things, there are some rules to how mount options are u
sed. Options are applied from left to right and you should always avoid contradi
cting and redundant entries. For example, there is no need to add rw, relatime o
r data=ordered to fstab because those mount options are already set as default b
y the kernel.
Certain mount options also include other options. One example is the option owne
r, which allows only the owner of a device or filesystem to mount it. The owner
option already includes nodev and nosuid so you dont need to add them individuall
y.
Your New fstab
Lets create a thought exercise. Summon in your mind an average desktop computer f
or average home use, running whatever distro you prefer (within reasonable avera
geness, of course). Whether it single or multi-boots other operating systems doe
s not matter. Let us assign 4GB of RAM to our new friend and give it a single me
chanical hard drive. This computer also does not have any kind of battery backup
or external power supply because again, its completely average.
If this desktop were under my watch, below is what I would make its fstab file l
ook like. The bold is what I added.

# <file> <system> <mount point> <type> <options> <dump> <pass>


# / was on /dev/sda1 during installation
UUID=*** / ext4 noatime,errors=remount-ro 0 1
# /home was on /dev/sda2 during installation
UUID=*** /home ext4 nodev,nosuid,noatime,errors=remount-ro 0 2
# swap was on /dev/sda3 during installation
UUID=*** none swap sw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
none /run/shm tmpfs nosuid,nodev,noexec 0 0

No drastic change from default, it leans more towards usability and safety rathe
r than ironclad security and cutting-edge speed, but while nothing is written in
stone, fstab really isn t the place to aim for either of those things; fstab wo
uld be a small layer, at best.
Lets break these added settings down. The mount options and the last two lines ar
e the biggest areas of interest so from here, I will presume you have skimmed th
rough at least Ubuntus wiki on fstab.
noatime
Starting with the system partition, noatime is the first mount option and the Ar
ch Wiki explains well what atime is. Noatime is just turning that off, which is
especially good for minimizing power consumption and disk writes but does not af
fect a files Last Modified date in a file manager. I assume this average user wil
l not be using a CLI based mail client, so noatime would be desirable.
nodev
This is a security option. Here are two great explanations on Super User [1] [2]
.
nosuid
Also a security option; SUID means Set User ID but nosuid also includes SGID, Se
t Group ID. nosuid disallows any executable on the partition from having SUID an
d SGID permissions so it would be unable to change from your user account s owne
rship and group, to a different user or group with elevated privileges.
The last two fstab lines we will get to shortly.
Other Popular Mount Options
The mount options you use should be appropriate for the user and/or the system b
ut this also requires some quick mental risk management. If youre working with a
laptop or a computer with an uninterruptible power supply, that allows you to (m
ore) safely use some mount options you otherwise wouldnt want to include. The dif
ferences in performance between using these or not is virtually unnoticeable and
many people would probably argue theyre not worth the risk of corrupted data in
event of a crash. However, do as you will.
data=writeback
Ext 3 and 4 have three journaling modes. Both ordered (the default) and writebac
k only journal metatdata, not the file data itself, so theyre a sort of half-jour
naling (and no, writeback does not disable journaling altogether).
From the tune2fs man page entry on writeback mode, This may increase throughput,
however, it may allow old data to appear in files after a crash and journal reco
very. Full journaling of both file and metadata is what you get with data=journal
and that gives you the most safety with the largest performance decrease.
According to mounts man page, the proper way to change the journaling mode of you
r system partition is to modify GRUB rather than fstab. Other partitions will ob
ey fstab.

gksu gedit /etc/default/grub

Add the bold.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rootflags=data=writeback"

Then update GRUB.

sudo update-grub

If you change the system partition s journaling mode, you MUST inform tune2fs ab
out it. If you do not, the computer wont boot.

sudo tune2fs -o journal_data_writeback /dev/sdxy

commit
By default, this syncs file data with its journaled metadata every 5 seconds. If
youre on a stable system with battery backup, you can up this to 30 seconds, 120
seconds, or (theoretically) whatever duration youre comfortable with. For refere
nce, the script in the laptop-mode-tools package changes the commit time to 10 m
inutes (which I personally would not want so high).
Increasing the commit time will decrease disk writes and power use by a small am
ount. The downside is that you go longer with a discrepancy between a files data
and its journaled metadata so if you do have a crash, you could loose more work
with a higher commit time than a lower one. To set the commit interval in fstab,
the syntax is:

commit=30

nobarrier
Write barriers are enabled by default on Linuxs ext4 filesystem. From mounts man p
age, If your disks are battery-backed in one way or another, disabling barriers m
ay safely improve performance. For more info on write barriers, see this article
from Linux Weekly News but note that from kernel 2.6.33, mapper devices like log
ical or encrypted volumes can use nobarrier too.
noexec
This disallows executables from running on the device. You could add noexec to /
home as a security enhancement but then things like .deb packages and scripts wo
uld not be able to run from there; you d need to move them to /opt or /tmp and e
ither change their ownership or run as root. This could be a useful on LDAP and
other centrally managed Active Directory-esque areas.
TRIM for SSDs
From the operating system, TRIM for solid state drives is called either by the D
iscard mount option or an fstrim script. Discard tells the filesystem to tell th
e SDDs firmware to run TRIM immediately after you delete any file. Discard is onl
y for ext4 filesystems but via TRIM, it is supported by both ATA and SCSI device
s. It used to be that because TRIM by discard happens right away, it would cause
stuttering or even temporary freezes. More recent trials from users posting in
the comments of this 2011 blog article indicate that discard times may be decrea
sing due to firmware and kernel advances.
The alternative to discard is a cron job which runs fstrim. fstrim calls FITRIM
to asynchronously do batch cleanups all at once at a scheduled time. FITRIM will
work on ext3 & 4, xfs and several other filesystem types but only on ATA device
s. For an LVM or dm_crypt setup, you would actually use both fstrim and discard.
However, know that enabling TRIM on encrypted volumes has security implications
.
Ubuntu 14.04 and derivatives install with a weekly cron job by default which run
s /sbin/fstrim-all. This checks if your SSD is whitelisted and if so, runs fstri
m (see /sbin/fstrim-all). Forcing fstrim for non-whitelisted manufacturers comes
with an At Your Own Risk! disclaimer and may still not work since some SSDs are
blacklisted from fstrim in the kernel until proven reliable.
To use fstrim with non-Ubuntu 14.04+ distros, you ll need to manually add a cron
job. First verify that your SSD supports TRIM.

sudo hdparm -I /dev/sdx | grep TRIM


If it does, you will see something like this:

* Data Set Management TRIM supported (limit 1 block)

Create the job script.

gksu gedit /etc/cron.monthly/trim

Make the contents:

#!/bin/sh
LOG=/var/log/trim.log
echo "$(date -R)" >> $LOG
/sbin/fstrim / >> $LOG
/sbin/fstrim /home >> $LOG

And make the job executable.

sudo chmod +x /etc/cron.monthly/trim

Any mount point you want trimmed must be included in the job script. I chose a m
onthly cron job to allow the disk to fill up more before cleanup which should he
lp with wear leveling. If you fill the disk too quickly or find the cleanup time
too obtrusive, use a weekly job.
Mounting as tmpfs
Tmpfs means temporary filesystem. Its located entirely in RAM but it can still us
e swap space. This is another area of information deprecation on Linux forums be
cause what is mounted into tmpfs by default has changed over the years so there
are a lot of outdated suggestions to stick all kinds of things in tmpfs.
/tmp
One tip which is still useful is to mount /tmp as a temporary filesystem. /tmp i
s designed as a place of non-persistence between boot sessions but according to
one System V developer /tmp should not be binded to /run/shm.
The two main reasons for mounting /tmp in RAM are to speed up file access and to
reduce SSD writes. Arch Linux does this by default while Debian and Ubuntu both
delete the contents of /tmp on boot (see /etc/default/rcS). Ideally though, con
tents should be deleted on shutdown so nothing malicious there survives beyond t
he session. Mounting /tmp as tmpfs accomplishes this.
You dont need to worry about filling up your RAM either because tmpfs grows in si
ze only as you need it; it does not pre-allocate its full size like a ramdisk. O
nce tmpfs hits 50% of your system memory, it starts using swap space. If you dont
have a swap area, then the program which needs that RAM will complain. For exam
ple, Brasero asks where you want it to put temporary files for DVD burning, but
not all applications will be so polite.
Here is the second to last line in the example fstab file above:

tmpfs /tmp tmpfs nosuid,nodev 0 0

Mounting /tmp as nosuid,nodev and noexec is a useful security improvement but us


ing noexec will give you problems with apt. Updates will still happen, but apt w
ill give the error, TMPDIR is mounted noexec, will not cache run scripts. Same if
you manually run update-initramfs. Some packages will not install properly becau
se they rely on scripts executing from /tmp. That is rare but you wont necessaril
y know unless you watch the terminal output or go through apts logs.
Rather than chance something not updating or installing correctly, there is a fi
x. You create a file with instructions to unmount /tmp only for updates and remo
unt it with execution ability. After the update, /tmp then remounted as noexec.

gksu gedit /etc/apt/apt.conf.d/99remount-tmpexec

The contents should be:

DPkg::Pre-Invoke {"mount -o remount,exec /tmp";};


DPkg::Post-Invoke {"mount -o remount /tmp";};

Since /tmp is being unmounted, if you have anything stored there, that data will
be lost. Thus if you want to use /tmp with noexec and this apt config file, giv
e thought to your update patterns so youre not removing temporary files which you
r applications need at that moment.
/run
The entire /run filesystem tree is already mounted in RAM as tmpfs with /run/shm
of course being part of this. The mount options, however, are different. /run/s
hm is shared memory space, capable of hosting interprocess communication and wor
ld-writable by whatever needs it. Not all distros ship using shared memory but D
ebian and Ubuntu do and we want this to be one less place with ability for execu
tion. By default, Debain mounts /run/shm as noexec but Ubuntu does not. This ent
ry is the last line in my fstab file above.

none /run/shm tmpfs nosuid,nodev,noexec 0 0

Notice the line starts with "none", not "tmpfs". That is intentional. On some di
stros, using the tmpfs label will give you two /run/shm mount points in RAM, one
for each label. Obviously only the none mount point will actually be used but w
e want to to modify the existing mount point, not duplicate it. Use none.
Browser Caches
Browsers can have their caches placed in RAM too, and there are multiple ways to
do this. fstab is one way, and a good way, but it looses practicality for compu
ters with many users. fstab can t do wildcards so you would need one line per br
owser for each user account. Here are some example fstab entries for browser cac
hes:

chrome-cache /home/username/.cache/google-chrome tmpfs noexec,nosuid,nodev,noati


me 0 0
chromium-cache /home/username/.cache/chromium tmpfs noexec,nosuid,nodev,noatime
0 0
midori-cache /home/username/.cache/midori/web tmpfs noatime,nodev,noexec,nosuid
0 0
/home/username/.local/share/webkit/databases /home/username/.cache/midori/web no
ne bind 0 0

From here, two things:


Midori s local database storage location can be binded to the cache location
so they ll both live in tmpfs. That s the second line for Midori above. It s op
tional.
For Firefox, you re better off going into about:config and creating a parent
directory string to relocate the cache.
If you mount /tmp as tmpfs, use:
browser.cache.disk.parent_directory; /tmp/firefox
If you don t mount /tmp as tmpfs, use /run/shm instead:
browser.cache.disk.parent_directory; /run/shm/firefox
Other caching options are to use the binary switch for Chromium-based browsers a
nd Archs Wiki has several more choices for Firefox & forks.
To start using the browser s tmpfs immediately, you only need to mount it.

sudo mount -l chrome-cache

fstab Entries to Avoid


/dev/shm
/dev/shm is mostly deprecated so do not use it. Since Ubuntu 11.10, /dev/shm sym
links to /run/shm which we already covered.
/var/cache
It s expected for this to remain as persistent storage between boots. The data i
s removed by the programs which use it so dont use tmpfs here.
/var/lock and /var/run
/var/lock symlinks to /run/lock and /var/run to /run. No need to make them tmpfs
because they already are.
/var/log
This is where 99% your operating systems log files are. Im all about minimizing di
sk writes but putting system logs into volatile RAM isnt the answer. Log files ar
e too important for when you do need to troubleshoot.
/var/tmp
The entire purpose of /var/tmp is a place for temporary data to survive boot ses
sions, dont use tmpfs on it.
mode=1777
This is often in guides which mount /tmp as tmpfs. This permissions mode 1777 se
ts /tmp to 777 and sets the sticky bit so that a file or directory can only be r
enamed or deleted by its owner, the directory owner or root. Other users can sti
ll modify the files contents so setting a sticky bit here is not a big security i
ncrease.
777 permissions on /tmp is actually a decrease in security because you re loosen
ing default permissions by making /tmp an executable area by any user. Run ls -l
d /tmp in a terminal. Youll see the default permissions as drwxrwxrwt. The t at t
he end means the sticky bit is already set and notice that there is no x just be
fore it. Any user can read and write to /tmp but only root and users who are mem
bers of the appropriate groups can execute there. Chmod 1777 will change that so
any user can execute in /tmpbad for security and unneeded. Don t do it.
nobh
This is deprecated since Ubuntu 11.10.
My Tests
I only used dd for this. For some reason, Gnomes Disks application refused to wor
k on a mounted drive and I didn t care to investigate. A full disk benchmarking
utility like Bonnie++ or ioZone would be more appropriate but I was just looking
for basic read and write results. Since one does not simply discuss filesystem
tuning without mentioning the disk I/O scheduler, I checked them out too.
The hard drive was a 2.5 Hitachi Travelstar. Its a single platter, 5400 RPM drive
approaching 3 years in age with a 500 GB capacity and 309 GB available. I left w
rite caching enabled. To measure writes, I made a bash script to run dd every 20
seconds, 10 times total.
Heres the script s contents. The dd command creates a 524 MB file in your home fo
lder, then shows you the time it took and the average write speed, then it erase
s the file. For each fstab change and each scheduler, I ran the script once and
averaged the results. I put all the raw data and some pretty graphs in an .odt f
ile in the Resources area below.

#!/bin/bash
echo
for run in {1..10}
do
dd if=/dev/zero of=~/output.img conv=fdatasync bs=10k count=50k; rm ~/output.i
mg
sleep 20
done

And just because its useful, if you want to see the non-cached read speed of your
drive, use:
sudo hdparm -t /dev/sdx

Most of my numbers are uneventful. The biggest differences were between I/O sche
dulers, with Deadline performing the best. Deadline is default in Ubuntu 14.04 b
ut Debian 7 and Ubuntu 12.04 use CFQ.
Everything else showed no consistent increase in speed, nor throughput and there
was not even a difference of 1 MB/s for any of the mount option averages. Ive do
ne other dd write trials when 12.04 was first released, but on different hardwar
e. Nobarrier alone gave me an improvement in the area of 4 MB/s on an older Seag
ate mechanical drive. Again, its all about what your hardware likes and the kind
of files youre working with.
So, I m sorry for the most anti-climatic write speed comparison in the history o
f the world, but its actually a good thing. My numbers indicate that ext4 in Linu
x is fast, stable and renders it unnecessary to push the limits of data safety b
y crowding your fstab with risky mount options.
From here, its possible to get creatively complicated by mixing file system types
or using rsync and cron to copy certain directories into tmpfs on boot, then mi
rror that directory back on disk for shutdown. I prefer keeping things simple bu
t the whole point of this writeup is that you have many options so read, experim
ent and enjoy the fstab.
Share this page.
Resources
tSc-Ubuntu-1304-Disk-Benchmarks .odf spreadsheet. 2013.
Phoronix EXT4 File-System Tuning Benchmarks. 2012.
Arch Linux Wiki: fstab
Ubuntu Wiki: fstab
Linux mount manual page
********************************************************************************
********************************************************************
AJUSTES APT-GET
******************************
INSTALADOR DE DRIVERS INTEL DA ERROR DE TIEMPO EXCEDIDO
Aadir a este archivo lo abajo expuesto
/etc/apt/apt.conf.d/99timeout
Acquire::http::Timeout "3600";
Acquire::ftp::Timeout "3600";
**********************************
FORZAR IPV4 PARA APT-GET
/etc/apt/apt.conf.d/98force-ipv4
Acquire::ForceIPv4 "true";
*********************************

Вам также может понравиться