I need to configure a RAID-1 on one SSD and one HDD. Both SSD and HDD has some preinstalled software, which I don't need so both can be fully wiped if that is any advantage.
My research so far lead me to the --write-mostly
option, which I understand that I should be using on the HDD such that read operations will get the full speed of the SSD.
But it is not clear to me, how to ensure the TRIM command is properly used.
I read warnings about mdadm writing to every sector of the device during setup leaving the SSD with no spare sectors regardless of any TRIM performed before setting up the raid.
Am I better off first creating the RAID degraded with the SSD as the only device and then adding the HDD, such that only the HDD gets written to?
What would I need to do to the SSD before setting up the RAID, such that any needed TRIM has been performed? The SSD has preinstalled software (that I don't need), which means I don't know which sectors has been previously written.
In case it is of any relevance, the SSD is 128GB and is in dmesg output mentioned as SAMSUNG MZ7LF128HCP-00000, FXT0101Q
by the ata layer and SAMSUNG MZ7LF128 101Q PQ
by the sd layer.
--assume-clean
, you can just specify the SSD as the first drive, and it will be copied to the HDD instead of the other way around. You also don't really need TRIM as long as you leave a few gb of the drive unpartitioned so you never write to it. – psusi Oct 11 '15 at 18:28mkfs
can only do the TRIM if I am using a sufficiently recent version ofmkfs
and of themd
driver. How can I tell ifmkfs
andmd
driver are recent enough to do the TRIM for me? (Your point about replacing a drive later on is a good one. But I am not going to worry about that for the time being.) – kasperd Oct 11 '15 at 20:264.x
;-) – frostschutz Oct 11 '15 at 20:29mkfs
command supports it. But how about themd
driver? – kasperd Oct 11 '15 at 20:32mkfs.ext3
man page mentions bothdiscard
andnodiscard
options, so that looks good. The install image I am planning on using (Ubuntu 14.04.3) has kernel version 3.19.0. So I am still wondering if that kernel version has anmd
driver new enough to pass on the TRIM commands frommkfs
to the physical drive. – kasperd Oct 11 '15 at 20:44hdparm
secure erase. – psusi Oct 12 '15 at 02:12hdparm
has options--trim-sector-ranges
,--security-erase
, and--security-erase-enhanced
. The man page says all of them are dangerous, but it doesn't say clearly what is so dangerous about them. A TRIM command on the entire drive effectively erasing all data from the drive is fine for me at this point. But the man page doesn't make it clear if that's the only reason they are flagged as dangerous.--trim-sector-ranges
sounds like the correct argument for me to use. – kasperd Oct 12 '15 at 08:53blkdiscard
is much easier thanhdparm
for trimming entire block devices, but it's a relatively new command that may not yet be available for long-term-stable distros. Even so, you could run it from a current Ubuntu or SystemRescueCD. – frostschutz Oct 12 '15 at 16:30--trim-sector-ranges
than for the secure erase commands. If I can figure out who wrote the warning in the first place, I'll ask them what was the reasoning behind the wording of that warning. – kasperd Oct 12 '15 at 19:01blkdiscard
andhdparm --trim-sector-ranges
just in UI? Or is there a difference in what low-level commands they send to the drive? – kasperd Oct 12 '15 at 19:03