You are not logged in.

#1 2024-05-27 02:32:59

yelopanda
Member
Registered: 2024-05-27
Posts: 5

[SOLVED] Weird freezes when trying to write files to a SSD

Hello, I have a SSD that was encrypted via cryptsetup (LUKS) a while back, it was working fine until recently. Now when trying to copy files, it goes smoothly for a few seconds then gets stuck for about an minute, and it keeps happening over and over again until the file is transferred.

When the copying freezes, the IO read/write stops (on iotop) and the CPU usage also goes down, but the physical IO indicator on my CPU stays on. I have tried to diagnose the problem by myself but have failed. Any help regarding this will be appreciated.

Thank You.

Last edited by yelopanda (2024-05-28 08:04:17)

Offline

#2 2024-05-27 14:18:21

256
Member
Registered: 2023-12-17
Posts: 69

Re: [SOLVED] Weird freezes when trying to write files to a SSD

Are you sure encryption is relevant? Try doing "dd if=/dev/sdx of=/dev/null status=progress", replacing "sdx" with the SSD, to test whether this problem is more low-level (also, I'm pretty sure it should be unmounted when you do this).

Also, is it reads, writes, or both? If it's only writing that's a problem, the above command would probably be a waste of time.


"Don't comment bad code - rewrite it." - The Elements of Programming Style (1978), Brian W. Kernighan & P. J. Plauger, p. 144.

Offline

#3 2024-05-27 14:29:56

yelopanda
Member
Registered: 2024-05-27
Posts: 5

Re: [SOLVED] Weird freezes when trying to write files to a SSD

Reading from disk using dd is going smoothly, only while writing something to the disk I am facing this problem.

Offline

#4 2024-05-28 03:24:07

AaAaAAaaAAaARCH
Member
Registered: 2024-02-29
Posts: 42

Re: [SOLVED] Weird freezes when trying to write files to a SSD

SSD performance can degrade depending on how "full" the drive is and what kind of SSD technology is used. In your case TRIM might not be enabled by default https://wiki.archlinux.org/title/Dm-cry … ives_(SSD)

Offline

#5 2024-05-28 03:56:33

yelopanda
Member
Registered: 2024-05-27
Posts: 5

Re: [SOLVED] Weird freezes when trying to write files to a SSD

The drive is about ~90 percent full, I think this is the reason.


Edit: I just cleared 10 percent more space and the problem remains.

Last edited by yelopanda (2024-05-28 04:02:26)

Offline

#6 2024-05-28 04:07:19

AaAaAAaaAAaARCH
Member
Registered: 2024-02-29
Posts: 42

Re: [SOLVED] Weird freezes when trying to write files to a SSD

Without TRIM the data you deleted is still claimed by LUKS, so it would still be "full"

Offline

#7 2024-05-28 04:31:25

yelopanda
Member
Registered: 2024-05-27
Posts: 5

Re: [SOLVED] Weird freezes when trying to write files to a SSD

Oh sorry, forgot about that. After TRIM, data is being written to the drive with expected speeds.

For people with the same problem:
Make sure that your SSD supports TRIM first.

Mount the drive via this command to enable TRIM -

sudo cryptsetup --allow-discards open /dev/sdX ssdcrypt

/dev/sdX is your drive and ssdcrypt is the name of the mapper.

Then mount the drive, e.g. -

sudo mount /dev/mapper/ssdcrypt /mnt

After that run the fstrim command on the mount point-

sudo fstrim -v /mnt

Last edited by yelopanda (2024-05-28 04:32:25)

Offline

#8 2024-05-28 06:32:10

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,758

Re: [SOLVED] Weird freezes when trying to write files to a SSD

\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Edit: you might also want to adjust teh subject to reflect that this wasn'rt luks related at all but about your full SSD

Last edited by seth (2024-05-28 06:33:04)

Offline

#9 2024-05-28 06:36:48

yelopanda
Member
Registered: 2024-05-27
Posts: 5

Re: [SOLVED] Weird freezes when trying to write files to a SSD

seth wrote:

\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Edit: you might also want to adjust teh subject to reflect that this wasn'rt luks related at all but about your full SSD

done yikes

Offline

Board footer

Powered by FluxBB