I am going to put a used SSD into a server to boot from it and hold the OS itself, while making a RAID1 from two other HDDs.
Since the SSD has been used, do I need to trim it beforehand and how? Or do I just shove it in the server and use it right away?
I agree with Michael Hampton that a secure erase is in order to make any previous data inaccessible. There is a secure delete operation in the ATA spec, which can be run on Linux with
hdparm --security-erase-enhanced
This might just change an encryption key, which is fast but not guaranteed to discard the blocks.Commands also exist to discard the entire block device, to remove any write amplification effect from erased data. Again for Linux,
blkdiscard
. There is a --secure option to also erase blocks, but as the man page notes "This requires support from the device."Finally, just "quick" formatting a file system will make "empty" usable space. However, you don't have the security benefits of secure erase, nor the performance benefits of discarding everything. Despite continuous and periodic trim available on several operating systems, it is more optimal to unmap the entire device before a new file system is laid down. Blocks with half old data, half new data either won't be erased or have to be written somewhere else then erased.