Escolar Documentos
Profissional Documentos
Cultura Documentos
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"
#
# /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)
[Desktop Entry]
Name=Eclipse
Comment=Eclipse
Exec=/home/lince/eclipse/eclipse
Icon=/home/lince/eclipse/icon.xpm
Terminal=false
Type=Application
*********************************************************
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
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
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:
**************************************************************
******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
**********************************************
*********************************************
******************
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.
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.
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.
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.
#!/bin/sh
LOG=/var/log/trim.log
echo "$(date -R)" >> $LOG
/sbin/fstrim / >> $LOG
/sbin/fstrim /home >> $LOG
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:
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.
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:
#!/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";
*********************************