Solid State Drive tweaks: Difference between revisions

From WickyWiki
m Created page with "20110923 SSD, Ubuntu 11.04 Natty Narwhal 64 bit * https://wiki.ubuntu.com/MagicFab/SSDchecklist * check for ssd firmware updates * Enable SATA AHCI mode in the BIOS (if availa..."
 
mNo edit summary
Line 2: Line 2:


* https://wiki.ubuntu.com/MagicFab/SSDchecklist
* https://wiki.ubuntu.com/MagicFab/SSDchecklist
== Prepare ==


* check for ssd firmware updates
* check for ssd firmware updates


* Enable SATA AHCI mode in the BIOS (if available)
* Enable SATA AHCI mode in the BIOS (if available)
Note: in a dual boot configuration with Windows 7, Windows will not boot anymore. You will need to make some changes in Windows before proceeding.
== Format SSD ==


* format sdb, ext4, journaling disabled
* format sdb, ext4, journaling disabled
Line 23: Line 29:
</syntaxhighlight>
</syntaxhighlight>


* enable the TRIM command support using the "discard" mounting option
== TRIM and access time ==
  (the TRIM function prepares (wipes) free space for faster writing)
 
The TRIM function prepares (wipes) free space for faster writing. Enable the TRIM command support using the "discard" mounting option.
 


* mount volumes using the "noatime" option in stead of the "relatime" option
The "relatime" option writes the time-of-access to disk and causes unnecessary additional writes to disk. Mount volumes using the "noatime" option in stead of the "relatime" option
  (the "relatime" option writes the time-of-access to disk and causes unnecessary additional writes to disk)


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
Line 37: Line 44:
reboot
reboot
* to test if TRIM is working:
To test if TRIM is working:
 
* http://askubuntu.com/questions/18903/how-to-enable-trim
* http://askubuntu.com/questions/18903/how-to-enable-trim
== Swap ==
* lower the likelyness of swap
* lower the likelyness of swap
Line 53: Line 63:
  vm.vfs_cache_pressure=50
  vm.vfs_cache_pressure=50
</syntaxhighlight>
</syntaxhighlight>
== I/O scheduler ==


* change I/O scheduler strategy to "noop" (or "deadline")
* change I/O scheduler strategy to "noop" (or "deadline")
Line 71: Line 83:
# reboot
# reboot


* use RAM disk for temporary files
== Temporary files ==
 
Use RAM disk for temporary files to reduce the number of writes to the SSD.
 
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
sudo gedit /etc/fstab
sudo gedit /etc/fstab
Line 80: Line 95:
df
df
tmpfs xxxxxx yyyyy zzzzzz n% /tmp
tmpfs xxxxxx yyyyy zzzzzz n% /tmp
 
* move firefox cache to the earlier created /tmp
Move firefox cache to the earlier created /tmp
 
# in firefox go to "about:config"
# in firefox go to "about:config"
# filter for "browser.cache.disk.parent_directory" Set the value to "/tmp"
# filter for "browser.cache.disk.parent_directory" Set the value to "/tmp"
* (optional) move log files to /tmp
* (optional) also move log files to /tmp
 
== Other ==


Did this from other Ubuntu and then it booted
Did this from other Ubuntu and then it booted
* http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/
* http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/
tune2fs -o journal_data_writeback /dev/sdb1
tune2fs -o journal_data_writeback /dev/sdb1


* moved aMule and Vuze folders to Data drive, NB: aMule will reset the folder when it is not found
* moved aMule and Vuze folders to Data drive, NB: aMule will reset the folder when it is not found

Revision as of 08:24, 21 October 2011

20110923 SSD, Ubuntu 11.04 Natty Narwhal 64 bit

Prepare

  • check for ssd firmware updates
  • Enable SATA AHCI mode in the BIOS (if available)

Note: in a dual boot configuration with Windows 7, Windows will not boot anymore. You will need to make some changes in Windows before proceeding.

Format SSD

  • format sdb, ext4, journaling disabled
	
sudo fdisk -l /dev/sdb | grep sectors
255 heads, 63 sectors/track, 7297 cylinders
	
(BE CAREFULL) sudo fdisk -H 255 -S 63 /dev/sdb
 "d" delete partition
 "n" new partition, primary, 1
 "w" to write partition table and exit
(BE CAREFULL) sudo mke2fs -t ext4 -O ^has_journal /dev/sdb1

TRIM and access time

The TRIM function prepares (wipes) free space for faster writing. Enable the TRIM command support using the "discard" mounting option.


The "relatime" option writes the time-of-access to disk and causes unnecessary additional writes to disk. Mount volumes using the "noatime" option in stead of the "relatime" option

	
sudo cp /etc/fstab ~/fstab-backup
sudo gedit /etc/fstab
 UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /               ext4    noatime,discard,data=writeback,errors=remount-ro 0       1

reboot

To test if TRIM is working:

Swap

  • lower the likelyness of swap
	
sudo gedit /etc/sysctl.conf

 # add/edit these lines

 # minimum swappiness
 vm.swappiness=0

 # weak inode cache schrinking
 vm.vfs_cache_pressure=50

I/O scheduler

  • change I/O scheduler strategy to "noop" (or "deadline")

Note: there are alternatives to add this option to grub or to install a "sysutils" package

cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]
	
sudo gedit /etc/rc.local

# add thise lines before exit 0 for drive "sda" echo noop > /sys/block/sda/queue/scheduler # reboot

Temporary files

Use RAM disk for temporary files to reduce the number of writes to the SSD.

sudo gedit /etc/fstab

#add after the last line (exact text) tmpfs /tmp tmpfs nodev,nosuid,noexec,mode=1777 0 0 # after reboot, using df you should see a line like df tmpfs xxxxxx yyyyy zzzzzz n% /tmp

Move firefox cache to the earlier created /tmp

  1. in firefox go to "about:config"
  2. filter for "browser.cache.disk.parent_directory" Set the value to "/tmp"
  • (optional) also move log files to /tmp

Other

Did this from other Ubuntu and then it booted

tune2fs -o journal_data_writeback /dev/sdb1

  • moved aMule and Vuze folders to Data drive, NB: aMule will reset the folder when it is not found