e2fsprogs icon indicating copy to clipboard operation
e2fsprogs copied to clipboard

e4defrag freezes in D+ state

Open jfikar opened this issue 1 year ago • 2 comments

Hi, I was running sudo e4defrag -v /home on a Ubuntu 22.04.2 and after a while, the program freezes. There is no more output and ps shows

root       17879  0.0  0.0   4004  3248 pts/6    D+   Mar29   0:26 e4defrag -v /home

It already happened for second time. I restarted, checked the disk for errors with e2fsck and also with S.M.A.R.T long test. It was fine. What could be the problem?

Version of e4defrag is 1.46.5 (30-Dec-2021), kernel is 5.15.0-69-generic x86_64, mount options are:

/dev/sdb1 on /home type ext4 (rw,noatime,lazytime,errors=remount-ro,commit=600)

and tune2fs -l gives:

tune2fs 1.46.5 (30-Dec-2021)
Filesystem volume name:   <none>
Last mounted on:          /home
Filesystem UUID:          0b6225bb-306b-491e-bb6d-ef4d78434aa8
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index fast_commit filetype needs_recovery extent flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              122101760
Block count:              488378368
Reserved block count:     24418918
Free blocks:              334763358
Free inodes:              121411942
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      907
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Thu Sep 20 11:50:07 2018
Last mount time:          Wed Mar 29 13:53:09 2023
Last write time:          Wed Mar 29 13:53:09 2023
Mount count:              2
Maximum mount count:      -1
Last checked:             Wed Mar 29 13:45:46 2023
Check interval:           0 (<none>)
Lifetime writes:          4971 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
First orphan inode:       18481306
Default directory hash:   half_md4
Directory Hash Seed:      141b6d5e-f3ba-4ade-947d-149dd651946e
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xae10ccd3

jfikar avatar Mar 30 '23 07:03 jfikar

Actually the situation after freezing e4defrag is much worse. Every call to sync also freezes in D state. And application like web-browsers are apparently calling sync often. I see a lot of Zombie now. Could it be related to fast_commit?

$ cat /proc/fs/ext4/sdb1/fc_info
fc stats:
11268 commits
37 ineligible
12251 numblks
24382us avg_commit_time
Ineligible reasons:
"Extended attributes changed":	0
"Cross rename":	0
"Journal flag changed":	0
"Insufficient memory":	0
"Swap boot":	0
"Resize":	0
"Dir renamed":	49
"Falloc range op":	0
"Data journalling":	166
"Encrypted filename":	0

jfikar avatar Mar 30 '23 12:03 jfikar

Same here. e4defrag hangs for me in D+ state. I'm using it within an Ubuntu WSL with a LUKS on a 8TB HDD. I did a e2fsck just prior the defrag which resulted in a lot of fixed errors. I originally closed the terminal and started e4defrag 5 times and wasn't aware that the old processes were still running.

Several hours later a sudo kill -15 pid worked to kill the processes but it took some minutes. After killing the processes it worked worked again (which means it processed the file which got stuck before) and continued.

Could it be related that I did at the same time a rsync at the same time on the same HDD?

Versions: uname -a Linux Win11 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux man e4defrag e4defrag (version version 2.0 May 2009) lsb_release -a Ubuntu 22.04.2 LTS

Robert-Ernst avatar Apr 18 '23 03:04 Robert-Ernst