The full case is the following:
- I attach a LUN from a SAN box (iscsi configuration has been done correctly)
- As soon as I restart the open-iscsi daemon, the LUN is attached and its name appears under
/dev/mapper
is something like the following string:360060e80104dac0004f349c800000001
Now I don't want to use this alphanumeric, I need a decent mnemonic. So, I use the dmsetup command as follows:
# dmsetup rename 360060e80104dac0004f349c800000001 datastore
and a datastore
link to a dm device appears under /dev/mapper. Problem solved, until the next reboot. where the datastore
mnemonic is gone and the above alphanumeric appears again under /dev/mapper.
How do I make this change permanent?
Best Answer
Consider referencing the LUN via
/dev/disk/by-{id,path,uuid}
instead of trying to rename WWN every time.Or maybe you can make a udev(7) rule to create a static node under
/dev
representing your block device based on attributes related to your WWN. You can get all the attributes with udevadm(8). A good starting point would beID_WWN_WITH_EXTENSION
:ENV{ID_WWN_WITH_EXTENSION}=="360060e80104dac0004f349c800000001", SYMLINK+="iscsi/datastore"
This creates a symlink at /dev/iscsi/datastore that points to your iscsi LUN.