Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Solid State Drives (SSD)"

From Funtoo
Jump to navigation Jump to search
(Created page with "This page aims to highlight SSD relevant options for commands commonly used during system setup/install.<br /> '''<big>SSD</big>'''<br /> '''WARNING'''<br /> Avoid using dd co...")
 
m (switching portage to compile in ram. /run, not /tmp)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This page aims to highlight SSD relevant options for commands commonly used during system setup/install.<br />
{{PageNeedsUpdates}}
'''<big>SSD</big>'''<br />
Solid State Drives (SSDs)...
 
=Preparation=
{{SectionNeedsUpdates}}
Partitioning
* MBR/GPT partitioning
* LVM
pvcreate --data-alignment 512 (equal to value given as chunksize) ?default? --data-alignment-offset (should not be needed for correctly aligned partitions)<br />
vgcreate -s 4M (default)<br />
* mdadm RAID
mdadm -c 512  Aligns chunksize to 512KB erase block size times 1 data disk (for raid1)<br />
mkfs.ext4 -b 4096 -E stride=128,stripe_width=128 (erase block size / 4096) (for raid1)<br />
mkfs.xfs -b 4096 -d sunit=1024,swidth=1024 OR -d su=512K,sw=512K (for raid1)
* Encrypted with dmcrypt/LUKS
cryptsetup luksFormat --align-payload 2048 (default)<br />
cryptsetup luksOpen --allow-discards<br />
<br />
File systems
* JFS is known to have drastic performance advantages over other file systems and this performance gain is amplified with solid state drives.
* EXT4
* ZFS
* Others
 
=Installation=
{{SectionNeedsUpdates}}
''(Optional) Clearing SSD Memory Cells''<br />
'''WARNING'''<br />
'''WARNING'''<br />
Avoid using dd command to overwrite data on SSD. The SSD controller has its own algorithms for allocating writes based on its internal topology. Trying to overwrite data the usual way (e.g. dd if=/dev/zero of=/dev/sda ) is not only futile but will reduce the remaining number of writes to the flash cells. To inform the controller that all data can be purged use hdparm --security-erase. <ref>https://wiki.archlinux.org/index.php/SSD_Memory_Cell_Clearing</ref><br />
Avoid using dd command to overwrite data on SSD. The SSD controller has its own algorithms for allocating writes based on its internal topology. Trying to overwrite data the usual way (e.g. dd if=/dev/zero of=/dev/sda ) is not only futile but will reduce the remaining number of writes to the flash cells. To inform the controller that all data can be purged use hdparm --security-erase. <ref>https://wiki.archlinux.org/index.php/SSD_Memory_Cell_Clearing</ref><br />
Partitioning<br />The default alignment of 1MiB provides for proper SSD performance. For gdisk, ensure each partition starts at integer multiple of 2048 (sectors). If you change gdisk's default boundary then the default for other programs may change as a result.<br />
 
LUKS<br /> cryptsetup luksFormat --align-payload 2048 (default)<br />
'''Partition creation and alignment'''<br />
cryptsetup luksOpen --allow-discards<br />
The default alignment of 1MiB provides for proper SSD performance. For gdisk, ensure each partition starts at integer multiple of 2048 (sectors). If you change gdisk's default boundary then the default for other programs may change as a result.
MDADM<br />mdadm -c 512  Aligns chunksize to 512KB erase block size times 1 data disk (for raid1)<br />
 
LVM<br />pvcreate --data-alignment 512 (equal to value given as chunksize) ?default? --data-alignment-offset (should not be needed for correctly aligned partitions)<br />
'''Create File Systems'''
vgcreate -s 4M (default)<br />
 
MKFS<br />mkfs.ext4 -b 4096 -E stride=128,stripe_width=128 (erase block size / 4096) (for raid1)<br />
'''/etc/fstab, mount'''
mkfs.xfs -b 4096 -d sunit=1024,swidth=1024 OR -d su=512K,sw=512K (for raid1)
 
=SSD Optimization=
{{SectionNeedsUpdates}}
'''compile in ram'''
 
{{file|name=/etc/portage/make.conf|desc=compile in RAM instead of on disk|body=
PORTAGE_TMPDIR="/run"
}}
 
'''Enable TRIM'''
 
'''Mount Options'''<br />
noatime
 
'''I/O Scheduler'''<br />
The Completely Fair Queuing (CFQ) scheduler queues data to minimize seeks on HDDs, which is not necessary for SSDs. Utilizing the noop or deadline scheduler can increase throughput and decrease latency on an SSD.
 
Changing the I/O scheduler can be accomplished:
 
When compiling the kernel.<br />
When starting the kernel through the boot manager configuration.<br />
Or at runtime (through the files in /proc and /sys). See sysctl for details.<br />
 
The "noop" scheduler may be a little faster in specific benchmarks that max out the throughput, but this scheduler causes noticeable delays for other tasks while large file transfers are in progress.
 
{{important|It is recommended to only change the default scheduler to noop or deadline only for non-rotating disks.}}
 
'''Run unswapped'''
{{console|body=###i## rc-update del swap boot}}
 
'''Reduce swappiness to swap partition on an SSD'''<br />
In instances where a low memory system may need to place a swap partition on an SSD; a recommended tweak is to reduce the swappiness of the system to some very low value (for example 1 or 10), thus avoiding unneccesary writes to swap.
 
{{console|body=###i## nano /etc/sysctl.conf}}
 
  vm.swappiness=1
  vm.vfs_cache_pressure=50

Latest revision as of 05:13, July 31, 2020


Solid State Drives (SSDs)...

Preparation

   Important

This section is in need of updates.

Partitioning

  • MBR/GPT partitioning
  • LVM

pvcreate --data-alignment 512 (equal to value given as chunksize) ?default? --data-alignment-offset (should not be needed for correctly aligned partitions)
vgcreate -s 4M (default)

  • mdadm RAID

mdadm -c 512 Aligns chunksize to 512KB erase block size times 1 data disk (for raid1)
mkfs.ext4 -b 4096 -E stride=128,stripe_width=128 (erase block size / 4096) (for raid1)
mkfs.xfs -b 4096 -d sunit=1024,swidth=1024 OR -d su=512K,sw=512K (for raid1)

  • Encrypted with dmcrypt/LUKS

cryptsetup luksFormat --align-payload 2048 (default)
cryptsetup luksOpen --allow-discards

File systems

  • JFS is known to have drastic performance advantages over other file systems and this performance gain is amplified with solid state drives.
  • EXT4
  • ZFS
  • Others

Installation

   Important

This section is in need of updates.

(Optional) Clearing SSD Memory Cells
WARNING
Avoid using dd command to overwrite data on SSD. The SSD controller has its own algorithms for allocating writes based on its internal topology. Trying to overwrite data the usual way (e.g. dd if=/dev/zero of=/dev/sda ) is not only futile but will reduce the remaining number of writes to the flash cells. To inform the controller that all data can be purged use hdparm --security-erase. [1]

Partition creation and alignment
The default alignment of 1MiB provides for proper SSD performance. For gdisk, ensure each partition starts at integer multiple of 2048 (sectors). If you change gdisk's default boundary then the default for other programs may change as a result.

Create File Systems

/etc/fstab, mount

SSD Optimization

   Important

This section is in need of updates.

compile in ram

   /etc/portage/make.conf - compile in RAM instead of on disk
PORTAGE_TMPDIR="/run"

Enable TRIM

Mount Options
noatime

I/O Scheduler
The Completely Fair Queuing (CFQ) scheduler queues data to minimize seeks on HDDs, which is not necessary for SSDs. Utilizing the noop or deadline scheduler can increase throughput and decrease latency on an SSD.

Changing the I/O scheduler can be accomplished:

When compiling the kernel.
When starting the kernel through the boot manager configuration.
Or at runtime (through the files in /proc and /sys). See sysctl for details.

The "noop" scheduler may be a little faster in specific benchmarks that max out the throughput, but this scheduler causes noticeable delays for other tasks while large file transfers are in progress.

   Important

It is recommended to only change the default scheduler to noop or deadline only for non-rotating disks.

Run unswapped

root # rc-update del swap boot

Reduce swappiness to swap partition on an SSD
In instances where a low memory system may need to place a swap partition on an SSD; a recommended tweak is to reduce the swappiness of the system to some very low value (for example 1 or 10), thus avoiding unneccesary writes to swap.

root # nano /etc/sysctl.conf
  vm.swappiness=1
  vm.vfs_cache_pressure=50