Re: Slow writes to disk
On 11/2/18 5:31 AM, Stefan Monnier wrote:
For a while now I noticed that aptitude is very slow on one of my
machine (Thinkpad T61) running Debian testing. At first I thought it
was because its disk (a fairly old 120GB SSD) was suffering from some
kind of problem, so I replaced it with an almost new 240GB Samsung 840.
It seemed to bet better at first, but maybe it was just an impression.
In any case, now it's definitely very slow. Digging more into it,
I found out that part of the problem seems to be very slow writes to
the disk. I can reproduce tests where `dd`ing a 40MB file proceeds at
the ridiculous speed of about 500KB/s (tho sometimes the speed is much
I've been using SSD drives on most of my machines for many years now,
and it's the first time I notice such a slow performance. `smartctl`
shows that the drive an not registered any errors at all and has a "wear
leveling" of 18.
I figured maybe the drive is having trouble for lack of free space which
leads to high load on the "GC", so I did a `fstrim` on / and /home
(both on LVM), which took a bit of time and returned without any
message, which I took to be a positive sign that it managed to do what
it's supposed to. But it made no difference to the performance.
1. Backup your data and configuration settings.
2. Run the following commands as root and paste your console session
(prompt, commands, output) into a reply:
For the /dev/sdX that corresponds to the "240 GB Samsung 840" (replace
sdX with the correct letter):
smartctl -i /dev/sdX
3. Download and run the manufacturer's diagnostic utility (Windows may
If the tool reports the drive is bad, RMA or recycle it.
4. Most likely, the manufacturer diagnostic will say the drive is good.
This means the the problem is software -- e.g. bugs, misconfiguration,
incompatible packages, cruft, gremlins, etc.. Find a disk benchmarking
tool. I use dbench:
Install and run it. Post the summary at the end. For example:
dbench -D /mnt/sda4 10 | tee dbench-i72600s-debian-7-amd64-btrfs.out
Operation Count AvgLat MaxLat
NTCreateX 23414985 0.018 21.010
Close 17200117 0.001 2.229
Rename 991488 0.116 21.193
Unlink 4728380 0.093 21.652
Deltree 600 5.621 22.280
Mkdir 300 0.003 0.024
Qpathinfo 21223225 0.009 6.276
Qfileinfo 3719536 0.001 2.636
Qfsinfo 3891488 0.005 2.656
Sfileinfo 1907346 0.006 8.431
Find 8205416 0.034 12.780
WriteX 11675714 0.018 20.792
ReadX 36703998 0.004 8.348
LockX 76244 0.003 0.302
UnlockX 76244 0.002 0.276
Flush 1641062 2.368 51.611
Throughput 1225.6 MB/sec 10 clients 10 procs max_latency=51.617 ms
Look in dmesg and /var/log/* for errors, warnings, or other clues. Post
anything that looks useful.