How to find the disk where root / is on in Bash on Linux?

How to find the disk where the Linux's root(/) is on in Bash? The root may be on a LVM volume or on a raw disk.

2 cases:

One example:

# df -hT | grep /$
/dev/root               ext4       48G   32G   14G  71% /

while /dev/root is actually /dev/sda4.

For another example:

# df -hT | grep /$
/dev/mapper/fedora-root        ext4       48G   45G  1.4G  98% /

The it is a LVM volume in LVM group 'fedora':

# lvs | grep fedora | grep root
  root        fedora   -wi-ao----  48.83g   

and 'fedora' is on the single disk partition '/dev/sda3' of disk '/dev/sda':

# pvs | grep fedora
  /dev/sda3  fedora   lvm2 a--    64.46g   4.00m

For both cases above, we want to find out '/dev/sda'.

asked Jun 5, 2017 by anonymous

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost