Unverified Commit af8f9a80 authored by anarcat's avatar anarcat
Browse files

nice names for iSCSI devices

parent 4f269090
Loading
Loading
Loading
Loading
+67 −0
Original line number Diff line number Diff line
@@ -882,6 +882,73 @@ For example:
    mkfs.ext4 -j /dev/mapper/36782bcb00063c6a500000aa36036318d
    mount /dev/mapper/36782bcb00063c6a500000aa36036318d /mnt

To have a meaningful name in the device mapper, we need to add an
alias in the multipath daemon. First, you need to find the device
`wwid`:

    root@chi-node-01:~# /lib/udev/scsi_id -g -u -d /dev/sdl
    36782bcb00063c6a500000d67603f7abf

Then add this to the multipath configuration, with an alias, say in
`/etc/multipath/conf.d/web-chi-03-srv.conf`:

```
multipaths {
        multipath {
                wwid 36782bcb00063c6a500000d67603f7abf
                alias web-chi-03-srv
        }
}
```

Then reload the multipath configuration:

    multipath -r

Then add the device:

    multipath -a /dev/sdl

Then reload the multipathd configuration (yes, again):

    multipath -r

You should see the new device name in `multipath -ll`:

    root@chi-node-01:~# multipath -ll
    36782bcb00063c6a500000bfe603f465a dm-15 DELL,MD32xxi
    size=20G features='5 queue_if_no_path pg_init_retries 50 queue_mode mq' hwhandler='1 rdac' wp=rw
    web-chi-03-srv (36782bcb00063c6a500000d67603f7abf) dm-20 DELL,MD32xxi
    size=500G features='5 queue_if_no_path pg_init_retries 50 queue_mode mq' hwhandler='1 rdac' wp=rw
    |-+- policy='round-robin 0' prio=6 status=active
    | |- 11:0:0:4 sdi 8:128 active ready running
    | |- 12:0:0:4 sdj 8:144 active ready running
    | `- 9:0:0:4  sdh 8:112 active ready running
    `-+- policy='round-robin 0' prio=1 status=enabled
      |- 10:0:0:4 sdk 8:160 active ghost running
      |- 7:0:0:4  sdl 8:176 active ghost running
      `- 8:0:0:4  sdm 8:192 active ghost running
    root@chi-node-01:~#

And `lsblk`:

```
# lsblk
[...]
sdh                                                                   8:112  0   500G  0 disk  
└─web-chi-03-srv                                                    254:20   0   500G  0 mpath 
sdi                                                                   8:128  0   500G  0 disk  
└─web-chi-03-srv                                                    254:20   0   500G  0 mpath 
sdj                                                                   8:144  0   500G  0 disk  
└─web-chi-03-srv                                                    254:20   0   500G  0 mpath 
sdk                                                                   8:160  0   500G  0 disk  
└─web-chi-03-srv                                                    254:20   0   500G  0 mpath 
sdl                                                                   8:176  0   500G  0 disk  
└─web-chi-03-srv                                                    254:20   0   500G  0 mpath 
sdm                                                                   8:192  0   500G  0 disk  
└─web-chi-03-srv                                                    254:20   0   500G  0 mpath 
```

See [issue 40131](https://gitlab.torproject.org/tpo/tpa/team/-/issues/40131).

### Deleting a disk