Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Linux and SSD Discussions
New Posts  All Forums:Forum Nav:

Linux and SSD Discussions - Page 3

post #21 of 43
Quote:
Originally Posted by mdatmo View Post

Even when an SSD is filled with data, there is still some spare area (on most SSDs between ~10-30%) that is used for wear leveling and to replace bad blocks.
Without a spare area I could see the danger in competently filling the drive as bad blocks couldn't be mapped to different areas.
That would make a lot of sense actually. I hadn't considered the issue of bad sectors.
Quote:
Originally Posted by KhaoticKomputing View Post

Yay, some one mentioned it. You shouldn't jam SSD's full. In order to assure that one sector isn't favored over another they are constantly shuffling data around to even the load. Less free space on the drive means less space it has to shuffle data in turn causing sector's to be use'd more frequently than other's. End result you will see error's, loss of performance, ect if you jam it full.
But as I said earlier, this is assuming that users that fill their SSD then delete data so they can fill again, are constantly deleting and recycling the same files while the remainder of the space is static. Which I can see most users perhaps falling into this category when it comes to conventional storage (ie on a NAS, you'll have some music, videos and pictures that you don't want deleted and will fill and remove the rest of the crap on an as and when basis). However SSDs are typically used for OS installs where space tends to get filled and deleted a bit more randomly anyway. So I'm not as convinced that the load balancing issue of recommending ~30% free space is really that important. I think normal wear would be sufficiently random that having 30% free space just for load balancing is somewhat redundant.

At least that's the logic I'm using as I'm constantly filling my SSD then clearing data right down laugher.gif
Quote:
Originally Posted by Transhour View Post

I don't think TRIM itself moves anything, it just tells the ssd which sectors are no longer in use.
Indeed. Deleting data is still technically classed as a write. Thus what TRIM does just allows that memory location to be marked as free without using a write.
Edited by Plan9 - 8/22/12 at 1:09am
post #22 of 43
Quote:
Originally Posted by Plan9 View Post

I've not heard this advice before. Dumb question, but why does that increase the life of your drive?

Some others have already explained it, at least in part.

SSDs have a limited number of writes per memory space, around 3,000 has been mentioned in several sources. Enterprise SSDs that are installed as PCIe cards or other form factors often have more writes.

The SSD works in memory pages. Each write is done on one or more page of usually 4K Bytes. The SSD can't write less than this amount of data.

Let's assume we edit a small file (for example the /etc/fstab file) which has perhaps 500 bytes. We open it in our favorite editor, add discard and noatime somewhere appropriate, and save it back. Here comes the interesting part - it's not written back! The edited file is actually written into another (empty or erased) 4k page. The old memory page with the old file is still there, but the memory controller needs to make this page available for future writes.

The memory controller also tries to even out the number of writes per page, so that no one (or multiple) pages have significantly higher number of writes than others.

Because of the necessity to write the data to different blocks the SSD usually reserves some space to handle that. In the above example we talked about a tiny file, but what about a 1Gig file that has been modified? The SSD memory controller would need to find that space to save the file back.

To make it short, it's advisable to not use the entire SSD disk and leave some empty space. It prolongs the life span of the SSD and improves performance over time.

WARNING: I'm no expert in SSD technology, I've just read a lot about this topic to get a better understanding. There is a lot of sometimes contradicting information on the Internet, and figures regarding the maximum number of writes, for example, may vary. The technical vocabulary I used may be incorrect at times, but I hope I understood and described the basic concepts.

Here some quotes from Wikipedia (though the above is not based on it) - see http://en.wikipedia.org/wiki/Solid-state_drive for more:

"SSD write performance is significantly impacted by the availability of free, programmable blocks. Previously written data blocks no longer in use can be reclaimed by TRIM; however, even with TRIM, fewer free blocks cause slower performance."

"NAND flash memory cannot be overwritten, but has to be rewritten to previously erased blocks."

"Linux systems
The Linux kernel supports the TRIM function starting with version 2.6.33. The ext4 and Btrfs (experimental) file systems are supported when mounted using the discard parameter. Linux distributions usually do not set this kind of configuration automatically during installation. This is because of the notion that the operating system might after all not use the disk optimally when configured as such. The disk utilities take care of proper partition alignment."

"While not a file system feature, operating systems must also align partitions correctly to avoid excessive read-modify-write cycles. Other features such as defragmentation, designed for hard disk drives, are disabled in SSD installations."

And here some more in-depth explanations: http://arstechnica.com/information-technology/2012/06/inside-the-ssd-revolution-how-solid-state-disks-really-work

"Over-provisioning is done on most consumer SSDs today and on all enterprise SSDs, with the amount varying depending on the type and model of drive. Consumer SSDs that list "120 GB" of capacity generally have 128GB of actual NAND inside, for example; over-provisioning in the enterprise space is generally much larger, with some drives having as much as 100% additional capacity inside. Over-provisioning provides some breathing room so that there can potentially be free pages available to receive writes even if the drive is nearing capacity; additionally, in the event that some cells wear out prematurely or go bad, over-provisioning means that those bad cells can be permanently marked as unusable without a visible decrease in the drive's capacity. It's also possible to emulate the beneficial effects of over-provisioning by simply using less than the stated capacity of an SSD—for example, by purchasing a 90GB SSD, creating a 30GB partition, and leaving the rest unallocated. The controller itself doesn't care about the logical constructs built by the operating system—it will happily continue to write to new fresh pages as long as they're available."
post #23 of 43
Yeah, as I've said before, I understand the principles of the limited writes et al. what I hadn't realised was that when you re-save a file, it doesn't overwrite the existing one. So the answer to my question is that the 70% figure isn't based on estimated usages (ie creating and deleting data), it's based on the fact that every write (be that an update or new data), is spread across free blocks.

thanks for the information mate smile.gif
post #24 of 43
@Plan9

I think the term you are looking for is "Copy on Write" or CoW. ZFS does something similar. smile.gif
Ryzen
(12 items)
 
  
CPUMotherboardGraphicsRAM
Ryzen 7 1700 Gigabyte GA-AB350M Gaming 3 Palit GT-430 Corsair Vengeance LPX CMK16GX4M2B3000C15 
Hard DriveCoolingOSMonitor
Samsung 850 EVO AMD Wraith Spire Linux Mint 18.x Dell UltraSharp U2414H 
KeyboardPowerCaseMouse
Dell SK-8185 Thermaltake ToughPower 850W Lian-Li PC-A04B Logitech Trackman Wheel 
  hide details  
Reply
Ryzen
(12 items)
 
  
CPUMotherboardGraphicsRAM
Ryzen 7 1700 Gigabyte GA-AB350M Gaming 3 Palit GT-430 Corsair Vengeance LPX CMK16GX4M2B3000C15 
Hard DriveCoolingOSMonitor
Samsung 850 EVO AMD Wraith Spire Linux Mint 18.x Dell UltraSharp U2414H 
KeyboardPowerCaseMouse
Dell SK-8185 Thermaltake ToughPower 850W Lian-Li PC-A04B Logitech Trackman Wheel 
  hide details  
Reply
post #25 of 43
Quote:
Originally Posted by parityboy View Post

@Plan9
I think the term you are looking for is "Copy on Write" or CoW. ZFS does something similar. smile.gif
I'd not heard that term before. Thank you +rep
post #26 of 43
Quote:
Originally Posted by parityboy View Post

@Plan9
I think the term you are looking for is "Copy on Write" or CoW. ZFS does something similar. smile.gif

If I remember correctly, "copy on write" was developed for a different purpose, namely data integrity. This has nothing to do with SSD NAND technology, which just cannot write to the same memory location, because of the physics underneath the process. In a "copy on write" situation, if you have a power outage during write, the original data is still there and can be accessed or recovered, so all you loose are the changes. I don't see this with SSD NAND technology, though it may be possible to recover the original data.

The problem with SSD failures is that the data is all over the place. You don't necessarily have consecutive pages for a file. Each page of a file may be at any random page of SSD memory. Some may be consecutively stored, but others at varying places. This makes an SSD failure much more difficult to recover, if at all.

If you have critical data stored on an SSD, make sure to have a backup!!! Though the same is true for regular HDDs, there is a better chance of recovering data when things go bad.
post #27 of 43
Quote:
Originally Posted by Transhour View Post

I don't think we are confused about why it is needed, I think we are concerned about the size that is required for it. 30% is a lot of a space we are talking about. Are we talking about total drive, or every partition, cause i run a 3 partition setup (/, /boot, /home). My root partition is 30 GB, we are talking 10 GB of potentially wasted space. /boot is 2 GB, and /home is the remainder (about 90GB on a 128 GB ssd).  I currently have each partition setup to reserve 5% of all space for the super user, so it wont fill up. I personally think 30% is way too much, and in a lot of cases, 5% is too much as well.

Forget partitions and spare space on the partitions, they are not relevant to SSD wear. An SSD doesn't look at the partitions to write data to its memory pages or blocks. The SSD memory controller is primarily concerned with its limited number of write cycles. It will do wear-levelling across the entire available memory.

