NAS Posted May 31, 2019 Share Posted May 31, 2019 Sorry if this is obvious but I cant quite nail it down. I have a need for a thing I am doing to find the device name and disk serial starting knowing either "/mnt/disk4" or "/dev/md4" from the shell Does anyone know how to get for example "/dev/sdb1" from this? 1 Quote Link to comment
Pixxelcrasher Posted May 31, 2019 Share Posted May 31, 2019 You can try it with : lsblk Quote Link to comment
NAS Posted May 31, 2019 Author Share Posted May 31, 2019 I have tried I think all the obvious ways although I still think i missed the one obvious one that works lsblk /dev/md4 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT md4 9:4 0 3.7T 0 md /mnt/disk4 Quote Link to comment
bonienl Posted May 31, 2019 Share Posted May 31, 2019 (edited) grep -A1 '"disk4"' /var/local/emhttp/disks.ini or if you want only the device designation grep -A1 '"disk4"' /var/local/emhttp/disks.ini | grep -Po 'device="\K[^"]+' Edited May 31, 2019 by bonienl 1 Quote Link to comment
NAS Posted May 31, 2019 Author Share Posted May 31, 2019 That is excellent thank you very much. I would not have thought to do it like this at all. Quote Link to comment
bonienl Posted May 31, 2019 Share Posted May 31, 2019 You asked for the "obvious" 😁 Quote Link to comment
NAS Posted June 1, 2019 Author Share Posted June 1, 2019 hehe Out of curiusoty i never did find a way to do this by query /proc. Any idea if this data is in there somewhere? Quote Link to comment
NAS Posted June 4, 2019 Author Share Posted June 4, 2019 @limetech can you confirm if this is indeed in `proc` just so I can close this thread down as solved and anyone else that happens upon it knows the definitive answer. Quote Link to comment
bonienl Posted June 4, 2019 Share Posted June 4, 2019 I have never seen it as part of "proc", but of course I am not limetech 😉 Quote Link to comment
NAS Posted June 4, 2019 Author Share Posted June 4, 2019 yeah i dont think it is there either but i suspect this thread will hang about for years and hit first page on google since its so niche. (anyone else find themselves answering their own question via google in old forum posts... i do more than I care to admit) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.