You are not logged in.
Yesterday, I replaced the HDD of a brand new ThinkPad T550 for a Samsung 850 Pro SSD with a capacity of 256GB. I booted the machine with archlinux-2015.04.01-dual.iso, and started setup. Formatting the main partition took several minutes, and I was greeted with a bunch of error messages. Here are the first lines, copied by hand:
root@archiso ~ # mkfs.ext4 /dev/sda2
mke2fs 1.42.12 (29-Aug-2014)
Discarding device blocks: ^@[ 1227.636537] ata1.00: exception Emask 0x0 SAct 0x2 SErr 0x0 action 0x6 frozen
[ 1227.640017] ata1.00: failed command: SEND FPDMA QUEUED
[ 1227.643537] ata1.00: cmd 64/01:08:00:00:00/00:00:00:00:00/a0 tag 1 ncq 512 out
[ 1227.643537] res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
Photo of screen:
Repeating mkfs.ext4 was instant.
In a German forum about ThinkPads someone pointed me to discussions about a kernel patch. Also one could just disable NCQ (Native Command Queuing):
echo 1 > /sys/block/sdX/device/queue_depth
How would you resolve the issue? Could this also be faulty hardware?
Hardware details:
lspci reports: 00:1f.2 SATA controller: Intel Corporation Wildcat Point-LP SATA Controller [AHCI Mode] (rev 3)
CPU: Intel Core i5-5200U (Broadwell)
Offline
For now you should avoid using trim on your drive, you should be able to enable it once kernel 4.0 hits the stable repos. However it might be a bit slow and you will probably want to do a scheduled trim on regular intervals instead of mounting your partitions with the discard option.
That problem is most probably related to queued trim and there is a blacklist in place in the 4.0 kernel not to use that[1].
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
queued trim[1].
I presume, if I disable NCQ, then this should disable queued trim. Then trim would still happen, just not via NCQ.
you will probably want to do a scheduled trim on regular intervals
Even if I only disable NCQ, do I need to schedule trims manually?
As far as I understand it, trims would still happen, just immediately, i.e. not in some optimized order scheduled by NCQ.
Offline
If you disable ncq you may incur a speed penalty and you probably want to use that only as a temporary workaround. But you are correct, if you disable ncq you will also disable queued trim.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
If you disable ncq you may incur a speed penalty
AFAIK that's negligible on SSDs. NCQ seems to be technology primarily useful for HDDs.
if you disable ncq you will also disable queued trim.
Of course. The question is if that disables trim entirely, or if I still get non-queued trim.
Offline
Just found documentation in the wiki concerning the issue. One can disable NCQ using a kernel boot parameter:
libata.force=noncq
There is no mentioning that other measures are necessary to be taken, for example scheduling manual trim.
Offline
R00KIE wrote:If you disable ncq you may incur a speed penalty
AFAIK that's negligible on SSDs. NCQ seems to be technology primarily useful for HDDs.
If I'm not mistaken I think I've read somewhere that this might not be the case, but since this is the internet it could have been completely wrong or I might have dreamt about it.
if you disable ncq you will also disable queued trim.
Of course. The question is if that disables trim entirely, or if I still get non-queued trim.
This would disable only queued trim, non-queued trim would still work.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
For someone with Samsung SSD's firmware "EXM02B6Q" - mine is 850Pro.
While installing archlinux, I cope with the same problem but only when format the first partition though installation was successful.
Once installation finished, system operates in exellent conditions.
I would suggest not to use "discard" mount flag in fstab.
Due to NCQ error in Firmware with Linux kernel see my log when using "discard" in fstab.
if using mount flag “ discard” in “fstab” then when fstrim in action your system will go freezing for a while and your hard disk 's led will shining bright at the period.
So What?
So – to enable trim without problem with those NCQ error, I use cron. https://wiki.archlinux.org/index.php/So … M_via_cron
You have to install “cronie” package and enable cronie.service via systemd –
# systemctl enable cronie.service
By creating this script – I named it “trim”
:- Credit goto http://www.webupd8.org/2013/01/enable-t … rives.html
#!/bin/sh
LOG=/var/log/trim.log
echo "*** $(date -R) *" >> $LOG
fstrim -v -a >> $LOG
save it ,then
#chmod +x trim
*Remark, I use -a option (trim all mounted filesystems that are supported) with fstrim command as all my partitions are ext4, if yours are not, please omit " -a" option and use mount point ( / or /home etc) instead.
Drop this script in to /etc/cron.daily or /etc/cron.weekly or else, whatever you like.
The above script will create a log file named trim.log in /var so you can observe. For example
* Mon, 13 Apr 2015 21:41:01 +0700 *
/home: 46.7 MiB (48930816 bytes) trimmed
/amadeus: 0 B (0 bytes) trimmed
/: 0 B (0 bytes) trimmed
* Tue, 14 Apr 2015 06:40:01 +0700 *
/home: 27.6 GiB (29660880896 bytes) trimmed
/amadeus: 19.2 GiB (20596305920 bytes) trimmed
/: 22.5 GiB (24119107584 bytes) trimmed
Any suggestions or corrections will be appreciated.
Last edited by mrlamud (2015-04-19 06:12:12)
Offline
For someone with Samsung SSD's firmware "EXM02B6Q" - mine is 850Pro.
Same firmware here, according to Samsung SSD Magician DC which runs on Linux.
Just tried booting with the libata.force=noncq, and now the errors when formatting the first partition are gone.
I would suggest not to use "discard" mount flag in fstab.
Did you try combining discard and libata.force=noncq?
Last edited by feklee (2015-04-19 08:21:04)
Offline
Did you try combining discard and libata.force=noncq?
Yes, that was the first combination I tried but problem still persists when I had already logged in DE.
So " without discard mount flag in fstab" + "Trim via cron" work fine for me.
Offline
Fstrim will use queued trim if available, so it's not a solution to the problem. It might make a good compromise though as I've read that "normal" trim can slow down the system if used with the discard option.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
I had already logged in DE.
What's DE?
Offline
What's DE?
I mean Gnome.
Offline
I mean Gnome.
I was thinking that DE is a common abbreviation for Desktop Environment, just I didn't see any connection to the SSD issue.
Anyhow, at the moment, I run without trim at all. I've read that modern SSDs include their own optimization in firmware. Furthermore the disk is oversized. Possibly only around 10% of the capacity will be used during the next months, maybe years. That means, the SSD has a lot of fresh data cells to choose from, which is beneficial for performance, as far as I understand things.
Offline
Anyhow, at the moment, I run without trim at all. I've read that modern SSDs include their own optimization in firmware. Furthermore the disk is oversized. Possibly only around 10% of the capacity will be used during the next months, maybe years. That means, the SSD has a lot of fresh data cells to choose from, which is beneficial for performance, as far as I understand things.
What kind of firmware optimization? It seems the Samsung drives are heavily reliant on OS communication to let the drive know which are old dirty cells that are okay to overwrite.
http://www.samsung.com/global/business/ … tions.html
http://www.samsung.com/global/business/ … per04.html
AFAIK that's negligible on SSDs. NCQ seems to be technology primarily useful for HDDs.
According to Wiki, NCQ in SSD would be beneficial by letting the drive do something while the CPU is busy, so I've left mine on and just removed "discard" from /etc/fstab.
I actually read about the NCQ bug on this drive. I can't believe it's real, lol. I am glad this thread got posted. And I'm thankful for R00KIE's and mrlamud's insightful post
Offline
What kind of firmware optimization? It seems the Samsung drives are heavily reliant on OS communication to let the drive know which are old dirty cells that are okay to overwrite.
I see: Only the file system knows which space on a HDD is in use and which is not.
NCQ in SSD would be beneficial by letting the drive do something while the CPU is busy, so I've left mine on and just removed "discard" from /etc/fstab.
...which won't prevent the NCQ errors. After all, I got them during creation of the file system, i.e. before the discard option was even available.
Offline
Thank you all so much! I was trying to find a solution to this problem, and disabling trim did it for me. I will post a link of this thread to another topic for reference.
Offline
disabling trim did it for me.
As I pointed out, likely you will still get NCQ errors. I did. The only solution that I see is disabling NCQ. Then you may switch from "discard" to manual trim. See the guide by @mrlamud (haven't tried it yet).
Offline