fstrim 运行时系统挂起/中断(SSD 设置上的双启动)

fstrim 运行时系统挂起/中断(SSD 设置上的双启动)

我有一个 Windows 10 / Kubuntu 22.04 双启动设置,两个操作系统分区都在同一个 SSD 驱动器上。

每周fstrim.timer都会触发fstrim.service在后台运行,结果我的系统以有趣的方式“崩溃”并变得无法使用,直到我进行紧急重启。

症状

  • 尝试启动任何新的 GUI 应用程序均会失败。
  • 某些应用程序(例如 Firefox)会完全冻结。
  • 如果已经打开了 Konsole,我可以继续使用命令行。
  • 尝试重新启动系统需要很长时间,同时在文本模式下显示以下消息(按下显示Esc日志而不是普利茅斯屏幕后):
    A stop job is running for Discard unused blocks on filesystems from /etc/fstab
    我通常在失去耐心后进行紧急重启。

我可以通过运行来重现上述情况sudo fstrim --fstab。在运行 fstrim 或执行时按 Ctrl+Ckillall -KILL fstrim没有任何反应。

先前研究

诊断

$ systemctl status fstrim.service fstrim.timer
○ fstrim.service - Discard unused blocks on filesystems from /etc/fstab
     Loaded: loaded (/lib/systemd/system/fstrim.service; static)
     Active: inactive (dead)
TriggeredBy: ● fstrim.timer
       Docs: man:fstrim(8)

● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Fri 2022-11-25 19:42:10 +03; 13min ago
    Trigger: Mon 2022-11-28 00:17:05 +03; 2 days left
   Triggers: ● fstrim.service
       Docs: man:fstrim
