NAS로 사용하기 위해 단일 보드 컴퓨터에 여러 개의 USB 이동식 드라이브가 연결되어 있습니다. 제가 사용하는 운영체제는 데비안과 유사한 시스템인 Armbian입니다.
문제는 이렇습니다. 며칠 전에 저는 "Syncthing"(파일 동기화 도구)이라는 프로그램을 실행했습니다. 파일이 많은 폴더가 있습니다. "동기화"가 파일을 검색하는 동안 이동식 디스크가 작동하지 않는 것을 발견했습니다. 아무 메시지도 없이 그냥 거기에 멈춥니다. 모든 스캔은 이와 같은 결과를 생성합니다.
그래서 동시에 많은 수의 파일을 읽는 Golang 프로그램을 작성했습니다. 예, 막히는 일이 발생합니다.
막힌 상황이 발생하는 경우:
- 실행하려고 하면 "df-h”, 당신은 갇힐 것입니다;
- 시도해 보면 "CD /mnt/mydisk”, 당신도 막힐 것입니다.
- 이 파티션에서 파일을 읽는 모든 프로그램은 메시지 없이 중단됩니다.
이 이동식 드라이브에서 무엇이든 읽으려고 하면 정지되는 것 같습니다. "ulimit -n"을 변경했지만 여전히 작동하지 않습니다.
시스템을 재부팅하면 많은 수의 파일을 다시 읽을 때까지 모든 것이 정상입니다. USB 이동식 디스크 3개와 단일 보드 컴퓨터 3개 모두 동일한 문제가 있습니다. 그들은 동일한 시스템을 가지고 있습니다. 그래서 시스템적인 문제인 것 같아요.
그래서 제가 묻고 싶은 것은 다음과 같습니다.
이 문제의 원인을 찾고 해결하려면 어떻게 해야 합니까?
내 시스템에 대한 몇 가지 정보는 다음과 같습니다.
# uname -a
Linux orangepizero2 4.9.255-sun50iw9 #1 SMP PREEMPT Tue Mar 1 23:28:34 UTC 2022 aarch64 GNU/Linux
# lsusb -t
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=sunxi-ohci/1p, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=sunxi-ohci/1p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=sunxi-ohci/1p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=sunxi-ehci/1p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=sunxi-ehci/1p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=sunxi-ehci/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 480M (I changed usb driver to "usb-storage" before but doesn't work)
디스크가 정지되는 경우:
# mount -l
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=481084k,nr_inodes=120271,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=98840k,mode=755)
/dev/mmcblk0p1 on / type ext4 (rw,noatime,errors=remount-ro,commit=600)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,relatime)
/dev/mmcblk0p1 on /var/log.hdd type ext4 (rw,noatime,errors=remount-ro,commit=600)
/dev/zram1 on /var/log type ext4 (rw,relatime,discard) [log2ram]
/dev/sdb1 on /mnt/mydisk type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096) [MiniCache] (<- this is my removable drive)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=98836k,nr_inodes=24709,mode=700)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=98836k,nr_inodes=24709,mode=700,uid=1000,gid=1000)
# fdisk -l
...
(lot of device message)
...
Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: EZAZ-00GGJB0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0xa2c21b65
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 3907026943 3907024896 1.8T 7 HPFS/NTFS/exFAT
# df -h
^C
(The command is hanging so I CTRL+C to suspend)
# strace df -h
execve("/usr/bin/df", ["df", "-h"], 0x7fde3826d8 /* 21 vars */) = 0
brk(NULL) = 0x55a32dc000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=21083, ...}) = 0
mmap(NULL, 21083, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb71e2000
close(3) = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0`C\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1458480, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb71e0000
mmap(NULL, 1531032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb7043000
mprotect(0x7fb71a0000, 65536, PROT_NONE) = 0
mmap(0x7fb71b0000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15d000) = 0x7fb71b0000
mmap(0x7fb71b6000, 11416, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb71b6000
close(3) = 0
mprotect(0x7fb71b0000, 12288, PROT_READ) = 0
mprotect(0x55821cf000, 4096, PROT_READ) = 0
mprotect(0x7fb71ea000, 4096, PROT_READ) = 0
munmap(0x7fb71e2000, 21083) = 0
brk(NULL) = 0x55a32dc000
brk(0x55a32fd000) = 0x55a32fd000
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=6194224, ...}) = 0
mmap(NULL, 6194224, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb6a5a000
close(3) = 0
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2996, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2996
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "17 22 0:17 / /sys rw,nosuid,node"..., 1024) = 1024
read(3, "exec,relatime shared:11 - bpf bp"..., 1024) = 1024
read(3, "e shared:174 - tmpfs tmpfs rw,si"..., 1024) = 67
read(3, "", 1024) = 0
lseek(3, 0, SEEK_CUR) = 2115
close(3) = 0
ioctl(1, TCGETS, {B9600 opost isig icanon echo ...}) = 0
openat(AT_FDCWD, "/usr/lib/aarch64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=27004, ...}) = 0
mmap(NULL, 27004, PROT_READ, MAP_SHARED, 3, 0) = 0x7fb6a53000
close(3) = 0
newfstatat(AT_FDCWD, "/dev", {st_mode=S_IFDIR|0755, st_size=3900, ...}, 0) = 0
newfstatat(AT_FDCWD, "/run", {st_mode=S_IFDIR|0755, st_size=820, ...}, 0) = 0
newfstatat(AT_FDCWD, "/", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sys/kernel/security", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/dev/shm", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=40, ...}, 0) = 0
newfstatat(AT_FDCWD, "/run/lock", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=80, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sys/fs/cgroup", {st_mode=S_IFDIR|0555, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sys/fs/pstore", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sys/fs/bpf", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/dev/hugepages", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sys/kernel/config", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=240, ...}, 0) = 0
newfstatat(AT_FDCWD, "/var/log.hdd", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/var/log", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/mnt/mydisk",
(전체 메시지를 복사하지 않은 것은 아니지만 여기서 멈췄습니다.)
중요한 정보를 놓친 경우 알려주시면 기사를 수정하겠습니다.
=======['에서 새 메시지가 없습니다.정보” ]========
root@armbian:~# dmesg
...
< lot of message >
...
[ 18.358530] IPVS: Creating netns size=1928 id=3
[ 18.517342] proc: unrecognized mount option "hidepid=invisible" or missing value
[ 19.530203] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 19.530778] yzhang..read phyaddr=0, phyid=001cc916
[ 19.542162] yzhang..read phyaddr=1, phyid=001cc916
[ 19.559671] libphy: gmac0: probed
[ 19.595908] sunxi-gmac gmac0 eth0: eth0: Type(7) PHY ID 001cc916 at 0 IRQ poll (gmac0-0:00)
[ 19.610068] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 19.689280] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 20.014569] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 22.649063] sunxi-gmac gmac0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 22.649111] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 24.839356] IPv6: eth0: IPv6 duplicate address xxxx:xxxx:xxxx:xxxx::xxxx
detected!
[ 25.339475] IPv6: eth0: IPv6 duplicate address xxxx:xxxx:xxxx::xxxx detected!
root@armbian:~# start_read_files
This Go program will create 1000 threads(They are called goroutine in Golang) to read the total size of all files in /mnt/mydisk.
/mnt/mydisk has 139239 files.
I print the completed count every time there is an increase of 10000.
[Count]10000
[Count]20000
[Count]30000
[Count]40000
[Count]50000
[Count]60000
[Count]70000
(stuck here, Sometimes it is 10000, sometimes it is 80000 )
root@armbian:~# df -h
^C
(CTRL+C again...Now I can be stuck here...)
root@armbian:~# dmesg | tail
[ 19.542162] yzhang..read phyaddr=1, phyid=001cc916
[ 19.559671] libphy: gmac0: probed
[ 19.595908] sunxi-gmac gmac0 eth0: eth0: Type(7) PHY ID 001cc916 at 0 IRQ poll (gmac0-0:00)
[ 19.610068] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 19.689280] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 20.014569] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 22.649063] sunxi-gmac gmac0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 22.649111] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 24.839356] IPv6: eth0: IPv6 duplicate address xxxx:xxxx:xxxx:xxxx::xxxx detected!
[ 25.339475] IPv6: eth0: IPv6 duplicate address xxxx:xxxx:xxxx::xxxx detected!
(No any new message here.)
■■■■■■■[신규수정]■■■■■■
아마도NTFS-3G거기에는 몇 가지 문제가 있습니다. 많은 테스트 끝에 전체 시스템을 다시 시작하지 않고도 이동식 디스크에 대한 읽기 및 쓰기를 복원하는 방법을 알아냈습니다.
# kill -9 <pidof ntfs-3g>
# umount /dev/sdb1
# mount /dev/sdb1 /mnt/mydisk
문제가 점점 더 어려워지는 것 같습니다. 더 이상 "명령어 몇 개만 입력하면 문제가 해결됩니다"가 아닙니다...
답변1
저와 같은 문제를 겪고 있는 분들에게 해결책을 맡기겠습니다.
# ntfs-3g --version
ntfs-3g 2017.3.23AR.3 integrated FUSE 28
ntfs-3g
가능하다면 업데이트하세요. 제 경우에는 최신 시스템 이미지를 다시 설치했는데..
# ntfs-3g --version
ntfs-3g 2022.10.3 integrated FUSE 28
해결되었습니다! 더 이상 갇히지 마세요...