Determine block device from md device


10 posts in this topic Last Reply

Recommended Posts

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?

 

 

Link to post

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

 

Link to post
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 by bonienl
Link to post

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)

Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.