logo

blog

My little blog can’t be this cute! git clone https://hacktivis.me/git/blog.git
commit: 1472dea2821fa0be14be176a19692ca59b19d704
parent dc4fb816954d7acc90f90514cc5ccd7f36a12f9a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue,  4 Jul 2017 17:48:13 +0200

articles/Disk identification.html: Less duplication, fix typos and better structure

Diffstat:

Marticles/Disk identification.html19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/articles/Disk identification.html b/articles/Disk identification.html @@ -1,4 +1,5 @@ <h1><a href="/articles/Disk%20identification">Disk identification</a></h1> +<h2>Introduction/Why?</h2> <p>So the one for network interface is now okay-ish. I done a quick look at how it works for… disks. So most of it was done under Linux, but I know this nightmare under OpenSolaris(I recommend <a href="http://sysunconfig.net/unixtips/solaris80.20.pdf">20% of Solaris Knowledge that solves 80% of your needs</a>; but only 8 slices/partitions, non-intuitive, no file hierarchy… why), Plan9front(a bit better, at least partitions are under a directory).</p> <p>And as you’re probably using <code>lsblk</code> and/or <code>blkid</code> or even <code>fdisk -l</code>(I use that when I’m on a non-Linux Unix) to identify as a human your disks, I done a quick look for fun at disk identifiers… (intended more for machines I guess) and… oh noes.</p> <pre><code>$ lsblk -oTRAN,NAME,SIZE,FSTYPE,PARTUUID,UUID,WWN @@ -32,17 +33,17 @@ $ blkid /dev/sdf1: SEC_TYPE="msdos" TYPE="vfat" </code></pre> <p>If you look enough at it… NONE of them works and wtf is <code>UUID_SUB</code> printing out of nowhere. So as you’re probably not <code>LABEL</code>’ing all your hard-drives because your system sucks… The only thing I found so far that is the least broken under linux(+(e)udev) is <code>/dev/disk/by-id</code>.</p> -<p>So quick list of things that are nice/works:</p><ul> - <li><code>DISK ID</code> (MODEL+SERIAL) and partition ID (MBR/GPT thing) - <li>PCI/<code>BUS ID</code>s (like: <code>/proc/bus/pci/x/y</code> in Linux) - <li>Partition table/disk as a directory, partitions as files (ayo Plan9) - <li>The disk slot, useful when you plug (some of) your disk(s) by their slot (IDE: Primary/Secondary Master/Slave; SATA: 1,2,3…; USB: bus/network_iface equivalent?) -</ul> <h2>Proposition</h2> -The following is in pseudo-code, then a <code>tree</code>-like view +<p>So quick list of things that are nice/works:</p> +<ul> + <li>SunOS: Controller, Target-id, Drive, Slice; but moved to a tree would be better as it’s more flexible</li> + <li><code>DISK ID</code> (MODEL+SERIAL) and partition ID (MBR/GPT thing)</li> + <li>PCI/<code>BUS ID</code>s (like: <code>/proc/bus/pci/x/y</code> in Linux)</li> + <li>Plan9: disk as a directory, partitions as files, <code>data</code> for whole disk access</li> + <li><code>DISK SLOT</code>: useful when you plug (some of) your disk(s) by their slot (IDE: Primary/Secondary Master/Slave; SATA: 1,2,3…; USB: bus/network_iface equivalent?)</li> +</ul> +<p>Here is an example of a file hierarchy of my idea, based on that:</p> <code> -BUS ID += PCI-ID /* maybe put SCSI-ID here too for compatibility */ -DISK SLOT = IDE(Primary Master, Primary Slave, …), SATA(1, 2, 3, …), … <ul> <li>/dev/…/${BUS ID}/<ul> <li>by-label/${DISK LABEL} → ${DISK ID}</li>