hello friends! new(ish)!

Storage devices: Difference between revisions

From InstallGentoo Wiki v2
Jump to navigation Jump to search
>Galactus
m (→‎External drives: - fixes grammar, further generalises)
>Galactus
Line 105: Line 105:
[[File:Sata-esata-enclosure-usb2-case-3-5-inch-image-4.jpg|200px|thumb|right|it's easy as plugging and playing]]
[[File:Sata-esata-enclosure-usb2-case-3-5-inch-image-4.jpg|200px|thumb|right|it's easy as plugging and playing]]
If you want an external drive for storing or backing up your data, be it an SSD or a mechanical drive, it is actually wise to instead purchase an internal drive and an external case for it. The reason being that most external drives come pre-installed with unneeded bloatware, such as cloud sync software, back-up programs and manuals. External drives may not even function like normal drives, although this is not a common occurrence.
If you want an external drive for storing or backing up your data, be it an SSD or a mechanical drive, it is actually wise to instead purchase an internal drive and an external case for it. The reason being that most external drives come pre-installed with unneeded bloatware, such as cloud sync software, back-up programs and manuals. External drives may not even function like normal drives, although this is not a common occurrence.
So by purchasing a plain old internal drive instead, you avoid the hassle of dealing with things that you normally shouldn't have to deal with when buying new drives.
So by purchasing a plain old internal drive instead, you avoid the hassle of dealing with things that you normally shouldn't have to deal with when buying new drives.


[[Category:Hardware]]
[[Category:Hardware]]
[[Category:Terms]]
[[Category:Terms]]

Revision as of 11:30, 25 March 2016

Here you will find information on the various devices which can store your data.

Primary storage

Hard Disk Drive

A 4TB Seagate Hard Drive

A Hard Disk Drive (often abbreviated HDD) is a data storage device used for storing and retrieving digital information using one or more rigid ("hard") rapidly rotating disks (platters) coated with magnetic material. Invented in 1972 by IBM under the name "Smart Drives", hard drives work by a magnetic head on an acutator arm "inscribing" (or writing) data to the platter. Think of someone writing in a book, where the pen is the magnetic head and the platter is the paper. Data is accessed in a random-access manner, meaning that individual blocks of data can be stored or retrieved in any order rather than sequentially.

The CD was invented in roughly the same time period. When it was invented, it held more data than a Hard drive. Now it is the complete reverse.

For data security, Fucko and Encryption might be of use to you.

For securely wiping data, Data Destruction might be of use to you as well.

Solid State Drive

a 2.5" solid state drive

A Solid State Drive (often abbreviated SSD) is a data storing device that stores data via flash memory as opposed to a hard drive, which uses a physical spinning disc. They can be found in both desktops and laptops. They have recently risen in popularity due to their rapid loading times. However, they are still pretty new, and because of this they are more susceptible to failures and problems than the tried and tested hard drives.

Generally, instead of being used to store all of a user's data, solid state drives are used to store the operating system, while a hard drive is used to store additional data. Files which require frequent loading (e.g. commonly used applications/games) are best suited to an SSD, whereas occasionally accessed files (e.g. your pirated movie collection) will just waste the precious SSD space.

Encryption and sanitization is an issue on SSDs as operating systems can never be certain where their data is being written to. The firmware on SSD drives includes wear levelling, which both extends the life of the drive and abstracts the physical location of any data stored.

Picking an SSD

When shopping for an SSD one must realize that, as the price point goes up, so does the quality of the NAND flash memory, the flash controller and so on, although probably not linearly.

NAND flash memory types

TLC (three-level cell)

  • Typically the lowest performing, with the lowest endurance and reliability;
  • 3-5,000 erase cycles per cell;
  • By far the cheapest.

MLC (multi-level cell)

  • Medium range performance, endurance, and reliability;
  • 10,000 erase cycles per cell;
  • Generally available on medium/high-end consumer grade SSDs as it is only marginally more expensive than TLC.

eMLC (enterprise multi-level cell)

  • Slightly improved version of MLC NAND;
  • 20-30,000 erase cycles per cell.

SLC (single-level cell)

  • Highest performance, cost, endurance, and reliability;
  • 90-100,000 erase cycles;
  • Lowest power consumption.

As far as density goes, it's TLC (3-bits) > MLC = eMLC (2-bits) > SLC (1-bit). The lower the density, the higher the endurance. Similarly, the higher the capacity, the higher the longevity due to an increased amount of cells.

Wear-levelling

Flash controllers manage the data stored on the flash memory by keeping track of the movement of data across segments in order to ensure erasures and re-writes are distributed evenly, preventing any one cell from reaching its write /erase ceiling before the others, which still happens, but it mitigates the issue. Generally speaking, more expensive consumer-grade models tend to have more expensive flash NAND, like MLC, as well as higher quality flash controllers*.

* - Crucial being the exception to the rule, as their SSD lineup ONLY features MLC NAND flash whilst being affordable.

Encryption support

Most SSDs offer builtin hardware encryption—supporting OPAL, the IEEE 1667 spec, SED (self-encrypting drives), and so on, depending on the brand and the SSD. Be careful when picking one based on this, as encryption is hard to implement properly.

Tweaks

TRIM

TRIM lets an OS know which SSD blocks are not being used and can be cleared. Not doing this will force the SSD to TRIM the space it wants to write to RIGHT before writing the data, every single time there's a block of non-indexed data (which is what happens when one deletes a file).

Unix-like

To enable TRIM, create a cron job as follows:

# echo -e "#\x21/bin/sh\\nfstrim -v /" | sudo tee /etc/cron.daily/trim
# chmod +x /etc/cron.daily/trim
Windows

To check if TRIM is enabled, simply run fsutil behavior query DisableDeleteNotify—0 means it's enabled, 1 means it's disabled. If it's disabled, run fsutil behavior set DisableDeleteNotify 0 to turn it on.

Hibernation

Disable hibernation as it not only is unstable, it will also result in lots of extra writes to one's SSD.

Cache to RAM

Make most apps cache to RAM. Those that don't support it by default, can be forced to, by using a RAMdisk that copies the cache from disc to RAM, symlinks it, and then copies it back to the main drive every n seconds (Linux's anything-sync-daemon, for instance).

Swap

Disable it completely if you have RAM to spare, depending on your use case. Alternatively, keep it VERY low, as some software can malfunction if it fails to detect a swap partition.

Linux specific
fstab tweals

Use the noatime mount option in /etc/fstab for every ext4 SSD partitions. Noatime is a mount option in linux. which disables atime updates on the file system. By adding noatime to your fstab, you greatly reduce SSD load, which translates to longer SSD life and even performance gains.

tmpfs

Mount /tmp as tmpfs in /etc/fstab, if your kernel supports it, by issuing shm /dev/shm tmpfs nodev,nosuid,noexec 0 0.

sysctl tweaks

sysctl is used to modify kernel parameters at runtime. In order to configure it, access /etc/sysctl.conf. To prevent wear, we are going to increase the cache, reduce swappiness, and try to keep things in the OS page cache in memory for longer.

vm.dirty_background_ratio = 10 // percentage of memory pages that still need to be written to disk, keep it somewhat low to prevent heavy disk I/O
vm.dirty_ratio = 60 // the percentage of total system memory to store dirty pages (vm.dirty_ratio will allow kernel to flush dirty data to disk less often with bigger writes, though net size of said writes remains unchanged)
vm.dirty_writeback_centisecs = 500 // is how often the pdflush/flush/kdmflush processes wake up and check to see if work needs to be done
vm.dirty_expire_centisecs = 3000 // how many seconds something can be in cache before it needs to be written
vm.swappiness = 5

The con to keeping things in the OS page cache in memory for longer is that you run an increased risk of data loss/corruption in case of an abrupt loss of power, as RAM is volatile. If you value your data, keep that number low.

Secondary storage

External drives

it's easy as plugging and playing

If you want an external drive for storing or backing up your data, be it an SSD or a mechanical drive, it is actually wise to instead purchase an internal drive and an external case for it. The reason being that most external drives come pre-installed with unneeded bloatware, such as cloud sync software, back-up programs and manuals. External drives may not even function like normal drives, although this is not a common occurrence.

So by purchasing a plain old internal drive instead, you avoid the hassle of dealing with things that you normally shouldn't have to deal with when buying new drives.