我正在使用 Raspberry Pi 5,它通过 USB 3 连接外部硬盘。在启动时,它会在 /etc/fstab 中使用以下条目进行安装:
LABEL=external /mnt/external ext4 defaults,noatime,nofail 0 2
这很好用,我没有遇到任何问题。但由于此驱动器实际上仅用于备份和作为 Jellyfin 服务器,因此我想在不使用时将其关闭。
hd-idle
不hdparm
支持,但使用sdparm
我可以设置STANDBY_Z
时间并启用它。驱动器在 10 分钟后确实按预期停止旋转。
问题:尝试访问驱动器时,我可以听到它重新旋转,但没有安装任何内容(/mnt/external 为空)。我怀疑驱动器在旋转时被卸载了,因为如果我(手动)运行,sudo mount -a
一切都会再次正常工作。
至于我已经尝试过的方法:硬盘在不进入睡眠状态时没有出现任何问题,在 Windows 上它可以正常减速和备份。此外,我认为我可以排除电源传输问题。硬盘有一个外部电源块,而 Pi 使用官方的 5V 5A 电源。
我有一份完整的日志可以分享。它从启动开始,在 14:37 我尝试访问 /mnt/external。两分钟后,我运行sudo mount -a
。我真的不明白发生了什么,有人知道吗?
journalctl --dmesg | grep sd
Jan 06 13:53:05 rpi kernel: sdhci: Secure Digital Host Controller Interface driver
Jan 06 13:53:05 rpi kernel: sdhci: Copyright(c) Pierre Ossman
Jan 06 13:53:05 rpi kernel: sdhci-pltfm: SDHCI platform and OF driver helper
Jan 06 13:53:05 rpi kernel: sdhci-brcmstb 1000fff000.mmc: there is not valid maps for state default
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Spinning up disk...
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] 15628053167 512-byte logical blocks: (8.00 TB/7.28 TiB)
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] 4096-byte physical blocks
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Write Protect is off
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes)
Jan 06 13:53:05 rpi kernel: sda: sda1
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Attached SCSI disk
Jan 06 13:53:09 rpi kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
Jan 06 13:53:09 rpi kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
Jan 06 13:53:11 rpi kernel: EXT4-fs (sda1): mounted filesystem with ordered data mode. Quota mode: none.
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 uas_zap_pending 0 uas-tag 1 inflight: CMD
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 CDB: opcode=0x8a 8a 00 00 00 00 00 06 dd 78 08 00 00 00 08 00 00
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=DRIVER_OK cmd_age=5s
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 CDB: opcode=0x8a 8a 00 00 00 00 00 06 dd 78 08 00 00 00 08 00 00
Jan 06 14:31:30 rpi kernel: I/O error, dev sda, sector 115177480 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
Jan 06 14:31:30 rpi kernel: EXT4-fs warning (device sda1): ext4_end_bio:343: I/O error 10 writing to inode 77137441 starting block 14397185)
Jan 06 14:31:30 rpi kernel: Buffer I/O error on device sda1, logical block 14396929
Jan 06 14:31:30 rpi kernel: device offline error, dev sda, sector 7814258448 op 0x1:(WRITE) flags 0x800 phys_seg 11 prio class 2
Jan 06 14:31:30 rpi kernel: Aborting journal on device sda1-8.
Jan 06 14:31:30 rpi kernel: device offline error, dev sda, sector 7814252544 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
Jan 06 14:31:30 rpi kernel: device offline error, dev sda, sector 7814252544 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
Jan 06 14:31:30 rpi kernel: Buffer I/O error on dev sda1, logical block 976781312, lost sync page write
Jan 06 14:31:30 rpi kernel: JBD2: I/O error when updating journal superblock for sda1-8.
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
Jan 06 14:31:31 rpi kernel: sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x07 driverbyte=DRIVER_OK
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: Attached scsi generic sg0 type 0
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] 15628053167 512-byte logical blocks: (8.00 TB/7.28 TiB)
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] 4096-byte physical blocks
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Write Protect is off
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Mode Sense: 53 00 00 08
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Preferred minimum I/O size 4096 bytes
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes)
Jan 06 14:31:44 rpi kernel: sdb: sdb1
Jan 06 14:31:44 rpi kernel: sd 1:0:0:0: [sdb] Attached SCSI disk
Jan 06 14:37:15 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:29 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:39:56 rpi kernel: EXT4-fs (sdb1): recovery complete
Jan 06 14:39:56 rpi kernel: EXT4-fs (sdb1): mounted filesystem with ordered data mode. Quota mode: none.
tfaehse@rpi:~ $ journalctl --dmesg | grep sd
Jan 06 13:53:05 rpi kernel: sdhci: Secure Digital Host Controller Interface driver
Jan 06 13:53:05 rpi kernel: sdhci: Copyright(c) Pierre Ossman
Jan 06 13:53:05 rpi kernel: sdhci-pltfm: SDHCI platform and OF driver helper
Jan 06 13:53:05 rpi kernel: sdhci-brcmstb 1000fff000.mmc: there is not valid maps for state default
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Spinning up disk...
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] 15628053167 512-byte logical blocks: (8.00 TB/7.28 TiB)
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] 4096-byte physical blocks
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Write Protect is off
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes)
Jan 06 13:53:05 rpi kernel: sda: sda1
Jan 06 13:53:05 rpi kernel: sd 0:0:0:0: [sda] Attached SCSI disk
Jan 06 13:53:09 rpi kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
Jan 06 13:53:09 rpi kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
Jan 06 13:53:11 rpi kernel: EXT4-fs (sda1): mounted filesystem with ordered data mode. Quota mode: none.
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 uas_zap_pending 0 uas-tag 1 inflight: CMD
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 CDB: opcode=0x8a 8a 00 00 00 00 00 06 dd 78 08 00 00 00 08 00 00
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=DRIVER_OK cmd_age=5s
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] tag#13 CDB: opcode=0x8a 8a 00 00 00 00 00 06 dd 78 08 00 00 00 08 00 00
Jan 06 14:31:30 rpi kernel: I/O error, dev sda, sector 115177480 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
Jan 06 14:31:30 rpi kernel: EXT4-fs warning (device sda1): ext4_end_bio:343: I/O error 10 writing to inode 77137441 starting block 14397185)
Jan 06 14:31:30 rpi kernel: Buffer I/O error on device sda1, logical block 14396929
Jan 06 14:31:30 rpi kernel: device offline error, dev sda, sector 7814258448 op 0x1:(WRITE) flags 0x800 phys_seg 11 prio class 2
Jan 06 14:31:30 rpi kernel: Aborting journal on device sda1-8.
Jan 06 14:31:30 rpi kernel: device offline error, dev sda, sector 7814252544 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
Jan 06 14:31:30 rpi kernel: device offline error, dev sda, sector 7814252544 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
Jan 06 14:31:30 rpi kernel: Buffer I/O error on dev sda1, logical block 976781312, lost sync page write
Jan 06 14:31:30 rpi kernel: JBD2: I/O error when updating journal superblock for sda1-8.
Jan 06 14:31:30 rpi kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
Jan 06 14:31:31 rpi kernel: sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x07 driverbyte=DRIVER_OK
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: Attached scsi generic sg0 type 0
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] 15628053167 512-byte logical blocks: (8.00 TB/7.28 TiB)
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] 4096-byte physical blocks
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Write Protect is off
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Mode Sense: 53 00 00 08
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Preferred minimum I/O size 4096 bytes
Jan 06 14:31:31 rpi kernel: sd 1:0:0:0: [sdb] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes)
Jan 06 14:31:44 rpi kernel: sdb: sdb1
Jan 06 14:31:44 rpi kernel: sd 1:0:0:0: [sdb] Attached SCSI disk
Jan 06 14:37:15 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:29 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:37:30 rpi kernel: EXT4-fs warning (device sda1): dx_probe:822: inode #77137068: lblock 0: comm smbd[192.168.17: error -5 reading directory block
Jan 06 14:39:56 rpi kernel: EXT4-fs (sdb1): recovery complete
Jan 06 14:39:56 rpi kernel: EXT4-fs (sdb1): mounted filesystem with ordered data mode. Quota mode: none.
最后但同样重要的一点是,这是 sdparm 可以读取的所有硬盘信息:
sudo sdparm --flexible -6 -l -a /dev/sdb
/dev/sdb: Seagate Expansion HDD 1801
Direct access device specific parameters: WP=0 DPOFUA=0
Caching (SBC) [ca] mode page:
IC 0 [cha: n, def: 0, sav: 0] Initiator control
ABPF 0 [cha: n, def: 0, sav: 0] Abort pre-fetch
CAP 0 [cha: n, def: 0, sav: 0] Caching analysis permitted
DISC 1 [cha: n, def: 1, sav: 1] Discontinuity
SIZE 0 [cha: n, def: 0, sav: 0] Size enable
WCE 1 [cha: y, def: 1, sav: 1] Write cache enable
MF 0 [cha: n, def: 0, sav: 0] Multiplication factor
RCD 0 [cha: n, def: 0, sav: 0] Read cache disable
DRRP 0 [cha: n, def: 0, sav: 0] Demand read retention priority
WRP 0 [cha: n, def: 0, sav: 0] Write retention priority
DPTL -1 [cha: n, def: -1, sav: -1] Disable pre-fetch transfer length
MIPF 0 [cha: n, def: 0, sav: 0] Minimum pre-fetch
MAPF -1 [cha: n, def: -1, sav: -1] Maximum pre-fetch
MAPFC -1 [cha: n, def: -1, sav: -1] Maximum pre-fetch ceiling
FSW 0 [cha: n, def: 0, sav: 0] Force sequential write
LBCSS 0 [cha: n, def: 0, sav: 0] Logical block cache segment size
DRA 0 [cha: n, def: 0, sav: 0] Disable read ahead
SYNC_PROG 0 [cha: n, def: 0, sav: 0] Synchronous cache progress indication
NV_DIS 0 [cha: n, def: 0, sav: 0] Non-volatile cache disable
NCS -1 [cha: n, def: -1, sav: -1] Number of cache segments
CSS 0 [cha: n, def: 0, sav: 0] Cache segment size
Control [co] mode page:
TST 0 [cha: n, def: 0, sav: 0] Task set type
TMF_ONLY 0 [cha: n, def: 0, sav: 0] Task management functions only
DPICZ 0 [cha: n, def: 0, sav: 0] Disable protection information check if protect field zero
D_SENSE 0 [cha: n, def: 0, sav: 0] Descriptor format sense data
GLTSD 0 [cha: n, def: 0, sav: 0] Global logging target save disable
RLEC 0 [cha: n, def: 0, sav: 0] Report log exception condition
QAM 1 [cha: n, def: 1, sav: 1] Queue algorithm modifier
NUAR 0 [cha: n, def: 0, sav: 0] No unit attention on release
QERR 0 [cha: n, def: 0, sav: 0] Queue error management
VS_CTL 0 [cha: n, def: 0, sav: 0] Vendor specific [byte 4, bit 7]
RAC 0 [cha: n, def: 0, sav: 0] Report a check
UA_INTLCK 0 [cha: n, def: 0, sav: 0] Unit attention interlocks control
SWP 0 [cha: n, def: 0, sav: 0] Software write protect
ATO 0 [cha: n, def: 0, sav: 0] Application tag owner
TAS 0 [cha: n, def: 0, sav: 0] Task aborted status
ATMPE 0 [cha: n, def: 0, sav: 0] Application tag mode page enabled
RWWP 0 [cha: n, def: 0, sav: 0] Reject write without protection
SBLP 0 [cha: n, def: 0, sav: 0] Supported block lengths and protection information
AUTOLOAD 0 [cha: n, def: 0, sav: 0] Autoload mode
BTP 0 [cha: n, def: 0, sav: 0] Busy timeout period (100us)
ESTCT 0 [cha: n, def: 0, sav: 0] Extended self test completion time (sec)
Power condition [po] mode page:
PM_BG 0 [cha: n, def: 0, sav: 0] Power management, background functions, precedence
STANDBY_Y 0 [cha: n, def: 0, sav: 0] Standby_y timer enable
IDLE_C 0 [cha: n, def: 0, sav: 0] Idle_c timer enable
IDLE_B 0 [cha: n, def: 0, sav: 0] Idle_b timer enable
IDLE_A 0 [cha: n, def: 0, sav: 0] Idle_a timer enable
STANDBY_Z 1 [cha: y, def: 1, sav: 1] Standby_z timer enable
IACT 0 [cha: n, def: 0, sav: 0] Idle_a condition timer (100 ms)
SZCT 6000 [cha: y, def:9000, sav:6000] Standby_z condition timer (100 ms)
IBCT 0 [cha: n, def: 0, sav: 0] Idle_b condition timer (100 ms)
ICCT 0 [cha: n, def: 0, sav: 0] Idle_c condition timer (100 ms)
SYCT 0 [cha: n, def: 0, sav: 0] Standby_y condition timer (100 ms)
CCF_IDLE 0 [cha: n, def: 0, sav: 0] check condition if from idle_c
CCF_STAND 0 [cha: n, def: 0, sav: 0] check condition if from a standby
CCF_STOPP 0 [cha: n, def: 0, sav: 0] check condition if from stopped
答案1
我在通过 USB 3.0 -> SATA 底座连接基于 JMicron Technology Corp. / JMicron USA Technology Corp. JMS578 SATA 6Gb/s 的常规 HDD(WD Red 3 TB)时也遇到了类似的问题。
但就我而言,驱动器没有再次旋转,从而导致 I/O 错误等。
我根本不想让我的驱动器停止旋转,所以我禁用了待机计时器。
我知道您知道 sdparm,所以您需要将 STANDBY_Z 更改为 0(禁用待机计时器)。
sudo sdparm --flexible -6 -l --set STANDBY_Z=0 /dev/sda
要保存对驱动器的更改(在重新启动后保留设置),请在发出的命令中添加 --save 开关:
sudo sdparm --flexible -6 -l --set STANDBY_Z=0 /dev/sda --save
它解决了我的问题。希望它也能帮到你。