$ journalctl -u fstrim
Sep 11 10:35:23 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
-- Boot 07b77c86b89d45bd82fbb37b31a8d63f --
Sep 12 08:01:24 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Sep 12 08:03:55 ABRA-Linux systemd[1]: fstrim.service: Main process exited, code=killed, status=15/TERM
Sep 12 08:03:55 ABRA-Linux systemd[1]: fstrim.service: Failed with result 'signal'.
Sep 12 08:03:55 ABRA-Linux systemd[1]: Stopped Discard unused blocks on filesystems from /etc/fstab.
-- Boot b4acfa99e85148c3a9f173cdd1fb13fc --
Oct 04 17:59:05 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Oct 04 18:03:49 ABRA-Linux systemd[1]: fstrim.service: State 'stop-sigterm' timed out. Killing.
Oct 04 18:03:49 ABRA-Linux systemd[1]: fstrim.service: Killing process 24334 (fstrim) with signal SIGKILL.
-- Boot 553a345dfd7e41429eb0719320254cee --
Oct 10 08:31:04 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
-- Boot 71d860d3c7654cf88d564ae9072918da --
Oct 17 00:17:47 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Oct 17 00:32:56 ABRA-Linux fstrim[117561]: /mnt/C: 31,2 GiB (33495588864 bytes) trimmed on /dev/sda3
Oct 17 00:32:56 ABRA-Linux fstrim[117561]: /boot/efi: 60,8 MiB (63755264 bytes) trimmed on /dev/sda1
Oct 17 00:32:56 ABRA-Linux fstrim[117561]: /: 9,8 GiB (10574045184 bytes) trimmed on /dev/sda5
Oct 17 00:32:56 ABRA-Linux systemd[1]: fstrim.service: Deactivated successfully.
Oct 17 00:32:56 ABRA-Linux systemd[1]: Finished Discard unused blocks on filesystems from /etc/fstab.
Oct 17 00:32:56 ABRA-Linux systemd[1]: fstrim.service: Consumed 5.636s CPU time.
-- Boot c3a58c73fbb1402d862520a0c5b1faf1 --
Oct 27 13:09:32 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
-- Boot 5be05c0fa9b34f9493fe830675f4d3b2 --
Nov 08 21:15:36 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Nov 08 21:38:58 ABRA-Linux systemd[1]: fstrim.service: Main process exited, code=killed, status=15/TERM
Nov 08 21:38:58 ABRA-Linux systemd[1]: fstrim.service: Failed with result 'signal'.
Nov 08 21:38:58 ABRA-Linux systemd[1]: Stopped Discard unused blocks on filesystems from /etc/fstab.
-- Boot 69549e12288c4ca2a022c8e4f6cea7cf --
Nov 14 21:06:02 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Nov 14 21:18:36 ABRA-Linux fstrim[46092]: /mnt/C: 26,4 GiB (28312604672 bytes) trimmed on /dev/sda3
Nov 14 21:18:36 ABRA-Linux fstrim[46092]: /boot/efi: 60,8 MiB (63706112 bytes) trimmed on /dev/sda1
Nov 14 21:18:36 ABRA-Linux fstrim[46092]: /: 9,1 GiB (9798144000 bytes) trimmed on /dev/sda5
Nov 14 21:18:36 ABRA-Linux systemd[1]: fstrim.service: Deactivated successfully.
Nov 14 21:18:36 ABRA-Linux systemd[1]: Finished Discard unused blocks on filesystems from /etc/fstab.
Nov 14 21:18:36 ABRA-Linux systemd[1]: fstrim.service: Consumed 5.480s CPU time.
-- Boot 51a404cad72449fb84c8464cdc522c1a --
Nov 25 17:31:53 ABRA-Linux systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Nov 25 17:42:42 ABRA-Linux systemd[1]: fstrim.service: State 'stop-sigterm' timed out. Killing.
Nov 25 17:42:42 ABRA-Linux systemd[1]: fstrim.service: Killing process 16417 (fstrim) with signal SIGKILL.
Nov 25 17:44:12 ABRA-Linux systemd[1]: fstrim.service: Processes still around after SIGKILL. Ignoring.
Nov 25 17:45:42 ABRA-Linux systemd[1]: fstrim.service: State 'final-sigterm' timed out. Killing.
Nov 25 17:45:42 ABRA-Linux systemd[1]: fstrim.service: Killing process 16417 (fstrim) with signal SIGKILL.
Nov 25 17:47:13 ABRA-Linux systemd[1]: fstrim.service: Processes still around after final SIGKILL. Entering failed mode.
Nov 25 17:47:13 ABRA-Linux systemd[1]: fstrim.service: Failed with result 'timeout'.
Nov 25 17:47:13 ABRA-Linux systemd[1]: fstrim.service: Unit process 16417 (fstrim) remains running after unit stopped.
Nov 25 17:47:13 ABRA-Linux systemd[1]: Stopped Discard unused blocks on filesystems from /etc/fstab.
$ cat /etc/fstab
# <file system>                            <mount point>  <type>  <options>                  <dump>  <pass>
UUID=e6c60824-c508-4136-b085-46e9f9e18012  /              ext4    defaults                   0       1
UUID=5C82-5FBB                             /boot/efi      vfat    umask=007                  0       1
UUID=2fe26c1f-25ae-44c5-91d6-c90971846815  /data          ext4    defaults                   0       2
UUID=3CB2C0EBB2C0AAAA                      /mnt/C         ntfs    windows_names,umask=000    0       0
UUID=D0AE869EAE867D2A                      /mnt/D         ntfs    windows_names,umask=000    0       0
/swapfile                                  none           swap    sw                         0       0
$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0   100M  0 part /boot/efi
├─sda2   8:2    0    16M  0 part 
├─sda3   8:3    0 176.4G  0 part /mnt/C
├─sda4   8:4    0   509M  0 part 
└─sda5   8:5    0  46.6G  0 part /
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0   500G  0 part /mnt/D
└─sdb2   8:18   0 431.5G  0 part /data
sr0     11:0    1  1024M  0 rom  
$ sudo blkid
/dev/sda5: LABEL="Linux" UUID="e6c60824-c508-4136-b085-46e9f9e18012" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux" PARTUUID="409a24dc-414c-49d7-b7e2-c353610e4b6f"
/dev/sdb2: UUID="2fe26c1f-25ae-44c5-91d6-c90971846815" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux Data" PARTUUID="91cbfe6d-67a3-a145-bb9b-8b95756dd01e"
/dev/sdb1: BLOCK_SIZE="512" UUID="D0AE869EAE867D2A" TYPE="ntfs" PARTLABEL="Windows Data" PARTUUID="1a7ad633-565e-4721-a395-6d90149eb24f"
/dev/sda4: BLOCK_SIZE="512" UUID="CEF6C4DDF6C4C745" TYPE="ntfs" PARTUUID="19412a16-7e1d-4c09-9baa-7e8d36e12512"
/dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="604485ef-4246-4773-a653-7f01e14a7db4"
/dev/sda3: LABEL="Windows" BLOCK_SIZE="512" UUID="3CB2C0EBB2C0AAAA" TYPE="ntfs" PARTLABEL="Windows" PARTUUID="fcd81266-ef0c-46a6-8f0c-a3c0ea7c736f"
/dev/sda1: UUID="5C82-5FBB" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="78c8d426-646d-4ba8-bf0a-3d8c52118f1f"
$ sudo fdisk -l
Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk model: INTEL SSDSCKHW24
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 20985C80-B8A7-4B70-A20E-869F288EFD10

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    206847    204800   100M EFI System
/dev/sda2     206848    239615     32768    16M Microsoft reserved
/dev/sda3     239616 370159537 369919922 176.4G Microsoft basic data
/dev/sda4  467816448 468858879   1042432   509M Windows recovery environment
/dev/sda5  370159616 467816447  97656832  46.6G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: HGST HTS721010A9
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 88536680-938F-44E7-B75A-6BF2EC90977E

Device          Start        End    Sectors   Size Type
/dev/sdb1        2048 1048578047 1048576000   500G Microsoft basic data
/dev/sdb2  1048578048 1953523711  904945664 431.5G Linux filesystem
$ cat /mnt/C/.NTFS-3G/UserMapping
# Generated by ntfsusermap for Linux, v 1.2.0
:1000:S-1-5-21-76983165-3329468604-3967637644-513
1000:1000:S-1-5-21-76983165-3329468604-3967637644-1001

相关内容