Hi, this is a Linux question rather than a Fedora question, but Im not signed up to any other Linux related forum so... Sorry if not appropriate.
I need to find the device file name, that the root file system is on. For example the root file system mounted at / is on device /dev/sdcX - I want to find that out reliably in script. So far I have:
rootDev=`mount | egrep " on / " | egrep -o "^/dev/[^ ]*"`
This works some of the time but sometimes mount lists a UUID link such as:
I could use rootDev=`readlink -f $rootDev` to resolve this link, but I have noticed sometimes the UUID mount lists does not actually exist in /dev/disk/by-uuid/ (What the heck?)!. So I need a more reliable way of doing this.
Thanks in advance,
---------- Post added at 11:33 PM ---------- Previous post was at 06:30 PM ----------
Hmmm seems like the answer is:
readlink -f /dev/root
Ha! Still dont know how reliable that is though - i.e. is /dev/root standard Linux? Also the non existent UUID thing maybe due to an outdated mtab, since `mount` just lists that.