Date: Thu, 26 Nov 2020 10:46:36 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: tech-lists <tech-lists@zyxst.net> Cc: freebsd-current@freebsd.org Subject: Re: possible usb3-connected hard drive spin down causing lag Message-ID: <B5D9C7DC-AB91-4F79-B192-DB418E48E7D4@FreeBSD.org> In-Reply-To: <X77ygGTS09S91bTC@rpi4.local> References: <X77ygGTS09S91bTC@rpi4.local>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_43784985-B155-4E1E-89DC-97D72CD098C5 Content-Type: multipart/mixed; boundary="Apple-Mail=_06AAB545-0BBB-49DD-B7E8-ECA0CB147400" --Apple-Mail=_06AAB545-0BBB-49DD-B7E8-ECA0CB147400 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 26 Nov 2020, at 01:10, tech-lists <tech-lists@zyxst.net> wrote: >=20 > I have a usb3-connected harddrive. dmesg shows this: > [...] > da0: <ADATA HD710 0> Fixed Direct Access SPC-4 SCSI device > [...] >=20 > running current-r367806-arm64 >=20 > I think it might be auto-spinning-down or auto-sleeping. It's > making initial interaction lag of 2-3 seconds. Is there a sysctl or = something somewhere where I can tell it to never sleep? Or is that = something I'd need to contact the manufacturer about? Or is there an = alternative strategy like tmpfs. It's not a "green" drive but I guess it = might > be "green" in that it's usb3 powered. >=20 > I have vfs.read_max=3D128 in /etc/sysctl.conf > zdb has ashift=3D12 >=20 > In case it's relevant, the filesystem on the disk is zfs. Once > "woken up", inferaction is quick, as expected. > thanks, I have been using the attached rc.d script for a long time now, which uses camcontrol(8)'s "apm" and "aam" commands to set drives to 'maximum performance' (aka don't try to save power by shutting down all the time). Just drop this into /usr/local/etc/rc.d, and add something like the following to your rc.conf: camperf_devices=3D"da0 da1" camperf_enable=3D"YES" You can also manually start the rc.d script by running: sudo service camperf start -Dimitry --Apple-Mail=_06AAB545-0BBB-49DD-B7E8-ECA0CB147400 Content-Disposition: attachment; filename=camperf Content-Type: application/octet-stream; x-unix-mode=0755; name="camperf" Content-Transfer-Encoding: 7bit #!/bin/sh # PROVIDE: camperf # BEFORE: LOGIN # # Add the following lines to /etc/rc.conf to enable camperf: # # camperf_enable (bool): set to NO by default. # Set to YES to enable camperf. # camperf_devices: list of devices on which to run camperf # Example: # Set the disks da0 and da1 to max APM and AAM performance: # # camperf_devices="da0 da1" # . /etc/rc.subr name="camperf" rcvar=camperf_enable command=/sbin/camcontrol start_cmd=camperf_start load_rc_config $name : ${camperf_enable="NO"} camperf_start() { if [ -n "${camperf_devices}" ]; then for i in ${camperf_devices}; do echo "camperf: configuring device /dev/${i}" ${command} apm /dev/${i} -l 254 ${command} aam /dev/${i} -l 254 done fi } run_rc_command "$1" --Apple-Mail=_06AAB545-0BBB-49DD-B7E8-ECA0CB147400-- --Apple-Mail=_43784985-B155-4E1E-89DC-97D72CD098C5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCX795fAAKCRCwXqMKLiCW o3mlAKC41pQgVpoxPhCCHpFLjj7YjiqbPQCfUP1tY1RcnqEeLwmU7XFAMw1cvTg= =pBI5 -----END PGP SIGNATURE----- --Apple-Mail=_43784985-B155-4E1E-89DC-97D72CD098C5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B5D9C7DC-AB91-4F79-B192-DB418E48E7D4>