Take for example a typical 120GB SSD. Does it have 120GB of storage? No! It has normally 128GB of storage, but you - the user - can only use or fill up 120GB. The remaining 8GB of memory are used to write back files as you can't overwrite existing files! Any edit operation on a file, when you write back, it's written to a different memory location. NAND technology doesn't allow to write back to the same memory location, that's it!

Once a memory location has reached it's maximum number of writes, the controller marks it as unusable and stops using it.

So, you could use a 120GB SSD and only use a 10GB partition with the effect that you would greatly increase the life time of the SSD, since its controller would still use the entire 128GB of memory and spread the writes to that entire space for wear-levelling (and performance). The 3,000 write cycles won't be restricted to the 10GB you partitioned! You could get somewhere around 3,000x12 (12 since you use only 1/12th of the disk space) write cycles for your partition, or 48,000 write cycles. So, in essence, leaving some spare space on the SSD ensures performance and increases its life time.

Another way to increase performance and life time is to use an enterprise SSD. But that isn't usually required for personal use, if you have enough RAM installed and don't use the SSD to maximum capacity. What's the difference between usual (consumer grade) SSDs and enterprise SSDs (though "enterprise" SSDs have no standardization and performance may vary)?

  • Consumer SSDs come with a SATA connector and are installed the same way as a normal HDD. A 120GB SSD will have usually 128GB of memory, the excess 8GB being used for wear-levelling and for writing back data when you reached the maximum capacity of the SDD (120GB). They usually use MLC technology (Multi-Level-Cell) which offers around 3,000 write cycles per memory unit.
  • Enterprise SSDs normally use a different technology called SLC (or Single-Level-Cell) - see here for more on both MLC and SLC: http://arstechnica.com/information-technology/2012/06/inside-the-ssd-revolution-how-solid-state-disks-really-work/3/
    They also have more "spare" memory, somewhere between 30-100% more. SLC allows somewhere around 10,000 write cycles per memory unit. It's also faster. More write cycles combined with more "over-provisioning" of memory (some up to 100%) provide a much improved life time, which is essential in enterprise servers, web servers, and cloud computing applications where data gets changed frequently. Enterprise SSDs usually come in a different form factor (i.e. not like SATA drives), such as PCIe cards or storage trays for racks.

RAM versus SSD:

If you don't have sufficient RAM the computer needs to free memory to disk to make memory available to your applications. You will see that the swap disk will be used. This is bad for SSDs as it means excessive write cycles. So before spending a few hundred $$$ on an SSD disk increase your RAM (that may cost you only $$). There is no use in putting an SSD into a 1 or 2GG system that needs to constantly swap memory onto SSD. So the first step is to upgrade the RAM and only then use an SSD.
Edited by powerhouse - 8/23/12 at 8:08am
post #28 of 43
powerhouse: Your contributions in here have been amongst the most informative posts I think I've ever read on OCN!
post #29 of 43
@powerhouse

I used the term "Copy on Write" precisely because the new data isn't written to the same location on the SSD as the old data, unlike a hard disk. I know that systems like ZFS do CoW at the filesystem level, which is indeed a different thing. In fact the behaviour of NAND is a cause for concern for security people precisely because the data isn't overwritten in the same way as a hard disk.

CoW might not be the best term to use for SSDs, but it's the only term I could think of that would fit. tongue.gif
Ryzen
(12 items)
 
  
CPUMotherboardGraphicsRAM
Ryzen 7 1700 Gigabyte GA-AB350M Gaming 3 Palit GT-430 Corsair Vengeance LPX CMK16GX4M2B3000C15 
Hard DriveCoolingOSMonitor
Samsung 850 EVO AMD Wraith Spire Linux Mint 18.x Dell UltraSharp U2414H 
KeyboardPowerCaseMouse
Dell SK-8185 Thermaltake ToughPower 850W Lian-Li PC-A04B Logitech Trackman Wheel 
  hide details  
Reply
Ryzen
(12 items)
 
  
CPUMotherboardGraphicsRAM
Ryzen 7 1700 Gigabyte GA-AB350M Gaming 3 Palit GT-430 Corsair Vengeance LPX CMK16GX4M2B3000C15 
Hard DriveCoolingOSMonitor
Samsung 850 EVO AMD Wraith Spire Linux Mint 18.x Dell UltraSharp U2414H 
KeyboardPowerCaseMouse
Dell SK-8185 Thermaltake ToughPower 850W Lian-Li PC-A04B Logitech Trackman Wheel 
  hide details  
Reply
post #30 of 43
Thread Starter 

thanks powerhouse, indeed insightful, @parityboy, I love the fact its called "CoW", cause apt has special Cow powers :)

Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Linux and SSD Discussions