Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I get the list of all devices which are root dependent i.e either mounted on root filesystem or created from root devices(Logical volume on the top of physical volume which is root device).


Answer must be an script (may be shell) that will return list of all the root dependent devices.I dont wanna use any LVM specific package command (such as lvdisplay etc).


As answer posted by @Oli,

mount | awk '$3 ==  "/" {printf $1}' | sed s'/.$//'

Only lists the device.But I want which of its partition is actually a root dependent.

I tried getting which LVM device is mapped to physical device using dmsetup deps

I got

ubuntu-swap_1: 1 dependencies   : (8, 5) 
ubuntu-root: 1 dependencies : (8, 5)

Above gives me mapping(can get by comparing (major, minor) number) but how can I ensure LVM is root device?

share|improve this question
Why no lvdisplay? – Oli Oct 22 '13 at 9:41
@Oli use of lvdisplay will make it lvm package dependent. You need to install LVM package before using it(as its not inbuild). So no to LVM package commands.Can use dmsetup instead. – Dipak Ingole Oct 22 '13 at 11:10
  • df -h will list all devices/mounts.
  • lsof / will list all open files under root.
  • lvs, lvscan, and lvdisplay are used for LVM information.
share|improve this answer
df -h will not give me LVM details which is created from root device. And I want devices which are either created from root or root device. – Dipak Ingole Oct 18 '13 at 11:25
For LVM, you can use lvscan, lvs, and lvdisplay. – mmstick Oct 18 '13 at 11:30

Well to find out the root device (virtual or physical), I've been using:

mount | awk '$3 ==  "/" {printf $1}' | sed s'/.$//'

Past there, it's fairly simple. You either have a device, or you have a mapped device. If it's mapped, dmsetup info can help resolve physical devices:

$ ROOTDEV=$(mount | awk '$3 ==  "/" {printf $1}' | sed s'/.$//')
$ sudo dmsetup info -Co blkdevs_used $ROOTDEV | tail -n+2

Of course, if $ROOTDEV isn't a mapped, device, everything will explode in a sticky, hot mess. It should be noted that dm-mapper can map partitions, so you may need to recurse through returned devices until you end up with sd* strings.

I've no idea how this works in an LVM environment. I've tested it on JBOD and dmraid-1.

share|improve this answer
Thanks for replying.But your solution wont work in case of LVM devices.I am testing it on ubuntu 12.04 – Dipak Ingole Oct 22 '13 at 17:31
Can you provide any actual output? You've tied our hands from using LVM specific tools so it's a bit hard to debug. – Oli Oct 22 '13 at 19:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.