Bug#690977: partman-auto: Add a way to add "discard" option to filesystems
Hi. Instead of adding discard as a mount option in fstab, perhaps it
is better to add a cron job calling fstrim regularly?
In
<URL: http://people.skolelinux.org/pere/blog/How_to_fix_a_Thinkpad_X230_with_a_broken_180_GB_SSD_disk.html >
I described a deb ssd-setup I created to set up a machine with SSD,
and it take care of all the setup I believe make sense. The source is
available from collab-maint. To quote from the blog post:
I consider the package a draft, as I am a bit unsure how to best set
up Debian Wheezy with an SSD. It is adjusted to my use case, where I
set up the machine with one large encrypted partition (in addition
to /boot), put LVM on top of this and set up partitions on top of
this again. See the README file in the package source for the
references I used to pick the settings. At the moment these
parameters are tuned:
* Set up cryptsetup to pass TRIM commands to the physical disk
(adding discard to /etc/crypttab)
* Set up LVM to pass on TRIM commands to the underlying device (in
this case a cryptsetup partition) by changing issue_discards from 0
to 1 in /etc/lvm/lvm.conf.
* Set relatime as a file system option for ext3 and ext4 file systems.
* Tell swap to use TRIM commands by adding 'discard' to /etc/fstab.
* Change I/O scheduler from cfq to deadline using a udev rule.
* Run fstrim on every ext3 and ext4 file system every night (from
cron.daily).
* Adjust sysctl values vm.swappiness to 1 and vm.vfs_cache_pressure
to 50 to reduce the kernel eagerness to swap out processes.
During installation, I cancelled the part where the installer fill
the disk with random data, as this would kill the SSD performance
for little gain. My goal with the encrypted file system is to ensure
those stealing my laptop end up with a brick and not a working
computer. I have no hope in keeping the really resourceful people
from getting the data on the disk (see XKCD #538 for an explanation
why). Thus I concluded that adding the discard option to crypttab is
the right thing to do.
Perhaps a similar approach is good for Debian proper too? Ie instead
of changing d-i all over the place, add a deb to set up ssd parameters
and install it automatically if a disk with
/sys/block/*/queue/rotational is set to zero (0).
--
Happy hacking
Petter Reinholdtsen
Reply to: