Debian SSD Installation Considerations

Kernels & Hardware, configuring network, installing services

Debian SSD Installation Considerations

Postby broadsworde » 2017-04-17 13:15

I have checked forums, documentation and the internet in general, but have been unable to find instruction on preparation, installation and post-installation requirements or recommendations for SSD installs. I did find documentation on cloning an existing install to a new SDD (https://wiki.debian.org/SSD%20Installation), but it doesn't address a new install.

I aim to gather all associated knowledge in this post.


- BIOS/UEFI
Enable Advanced Host Controller Interface (AHCI) for SATA
Enable SATA Gen 3 if your SSD is compatible

Does a default Debian install take care of necessary configurations required or recommended for an SSD?

- Overprovisioning: unallocated space at the end of the disk to improve performance and life expectancy. Some SSDs may already be overprovisioned by the manufacturer, and the unallocated space cannot be accessed or controlled by the user. Does the Debian install process detect manufacturer overprovisioning, and if not detected does it leave appropriate unallocated space (circa 7%) at the end of the disk?
Additional overprovisioning using Host Protected Area (HPA) can be set and viewed using hdparm, but this is deemed very dangerous so caution is advised.

- Write Cache: reduce disk writes by caching data into chunks before writing to disk. Is write cache automatically set if SSD detected?
View status:
Code: Select all
$ hdparm -W /dev/sda

/dev/sda:
 write-caching =  1 (on)

Set On:
Code: Select all
$ hdparm -W1 /dev/sda

/dev/sda:
 setting drive write-caching to 1 (on)
 write-caching =  1 (on)


- Reduce SWAP Wear: reduce disk writes by minimizing use of SWAP space (partition or file). Is swappiness automatically set to an appropriate low level (depending on available memory) if SSD is detected?
Adjust Swappiness, to 0 if plenty of memory available, or circa 10 if a more modest amount of memory is available:
Code: Select all
sudo nano /etc/sysctl.conf

Add the following lines to the bottom of the page:
Code: Select all
# Reduce Swap wear on SSD
vm.swappiness=10

Save and close: Ctrl+X, then S, then Return
Apply new swappiness setting:
Code: Select all
sudo sysctl -p


- Disable Access Time Logging: reduce disk writes by disabling logging when files are accessed (not when modified). Is access time logging automatically disabled if SSD is detected?
Disable Access Time Logging:
Code: Select all
sudo nano /etc/fstab

Example:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during installation
UUID=3ff45354-9769-4b6a-b861-bab7160da035 / ext4 noatime,errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=5317-83C5 /boot/efi vfat umask=0077 0 1
# swap was on /dev/sda3 during installation
UUID=78942381-33c1-44e8-8257-9b414d14d194 none swap sw 0 0


In this example noatime is added to the options for root (/).
(You should not set noatime for boot/efi or swap partitions)
Save and close: Ctrl+X, then S, then Return

- Enable Daily/Weekly TRIM: to ensure SSD speed remains fast over time: Is a daily/weekly (documentation varies on which is best for SSDs) TRIM automatically set if SSD detected?
To enable daily/weekly TRIM using CRON (if not already present):
Save the following script as fstrim in either the /etc/cron.weekly/ or /etc/cron.daily/ folder
Code: Select all
#!/bin/sh
# trim all mounted file systems which support it
/sbin/fstrim --all || true


Are there any SSD specific considerations I've missed?

Thank you.
broadsworde
 
Posts: 19
Joined: 2017-03-01 13:50

Re: Debian SSD Installation Considerations

Postby phenest » 2017-04-17 19:33

You've misunderstood "overprovisioning". This is an SSD feature that cannot be detected, and it's not meant to be. The idea is so you don't need to leave empty space on the drive. It's purpose is to eliminate the need for TRIM, so the SSD has space to deal with new data so that TRIM doesn't become an urgent matter, enabling it to deal with TRIM in its own time without affecting performance (usually during idle moments). It's not part of the drive's capacity.

As for Swap, I always say that if you have enough RAM, don't bother with Swap. But that's each individual's call.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Debian SSD Installation Considerations

Postby Head_on_a_Stick » 2017-04-17 22:48

broadsworde wrote:I have checked forums, documentation and the internet in general, but have been unable to find instruction on preparation, installation and post-installation requirements or recommendations for SSD installs.

This is utter nonsense, I myself have answered every single one of your questions on these very boards several times...

Please endeavour to improve your search-fu, it will benefit you immensely.

I will note that all of the recommendations in your OP are completely unnecessary with modern production SSDs and constitute obsolete advice, IMO.

In respect of TRIM, see viewtopic.php?f=16&t=130965

Guess you need a better search engine, eh?

:roll:
"Are you quite sure that all those bells and whistles, all those wonderful facilities of your so called powerful programming languages, belong to the solution set rather than the problem set?" — Edsger W. Dijkstra
User avatar
Head_on_a_Stick
 
Posts: 6578
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian SSD Installation Considerations

Postby broadsworde » 2017-04-18 07:07

Thank you for the feedback Head_on_a_Stick and phenest, I really am just trying to help.

Samsung Support in response to information request for my particular SSD (850 EVO 120GB) advised the following, and I quote:
I have received feedback from our HQ.
We're sorry not to let you know detailed informations about how to setup the SSD in various OS and hardware conditions.
These are our recommendations for setting up the SSD
- Trim
- SATA Gen3 port
- Overprovisioning with unallocated area, But unallocated area's density can be depending on customer's usage workload
- Write cache enable


Additionally both Samsung and Kingston documentation online indicated that the manufacturer created overprovisioning was not a given for all manufacturers and drives:
http://www.kingston.com/us/ssd/overprovisioning
http://www.samsung.com/semiconductor/minisite/ssd/downloads/document/Samsung_SSD_845DC_04_Over-provisioning.pdf

If you don't believe it would be useful, specially to newer Debian users, to gather such information together, I'll leave it here.
broadsworde
 
Posts: 19
Joined: 2017-03-01 13:50

Re: Debian SSD Installation Considerations

Postby pylkko » 2017-04-18 07:50

phenest wrote:You've misunderstood "overprovisioning". This is an SSD feature that cannot be detected, and it's not meant to be. The idea is so you don't need to leave empty space on the drive. It's purpose is to eliminate the need for TRIM, so the SSD has space to deal with new data so that TRIM doesn't become an urgent matter, enabling it to deal with TRIM in its own time without affecting performance (usually during idle moments). It's not part of the drive's capacity.

As for Swap, I always say that if you have enough RAM, don't bother with Swap. But that's each individual's call.

What you say is only half true. Most modern drives do indeed have an area of space provisioned to the drive that is not accessible to the OS. However, the user can nevertheless leave additional unprovisioned space by leaving unallocated space on the drive.

http://www.seagate.com/gb/en/tech-insights/ssd-over-provisioning-benefits-master-ti/ wrote:Some SSD manufacturers provide software tools to allow for over-provisioning of drives by the user. Actually, even without special software, any user can set aside a portion of the SSD when first setting it up in the system by creating a partition that does not use the drive’s full capacity. This unclaimed space will automatically be used by the controller as dynamic over-provisioning

ibid wrote:The minimum amount of over-provisioning for an SSD is set at the factory, but users can allocate more space for better performance.

I also don't believe that the 7% hardware overprovisioning is there to "eliminate the need for TRIM"...
ibid wrote:An SSD does not natively know which blocks of data are invalid and available for replacing with new data. Only when the operating system (OS) tries to store new data in a previously used location does the SSD know that a particular location contains invalid data. All free space not consumed by the user becomes available to hold whatever the SSD believes is valid data. This is why the storage industry created the TRIM command. TRIM enables the OS to alert the SSD about pages that now contain unneeded data so they can be tagged as invalid. When this is done, the pages do not need to be copied during garbage collection and wear leveling. This reduces write amplification and improves performance

Also, wrt to swap, you might need it for hibernation even if you don't need it for memory.
User avatar
pylkko
 
Posts: 1108
Joined: 2014-11-06 19:02

Re: Debian SSD Installation Considerations

Postby broadsworde » 2017-04-18 13:22

Thanks for that pylkko.

Quick update on over-provisioning: following the differences of opinion on this subject I wrote again to Samsung regarding my "modern production SSD" (Samsung 850 EVO 120Gb) for clarification, and have just received this response:
850 EVO is a end user SSD for end user PC, Windows or Mac OS.

But you have whole capacity of this SSD 111 Gb.
On this SSD OP is not set, you can do it and set it up, but you can not do it with Magician.
You can do it manually with your OS.

Thank you very much and a pleasant day.
For further questions please do not hesitate to contact us.

So manufacturer over-provisioning cannot be assumed.

On the subject of SWAP and hibernation/suspension, I totally take your point. I personally disable suspension/hibernation as a choice, but it's definitely a valid consideration I missed. I will update/correct the original post if that is viewed as sensible or worth while.

Head_on_a_Stick, thank you for your link to the post you did on "Solid State Drives and TRIM in Debian", I totally get this approach is better than Cron, and have updated my knowledge and personal notes accordingly.
broadsworde
 
Posts: 19
Joined: 2017-03-01 13:50

Re: Debian SSD Installation Considerations

Postby pylkko » 2017-04-18 18:18

Just to be clear, suspension does not require swap, because it writes a compressed image of the machine into RAM. However, since hibernation does this on the disk (SSD here), you need either a swap partition or a swap file.
User avatar
pylkko
 
Posts: 1108
Joined: 2014-11-06 19:02


Return to System configuration

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable