Differences between revisions 1 and 11 (spanning 10 versions)
Revision 1 as of 2009-08-21 22:04:29
Size: 154
Editor: SamatJain
Comment:
Revision 11 as of 2012-01-10 05:14:17
Size: 2945
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<TableOfContents>>

Solid-state disks have low-level block fragmentation problems (see Anandtech article), and these problems will persist even after formatting. Most disk's block mapping table can be reset by [[https://ata.wiki.kernel.org/articles/a/t/a/ATA_Secure_Erase_936d.html|issuing an ATA secure erase command]].

== Disable entropy collection from disk I/O ==

With rotating disks, the amount of time to write a block is used as source of entropy. With SSDs, the time is so fast that it no longer is a good entropy source. The code path to verify randomness and add this data to the entropy pool just serves as a slowdown, but it can be disabled with:

{{{
echo 0 > /sys/block/sda/queue/add_random
}}}

This will work with Linux 2.6.36 and above.
Line 3: Line 17:
 * [[http://lifehacker.com/5342636/how-to-fix-annoying-youtube-jumpiness-in-firefox|Reduce Firefox's Session Saving frequency]] === Reduce Firefox's Session Saving frequency ===

[[http://lifehacker.com/5342636/how-to-fix-annoying-youtube-jumpiness-in-firefox|Reduce Firefox's Session Saving frequency]] mentions to alter the default of 15s to 60s, or perhaps 300s (5 minutes). In about:config, set browser.sessionstore.interval to 60000.

== Remounting temporary files as tmpfs ==

To /etc/fstab:

{{{
none /tmp tmpfs defaults,noatime,mode=1777,size=1024M 0 0
none /var/tmp tmpfs defaults,noatime,mode=1777,size=512M 0 0
}}}

== /var/lock and /var/run on a RAM disk ==

Ubuntu puts /var/lock and /var/run into a RAM disk; you can do the same with Debian by configuring the appropriate settings in /etc/default/rcS:

{{{#!highlight sh
cat << EOF >> /etc/default/rcS
RAMRUN=yes
RAMLOCK=yes
EOF
}}}

This may break some buggy packages.

== Creating aligned filesystems ==

This assume that the underlying partitions (including layers, such as LVM) have been created on properly-aligned sector boundaries.

These assume a 128 KiB erase block size.

More information:

 * [[http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-erase-block-size/| Aligning filesystems to an SSD's erase block size]] (Theodore Ts'o)

=== ext4 ===

{{{
mkfs -t ext4 -E stripe-width=32,resize=$(FILESYSTEM_SIZE)*10G /dev/sda1
}}}

Set the resize parameter to 10 times the filesystem's size, assuming that in the future you might grow the filesystem that large. The default multiplier is 1000, which is definitely unreasonable. Remember to append 'G' for gigabytes.

Source: [[http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-erase-block-size/|Aligning filesystems to an SSD's erase block size]]

This can also be down at mount time:

{{{
mount -t ext4 -o stripe=32 /dev/sda1
}}}

The stripe parameter multiplied by kernel's page size (4 KiB) will be the erase block size. I.e. 32 * 4 KiB = 128 KiB.

=== XFS ===

{{{
mkfs -t xfs -d su=128k -d sw=1 /dev/sda1
}}}

This can also be done at mount time, though the options/units are different:

{{{
mount -t xfs -o sunit=256,swidth=256 /dev/sda1
}}}

Solid-state disks have low-level block fragmentation problems (see Anandtech article), and these problems will persist even after formatting. Most disk's block mapping table can be reset by issuing an ATA secure erase command.

Disable entropy collection from disk I/O

With rotating disks, the amount of time to write a block is used as source of entropy. With SSDs, the time is so fast that it no longer is a good entropy source. The code path to verify randomness and add this data to the entropy pool just serves as a slowdown, but it can be disabled with:

echo 0 > /sys/block/sda/queue/add_random

This will work with Linux 2.6.36 and above.

Reducing writes

Reduce Firefox's Session Saving frequency

Reduce Firefox's Session Saving frequency mentions to alter the default of 15s to 60s, or perhaps 300s (5 minutes). In about:config, set browser.sessionstore.interval to 60000.

Remounting temporary files as tmpfs

To /etc/fstab:

none /tmp tmpfs defaults,noatime,mode=1777,size=1024M 0 0
none /var/tmp tmpfs defaults,noatime,mode=1777,size=512M 0 0

/var/lock and /var/run on a RAM disk

Ubuntu puts /var/lock and /var/run into a RAM disk; you can do the same with Debian by configuring the appropriate settings in /etc/default/rcS:

   1 cat << EOF >> /etc/default/rcS
   2 RAMRUN=yes
   3 RAMLOCK=yes
   4 EOF

This may break some buggy packages.

Creating aligned filesystems

This assume that the underlying partitions (including layers, such as LVM) have been created on properly-aligned sector boundaries.

These assume a 128 KiB erase block size.

More information:

ext4

mkfs -t ext4 -E stripe-width=32,resize=$(FILESYSTEM_SIZE)*10G /dev/sda1

Set the resize parameter to 10 times the filesystem's size, assuming that in the future you might grow the filesystem that large. The default multiplier is 1000, which is definitely unreasonable. Remember to append 'G' for gigabytes.

Source: Aligning filesystems to an SSD's erase block size

This can also be down at mount time:

mount -t ext4 -o stripe=32 /dev/sda1

The stripe parameter multiplied by kernel's page size (4 KiB) will be the erase block size. I.e. 32 * 4 KiB = 128 KiB.

XFS

mkfs -t xfs -d su=128k -d sw=1 /dev/sda1

This can also be done at mount time, though the options/units are different:

mount -t xfs -o sunit=256,swidth=256 /dev/sda1

SamatsWiki: SSD (last edited 2021-11-03 07:05:58 by SamatJain)