Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2019 04:06:58 -0400
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Suggestions for working with unstable nvme dev names in AWS
Message-ID:  <86623e16-744e-e366-5049-70ef69ea81df@FreeBSD.org>
In-Reply-To: <23771.11429.855191.658934@alice.local>
References:  <23770.10599.687213.86492@alice.local> <08660a2a-489f-8172-22ee-47aeba315986@FreeBSD.org> <23770.58821.826610.399467@alice.local> <20190514210203.3d951fb8.freebsd@edvax.de> <23771.5612.105696.170743@alice.local> <eb1d290e48b4ba21ab350044b25592525e61457c.camel@smormegpa.no> <23771.11429.855191.658934@alice.local>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--8GhZuDA08EIXzCWaErRpuFRf7MqB7QyhC
Content-Type: multipart/mixed; boundary="3idUNXaEIeHCm0bqADw9PbH0Upxfb48Og";
 protected-headers="v1"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-questions@freebsd.org
Message-ID: <86623e16-744e-e366-5049-70ef69ea81df@FreeBSD.org>
Subject: Re: Suggestions for working with unstable nvme dev names in AWS
References: <23770.10599.687213.86492@alice.local>
 <08660a2a-489f-8172-22ee-47aeba315986@FreeBSD.org>
 <23770.58821.826610.399467@alice.local>
 <20190514210203.3d951fb8.freebsd@edvax.de>
 <23771.5612.105696.170743@alice.local>
 <eb1d290e48b4ba21ab350044b25592525e61457c.camel@smormegpa.no>
 <23771.11429.855191.658934@alice.local>
In-Reply-To: <23771.11429.855191.658934@alice.local>

--3idUNXaEIeHCm0bqADw9PbH0Upxfb48Og
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: quoted-printable

On 14/05/2019 22:01, George Hartzell wrote:
> But when I boot, I find that I have two devices (in addition to the
> root device), `/dev/nvme1` and `/dev/nvme2`.  There's no way to know
> which is the big-slow one that I wanted to call `/dev/sdh` and which
> is the small-fast `/dev/sdz`.  In fact, if I reboot the machine,
> sometimes the big-slow one will be `/dev/nvme1` and sometimes it will
> be `/dev/nvme2`.
>=20
> Given that situation, how do you write an automated script that will
> label the big-slow one `backups` and the small-fast one `speedy`?

This is a pretty difficult problem.  Unless AWS can supply some sort of
identification of the device beyond the /dev/nvme1 device specials or
else somehow guarantee ordering so the device names are consistent
across multiple EC2 instances then about your only possible choice is to
develop some heuristics like "if the device is 300MB in size then it's
the special high-IOPS device I want to use for my separate zlog."

You should be able to do that with the facts generated by ansible for
example.  You can use '{{ jinja2 }}' contexts to pretty much run
arbitrary code within your playbooks based on those facts, so you can
eg. generate a label name based on the disk size.

It's not ideal, and it means that if you ever amend the spec for the
instances you're running up, then you will probably need to
simultaneously modify your heuristics.

Hmmm.... camcontrol(8) might be a possibility.  You'll have to
experiment though -- e.g.  see if 'camcontrol inquiry' or 'camcontrol
devlist' gives  you enough information to distinguish the different
types of devices you can specify.

Another thing to investigate is devd(8) which you can use to trigger an
arbitrary command based on parameters discovered when the kernel probes
the device.  Again, it's not clear if there will be suitable information
in the kernel probe results for you to make the sort of distinction you
want to.

	Cheers,

	Matthew



--3idUNXaEIeHCm0bqADw9PbH0Upxfb48Og--

--8GhZuDA08EIXzCWaErRpuFRf7MqB7QyhC
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEGfFU7L8RLlBUTj8wAFE/EOCp5OcFAlzbyKJfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDE5
RjE1NEVDQkYxMTJFNTA1NDRFM0YzMDAwNTEzRjEwRTBBOUU0RTcACgkQAFE/EOCp
5Oce1A//SblpQByPi4I7I+XHGjbGcg7FHPqanKfPe5MiiSq6HdHRHSAJ/1KhvW9x
l7cZY/vI6vD8fZ7Fo0oOgO/USUJCwMaMdp4o07lnKgZb5xeY+4etl+0tZDexwpN0
J/RI+SloebkGXN1rxPpq9K9J/0Gp3auLIOIdTUF6DkhHYMYBgNfyHEV5u8XM+k1O
ESJkTRqMEhixnRjjF8YK43q+TjWSVDZBfPsnioIGzluBgZ1kr/BpMB9+YW+dXeBV
pV8O1NFVftone9Lzhllmq4T8uKDOwmWOEowbpg0zZfsFxtoPRtz1xhIV9wqXk3bK
dt9pm8rrGN/IlU6W3BvIcAr1vao/bwYrHcy7KdHv3nt/E/JJcDp2OgeYhJ46h+p3
jG9S546AH79lsxSIxULvYkm2u2vYzt+p8+y0InI3vSnMi3XbiwtgELKbkjfrG3zB
Y90fIAIZe6voTpswwFItitO/uvH7f6CRBTvhrauhWr3rgu3Prry8lQBY0J6RnL00
ZNvmZNoptsw12zHn86J8R7tOTHrVmwjwnvCXQnD41b6xrfdVBjDC68WQFubMXzl9
iTOJA43D+h4l73jFdrNzAoQ8Vf/ZlXt3fH5H85OAbfZ5REbvMf+Z3DdWA9hwXoNj
TN4F3qLZWzQlJL3yLqK0jHwW2nNGrQiZldrhXXEWmzyChQxOgJ8=
=nE/h
-----END PGP SIGNATURE-----

--8GhZuDA08EIXzCWaErRpuFRf7MqB7QyhC--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86623e16-744e-e366-5049-70ef69ea81df>