부팅 중 udev 규칙을 통해 hdparm을 사용하여 대기 시간 초과 설정이 작동하지 않음

부팅 중 udev 규칙을 통해 hdparm을 사용하여 대기 시간 초과 설정이 작동하지 않음

udev 규칙을 사용하여 부팅 중 HDD의 APM 수준과 대기 시간 초과를 설정합니다.

ACTION=="add|change", KERNEL=="sd[b-z]", ATTR{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 63 -S 36 /dev/%k"

RUN 명령에서 파일을 터치하여 규칙이 실행되었는지 확인했습니다 udevadm test /sys/class/block/sdb.

calling: test
version 227
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          227
file size:         6660537 bytes
header size             80 bytes
strings            1715721 bytes
nodes              4944736 bytes
Load module index
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
Reading rules file: /usr/lib/udev/rules.d/10-dm.rules
Reading rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
Reading rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
Reading rules file: /etc/udev/rules.d/50-hdparm.rules
Reading rules file: /usr/lib/udev/rules.d/50-udev-default.rules
Reading rules file: /etc/udev/rules.d/51-tests.rules
Reading rules file: /usr/lib/udev/rules.d/60-block.rules
Reading rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /usr/lib/udev/rules.d/60-drm.rules
Reading rules file: /usr/lib/udev/rules.d/60-evdev.rules
Reading rules file: /usr/lib/udev/rules.d/60-pcmcia.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /usr/lib/udev/rules.d/60-serial.rules
Reading rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
Reading rules file: /usr/lib/udev/rules.d/64-btrfs.rules
Reading rules file: /usr/lib/udev/rules.d/64-md-raid-assembly.rules
Reading rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
Reading rules file: /usr/lib/udev/rules.d/70-mouse.rules
Reading rules file: /usr/lib/udev/rules.d/70-power-switch.rules
Reading rules file: /usr/lib/udev/rules.d/70-uaccess.rules
Reading rules file: /usr/lib/udev/rules.d/71-seat.rules
Reading rules file: /usr/lib/udev/rules.d/73-seat-late.rules
Reading rules file: /usr/lib/udev/rules.d/75-net-description.rules
Reading rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /usr/lib/udev/rules.d/78-sound-card.rules
Reading rules file: /usr/lib/udev/rules.d/80-drivers.rules
Reading rules file: /usr/lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /usr/lib/udev/rules.d/85-regulatory.rules
Reading rules file: /usr/lib/udev/rules.d/90-vconsole.rules
Reading rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
rules contain 24576 bytes tokens (2048 * 12 bytes), 11755 bytes strings
1710 strings (21440 bytes), 1124 de-duplicated (10272 bytes), 587 trie nodes used
RUN '/usr/bin/hdparm -B 63 -S 36 /dev/%k' /etc/udev/rules.d/50-hdparm.rules:1
GROUP 6 /usr/lib/udev/rules.d/50-udev-default.rules:55
RUN '/usr/bin/touch /tmp/udev-%k' /etc/udev/rules.d/51-tests.rules:1
IMPORT 'ata_id --export /dev/sdb' /usr/lib/udev/rules.d/60-persistent-storage.rules:22
starting 'ata_id --export /dev/sdb'
'ata_id --export /dev/sdb'(out) 'ID_ATA=1'
'ata_id --export /dev/sdb'(out) 'ID_TYPE=disk'
'ata_id --export /dev/sdb'(out) 'ID_BUS=ata'
'ata_id --export /dev/sdb'(out) 'ID_MODEL=ST2000VN000-1HJ164'
'ata_id --export /dev/sdb'(out) 'ID_MODEL_ENC=ST2000VN000-1HJ164\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'
'ata_id --export /dev/sdb'(out) 'ID_REVISION=SC60'
'ata_id --export /dev/sdb'(out) 'ID_SERIAL=ST2000VN000-1HJ164_W7209GX3'
'ata_id --export /dev/sdb'(out) 'ID_SERIAL_SHORT=W7209GX3'
'ata_id --export /dev/sdb'(out) 'ID_ATA_WRITE_CACHE=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_WRITE_CACHE_ENABLED=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_HPA=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_HPA_ENABLED=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_PM=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_PM_ENABLED=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_SECURITY=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_SECURITY_ENABLED=0'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=236'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=236'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_SMART=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_SMART_ENABLED=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_PUIS=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_PUIS_ENABLED=0'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_APM=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_APM_ENABLED=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=63'
'ata_id --export /dev/sdb'(out) 'ID_ATA_DOWNLOAD_MICROCODE=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_SATA=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_SATA_SIGNAL_RATE_GEN2=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_SATA_SIGNAL_RATE_GEN1=1'
'ata_id --export /dev/sdb'(out) 'ID_ATA_ROTATION_RATE_RPM=5900'
'ata_id --export /dev/sdb'(out) 'ID_WWN=0x5000c5008b32e037'
'ata_id --export /dev/sdb'(out) 'ID_WWN_WITH_EXTENSION=0x5000c5008b32e037'
Process 'ata_id --export /dev/sdb' succeeded.
LINK 'disk/by-id/ata-ST2000VN000-1HJ164_W7209GX3' /usr/lib/udev/rules.d/60-persistent-storage.rules:36
IMPORT builtin 'path_id' /usr/lib/udev/rules.d/60-persistent-storage.rules:54
LINK 'disk/by-path/pci-0000:01:00.0-ata-1' /usr/lib/udev/rules.d/60-persistent-storage.rules:55
IMPORT builtin 'blkid' /usr/lib/udev/rules.d/60-persistent-storage.rules:66
probe /dev/sdb raid offset=0
LINK 'disk/by-id/wwn-0x5000c5008b32e037' /usr/lib/udev/rules.d/60-persistent-storage.rules:73
handling device node '/dev/sdb', devnum=b8:16, mode=0660, uid=0, gid=6
preserve permissions /dev/sdb, 060660, uid=0, gid=6
preserve already existing symlink '/dev/block/8:16' to '../sdb'
found 'b8:16' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fata-ST2000VN000-1HJ164_W7209GX3'
creating link '/dev/disk/by-id/ata-ST2000VN000-1HJ164_W7209GX3' to '/dev/sdb'
preserve already existing symlink '/dev/disk/by-id/ata-ST2000VN000-1HJ164_W7209GX3' to '../../sdb'
found 'b8:16' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fwwn-0x5000c5008b32e037'
creating link '/dev/disk/by-id/wwn-0x5000c5008b32e037' to '/dev/sdb'
preserve already existing symlink '/dev/disk/by-id/wwn-0x5000c5008b32e037' to '../../sdb'
found 'b8:16' claiming '/run/udev/links/\x2fdisk\x2fby-path\x2fpci-0000:01:00.0-ata-1'
creating link '/dev/disk/by-path/pci-0000:01:00.0-ata-1' to '/dev/sdb'
preserve already existing symlink '/dev/disk/by-path/pci-0000:01:00.0-ata-1' to '../../sdb'
created db file '/run/udev/data/b8:16' for '/devices/pci0000:00/0000:00:02.1/0000:01:00.0/ata3/host2/target2:0:0/2:0:0:0/block/sdb'
.ID_FS_TYPE_NEW=
ACTION=add
DEVLINKS=/dev/disk/by-path/pci-0000:01:00.0-ata-1 /dev/disk/by-id/wwn-0x5000c5008b32e037 /dev/disk/by-id/ata-ST2000VN000-1HJ164_W7209GX3
DEVNAME=/dev/sdb
DEVPATH=/devices/pci0000:00/0000:00:02.1/0000:01:00.0/ata3/host2/target2:0:0/2:0:0:0/block/sdb
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=63
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=236
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=236
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_ROTATION_RATE_RPM=5900
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_FS_TYPE=
ID_MODEL=ST2000VN000-1HJ164
ID_MODEL_ENC=ST2000VN000-1HJ164\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PART_TABLE_TYPE=gpt
ID_PART_TABLE_UUID=fde78847-0d93-4ab7-bd9c-47d6dff3bf35
ID_PATH=pci-0000:01:00.0-ata-1
ID_PATH_TAG=pci-0000_01_00_0-ata-1
ID_REVISION=SC60
ID_SERIAL=ST2000VN000-1HJ164_W7209GX3
ID_SERIAL_SHORT=W7209GX3
ID_TYPE=disk
ID_WWN=0x5000c5008b32e037
ID_WWN_WITH_EXTENSION=0x5000c5008b32e037
MAJOR=8
MINOR=16
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=5571888
run: '/usr/bin/hdparm -B 63 -S 36 /dev/sdb'
run: '/usr/bin/touch /tmp/udev-sdb'
Unload module index
Unloaded link configuration context.

보시다시피 (끝 부분에서) 명령은

/usr/bin/hdparm -B 63 -S 36 /dev/sdb

처형되었다.

이제 문제는 부팅 후 3분 후에도 디스크가 대기 모드로 전환되지 않는다는 것입니다. 즉, -S 36옵션이 적용되지 않습니다. 그러나 그림과 같이 APM은 63으로 설정되어 있습니다 hdparm -B.

부팅 후 루트로 로그인하여 위의 hdparm 명령을 다시 실행하면 대기 타이머가 3분으로 설정되고 예상대로 HDD가 대기 모드로 전환됩니다.

부팅 중에 udev로 실행하면 왜 적용되지 않는지 아시나요 hdparm -S 36?

답변1

같은 문제가 발생했고 hdparm이 실제로 /usr/에 있다는 것을 알았습니다.회전/hdparm

관련 정보