System lag writing on SSD with LUKS

14 risposte [Ultimo contenuto]
teodorescup

I am a member!

Offline
Iscritto: 01/04/2011

Writing more than 1 GiB or so, of random data or regular files on an SSD results in system lag. The partitioning is xfs inside of LUKS.
Any idea would be welcomed.

moxalt
Offline
Iscritto: 06/19/2015

Define 'system lag'.

teodorescup

I am a member!

Offline
Iscritto: 01/04/2011

System freezes, slow cursor movement and overall responsiveness.
Did I misspelled ?

moxalt
Offline
Iscritto: 06/19/2015

I was then going to ask what you were copying, from where, and to where, but it
seems the others got to you first. What is your exact setup? From your
description, it seems you have / on your HDD. What do you have on your SSD? Or
do you just keep it as a misc. data drive, and not actually in the filesystem?
Also, are you recursively copying / to the SSD? Why?

Hate to not actually present any constructive solutions, but what happens when
you copy one of the 2GB files, then wait a bit, and copy the second, as opposed
to doing everything consecutively? Finally, why are you using xfs?

vita_cell
Offline
Iscritto: 07/19/2015

Can be encrypted? I am with a "NO NAME" chinese ssd and no problem.

teodorescup

I am a member!

Offline
Iscritto: 01/04/2011

I am not aware of any hardware encryption feature on the model.
Xfs has the discard option enabled as advised by xfs.org .

antiesnob
Offline
Iscritto: 08/22/2013

Hello. Buy an HDD. That's the best you can do. SSDs are not what they say they are. The root for marketing, politics, etc. is to convince; to lie, in other words.
SSDs are not well prepared for writing but for access and above all for CACHE.

I think of 2 options:

1- SSD has the OS and you can put the /home in the HDD. Use ext4 without journaling in the SSD and u can use xfs or ext4 in the HDD. The system will be boost with this.

2- It may be that your installation was "craped" and you need to reinstall (never heard of this on linux but I know it happened in sum Windows PCs but the rate is nothing). It may be due to the cache for the SSD stuff is broken or something.

Anyways, some questions:

a) Which kernel version r u using?
b) hOW MANY FILES ARE THOSE 1GB? And directories?
c) R u copying from where to where?
d) You should check your cables. It may be that. If it is a cables issue, it is for sure the power conector (molex). But try replacing both (on every Disk that is beeing used for your copying)
e) Please, post the components of your PC/NB and don't forget to mention the power supply model number.

teodorescup

I am a member!

Offline
Iscritto: 01/04/2011

I also have and HDD which works surprisingly good considering it's 5400RPM.

To answer your questions:
a) 3.13.0-52-lowlatency
b) As little as 2 files totalling 2,2 GiB, the first is written very fast and when it starts with the other there is a delay accompanied by intermittent system freezes until the operation is over.
c) I'm copying from HDD to SSD (/home and also root).
d) There aren't many cables to my disposal from what I'm aware.
e) The system is a HP ProBook 430 G2 with the SSD on the M2 slot (Adata SSD Premier Pro SP900 128GB M.2).

After I enabled discard in crypttab and grub I see slight improvement but the problem persist.
Also, I noticed similar behaviour when writing to usb stick (first file is written fast and at the second is a short delay), but there is no system freeze because the OS is not there probably.

moxalt
Offline
Iscritto: 06/19/2015

> first file is written fast and at the second is a short delay

I've noticed that with USBs as well. File writing speed (when copying large
amounts of data) seems to start slow, peak out a few minutes in, then drop, and
stay somewhere in between for the remainder of the time. Does anyone know why
this happens? Is this how USBs work?

One more question for OP- why are you doing this? Copying your entire / to
another drive? Backing up? Or what?

teodorescup

I am a member!

Offline
Iscritto: 01/04/2011

I have / on the SSD, the HDD is for data; however, /home is also on the SSD. On occasion I need files or folders from the HDD to /home which is os SSD; system freezing is unacceptable for a file or folder as small as 2 GiB.

I use xfs because is fast and awesome, also it has fast file-system check compared to ext4 and because it was the default, at least at some point, of Trisquel.

Now I finally found a solution and everything is working fine. I basically enabled TRIM anywhere I could: fstab, crypttab, grub, and cron. I'm not sure which one did the trick.

For crypttab I used:

nano /etc/crypttab

luks,discard

update-initramfs -u -k all

For grub I used:

nano /etc/default/grub

GRUB_CMDLINE_LINUX="allow-discards root_trim=yes"

update-grub

For cron I used:

nano /etc/cron.daily/trim

#!/bin/sh
LOG=/var/log/trim.log
echo "*** $(date -R) ***" >> $LOG
fstrim -v / >> $LOG

chmod +x /etc/cron.daily/trim
antiesnob
Offline
Iscritto: 08/22/2013

GREAT!!

antiesnob
Offline
Iscritto: 08/22/2013

It may start slow or not. It depends on if the files were cached before. If it starts slow is because it is buffering de data.
The it goes fast but its speed decreases because it gets hotter while the time passes by, so the transfer starts to slower down to a certain speed (that is to the hotter temperature of the stick plus the port) until it finishes. Yes, it is normal as we call it physics ha. That's how everything works. To deal with it u cooling and that is how some system uses that (not USB) for example a cooler fan on ur CPU.

antiesnob
Offline
Iscritto: 08/22/2013

Sorry for d) I thought u was in a desktop PC. I was referring to the SATA and MOLEX cables.

Calinou
Offline
Iscritto: 03/08/2014

> Hello. Buy an HDD. That's the best you can do. SSDs are not what they say they are. The root for marketing, politics, etc. is to convince; to lie, in other words.
SSDs are not well prepared for writing but for access and above all for CACHE.

Hey, it's not 2007 anymore. SSDs are proven technology, and are not that expensive. I have 2 systems here which run "full SSD" (SSD only, no HDD), and everything is fast and silent.

antiesnob
Offline
Iscritto: 08/22/2013

Sorry for that. The zing iz im trapped in da past as me I my teammateses were castaway in 2006 durin our time travelling n our headquarters doesn't even respond 2 our smoke calls!! If anyone can give me a needle so I can break the bubble. Please HELP US!!!

You have been trolled

Do u mean HDDs r not proven technology? The bottleneck is on the mainboard. If had bought 2 HDDs instead of one at that time you'd get similar speeds transfers as SSDs for the entire system (if u have made a good configuration/optimization, the SSDs has that in the firmware, so most comparisons r between automatedtuned SSDs with non tuned HDDs). HDDs has SMART which gives u another level of trust in data but both depends on luck anyway.
And above all, u coulda bought more RAM instead of an SSD and get the system on the RAM which is a lot faster than the SSD.

Why u didn't reply to the message instead of here?