How do you determine the root device if /dev/root is missing?












3















On the distribution that I am using right now, Arch Linux ARM, Linux is launched without an initial RAM disk, meaning the kernel does all the work in mounting the root filesystem. This system is installed on an SD card and it has a script on it that needs to determine the device node of the filesystem that it resides on. This device node can change depending on how I boot the device up (e.g., I attach it to another device that is already running).



I am able to determine the mount point using df -k --output=target ${0} | sed "1d". To determine the source device, I run df -k --output=source ${0} | sed "1d". If I've booted into Arch Linux, the result of that last command spits out /dev/root, which does not exist. Sure, on some systems, udev will create a symbolic link from /dev/root to the real root device, but mine doesn't do that. I could look at the contents of /proc/cmdline but that stays the same throughout a kernel's uptime, so that means it isn't reliable.



When I get /dev/root, how can I determine the real underlying block device it stands in place for?










share|improve this question























  • (1) Obviously I’m not understanding a lot of this. AFAIK, the mount point for the root filesystem is always / — why do you need to have a command to “determine the mount point” for the root filesystem? (2) What is ${0} here? Why are you saying ${0} instead of $0, or, better yet, "$0"? (3) Your question is about filenames / pathnames.  Do those change if you run df without the -k?  If so, please explain how. If not, consider leaving off the -k, because it’s clutter. (4) If you say df /, what do you get? In what respect does that not answer your question? … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  (5) You say, “the contents of /proc/cmdline … stays the same throughout a kernel’s uptime, so that means it isn’t reliable.”  Huh?  How is a stable value unreliable? (6) Does the output of mount (or cat /proc/mounts) ever show the information you want?  If not, slow down, stop, go back and start over. If the output of mount never shows the information you want, then I have no idea what you want, and probably everybody else is confused too, … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  and you are highly unlikely to get a satisfactory answer until you explain your requirement more clearly.  OTOH, if the output of mount sometimes shows the information you want, please give us an example of mount output that doesn’t show the information you want, and explain when you get that instead of the useful output.  (7) Please do not respond in comments; edit your question to make it clearer and more complete.

    – Scott
    Jun 30 '17 at 6:01


















3















On the distribution that I am using right now, Arch Linux ARM, Linux is launched without an initial RAM disk, meaning the kernel does all the work in mounting the root filesystem. This system is installed on an SD card and it has a script on it that needs to determine the device node of the filesystem that it resides on. This device node can change depending on how I boot the device up (e.g., I attach it to another device that is already running).



I am able to determine the mount point using df -k --output=target ${0} | sed "1d". To determine the source device, I run df -k --output=source ${0} | sed "1d". If I've booted into Arch Linux, the result of that last command spits out /dev/root, which does not exist. Sure, on some systems, udev will create a symbolic link from /dev/root to the real root device, but mine doesn't do that. I could look at the contents of /proc/cmdline but that stays the same throughout a kernel's uptime, so that means it isn't reliable.



When I get /dev/root, how can I determine the real underlying block device it stands in place for?










share|improve this question























  • (1) Obviously I’m not understanding a lot of this. AFAIK, the mount point for the root filesystem is always / — why do you need to have a command to “determine the mount point” for the root filesystem? (2) What is ${0} here? Why are you saying ${0} instead of $0, or, better yet, "$0"? (3) Your question is about filenames / pathnames.  Do those change if you run df without the -k?  If so, please explain how. If not, consider leaving off the -k, because it’s clutter. (4) If you say df /, what do you get? In what respect does that not answer your question? … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  (5) You say, “the contents of /proc/cmdline … stays the same throughout a kernel’s uptime, so that means it isn’t reliable.”  Huh?  How is a stable value unreliable? (6) Does the output of mount (or cat /proc/mounts) ever show the information you want?  If not, slow down, stop, go back and start over. If the output of mount never shows the information you want, then I have no idea what you want, and probably everybody else is confused too, … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  and you are highly unlikely to get a satisfactory answer until you explain your requirement more clearly.  OTOH, if the output of mount sometimes shows the information you want, please give us an example of mount output that doesn’t show the information you want, and explain when you get that instead of the useful output.  (7) Please do not respond in comments; edit your question to make it clearer and more complete.

    – Scott
    Jun 30 '17 at 6:01
















3












3








3


1






On the distribution that I am using right now, Arch Linux ARM, Linux is launched without an initial RAM disk, meaning the kernel does all the work in mounting the root filesystem. This system is installed on an SD card and it has a script on it that needs to determine the device node of the filesystem that it resides on. This device node can change depending on how I boot the device up (e.g., I attach it to another device that is already running).



I am able to determine the mount point using df -k --output=target ${0} | sed "1d". To determine the source device, I run df -k --output=source ${0} | sed "1d". If I've booted into Arch Linux, the result of that last command spits out /dev/root, which does not exist. Sure, on some systems, udev will create a symbolic link from /dev/root to the real root device, but mine doesn't do that. I could look at the contents of /proc/cmdline but that stays the same throughout a kernel's uptime, so that means it isn't reliable.



When I get /dev/root, how can I determine the real underlying block device it stands in place for?










share|improve this question














On the distribution that I am using right now, Arch Linux ARM, Linux is launched without an initial RAM disk, meaning the kernel does all the work in mounting the root filesystem. This system is installed on an SD card and it has a script on it that needs to determine the device node of the filesystem that it resides on. This device node can change depending on how I boot the device up (e.g., I attach it to another device that is already running).



I am able to determine the mount point using df -k --output=target ${0} | sed "1d". To determine the source device, I run df -k --output=source ${0} | sed "1d". If I've booted into Arch Linux, the result of that last command spits out /dev/root, which does not exist. Sure, on some systems, udev will create a symbolic link from /dev/root to the real root device, but mine doesn't do that. I could look at the contents of /proc/cmdline but that stays the same throughout a kernel's uptime, so that means it isn't reliable.



When I get /dev/root, how can I determine the real underlying block device it stands in place for?







filesystems mount






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 28 '17 at 20:23









MelabMelab

3421921




3421921













  • (1) Obviously I’m not understanding a lot of this. AFAIK, the mount point for the root filesystem is always / — why do you need to have a command to “determine the mount point” for the root filesystem? (2) What is ${0} here? Why are you saying ${0} instead of $0, or, better yet, "$0"? (3) Your question is about filenames / pathnames.  Do those change if you run df without the -k?  If so, please explain how. If not, consider leaving off the -k, because it’s clutter. (4) If you say df /, what do you get? In what respect does that not answer your question? … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  (5) You say, “the contents of /proc/cmdline … stays the same throughout a kernel’s uptime, so that means it isn’t reliable.”  Huh?  How is a stable value unreliable? (6) Does the output of mount (or cat /proc/mounts) ever show the information you want?  If not, slow down, stop, go back and start over. If the output of mount never shows the information you want, then I have no idea what you want, and probably everybody else is confused too, … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  and you are highly unlikely to get a satisfactory answer until you explain your requirement more clearly.  OTOH, if the output of mount sometimes shows the information you want, please give us an example of mount output that doesn’t show the information you want, and explain when you get that instead of the useful output.  (7) Please do not respond in comments; edit your question to make it clearer and more complete.

    – Scott
    Jun 30 '17 at 6:01





















  • (1) Obviously I’m not understanding a lot of this. AFAIK, the mount point for the root filesystem is always / — why do you need to have a command to “determine the mount point” for the root filesystem? (2) What is ${0} here? Why are you saying ${0} instead of $0, or, better yet, "$0"? (3) Your question is about filenames / pathnames.  Do those change if you run df without the -k?  If so, please explain how. If not, consider leaving off the -k, because it’s clutter. (4) If you say df /, what do you get? In what respect does that not answer your question? … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  (5) You say, “the contents of /proc/cmdline … stays the same throughout a kernel’s uptime, so that means it isn’t reliable.”  Huh?  How is a stable value unreliable? (6) Does the output of mount (or cat /proc/mounts) ever show the information you want?  If not, slow down, stop, go back and start over. If the output of mount never shows the information you want, then I have no idea what you want, and probably everybody else is confused too, … (Cont’d)

    – Scott
    Jun 30 '17 at 6:01













  • (Cont’d) …  and you are highly unlikely to get a satisfactory answer until you explain your requirement more clearly.  OTOH, if the output of mount sometimes shows the information you want, please give us an example of mount output that doesn’t show the information you want, and explain when you get that instead of the useful output.  (7) Please do not respond in comments; edit your question to make it clearer and more complete.

    – Scott
    Jun 30 '17 at 6:01



















(1) Obviously I’m not understanding a lot of this. AFAIK, the mount point for the root filesystem is always / — why do you need to have a command to “determine the mount point” for the root filesystem? (2) What is ${0} here? Why are you saying ${0} instead of $0, or, better yet, "$0"? (3) Your question is about filenames / pathnames.  Do those change if you run df without the -k?  If so, please explain how. If not, consider leaving off the -k, because it’s clutter. (4) If you say df /, what do you get? In what respect does that not answer your question? … (Cont’d)

– Scott
Jun 30 '17 at 6:01







(1) Obviously I’m not understanding a lot of this. AFAIK, the mount point for the root filesystem is always / — why do you need to have a command to “determine the mount point” for the root filesystem? (2) What is ${0} here? Why are you saying ${0} instead of $0, or, better yet, "$0"? (3) Your question is about filenames / pathnames.  Do those change if you run df without the -k?  If so, please explain how. If not, consider leaving off the -k, because it’s clutter. (4) If you say df /, what do you get? In what respect does that not answer your question? … (Cont’d)

– Scott
Jun 30 '17 at 6:01















(Cont’d) …  (5) You say, “the contents of /proc/cmdline … stays the same throughout a kernel’s uptime, so that means it isn’t reliable.”  Huh?  How is a stable value unreliable? (6) Does the output of mount (or cat /proc/mounts) ever show the information you want?  If not, slow down, stop, go back and start over. If the output of mount never shows the information you want, then I have no idea what you want, and probably everybody else is confused too, … (Cont’d)

– Scott
Jun 30 '17 at 6:01







(Cont’d) …  (5) You say, “the contents of /proc/cmdline … stays the same throughout a kernel’s uptime, so that means it isn’t reliable.”  Huh?  How is a stable value unreliable? (6) Does the output of mount (or cat /proc/mounts) ever show the information you want?  If not, slow down, stop, go back and start over. If the output of mount never shows the information you want, then I have no idea what you want, and probably everybody else is confused too, … (Cont’d)

– Scott
Jun 30 '17 at 6:01















(Cont’d) …  and you are highly unlikely to get a satisfactory answer until you explain your requirement more clearly.  OTOH, if the output of mount sometimes shows the information you want, please give us an example of mount output that doesn’t show the information you want, and explain when you get that instead of the useful output.  (7) Please do not respond in comments; edit your question to make it clearer and more complete.

– Scott
Jun 30 '17 at 6:01







(Cont’d) …  and you are highly unlikely to get a satisfactory answer until you explain your requirement more clearly.  OTOH, if the output of mount sometimes shows the information you want, please give us an example of mount output that doesn’t show the information you want, and explain when you get that instead of the useful output.  (7) Please do not respond in comments; edit your question to make it clearer and more complete.

– Scott
Jun 30 '17 at 6:01












5 Answers
5






active

oldest

votes


















2














The mount command will show it:



  mount | sed -n 's|^/dev/(.*) on / .*|1|p'





share|improve this answer
























  • Nope! The output of mount is unreliable and difficult to process with a script.

    – Melab
    Jun 29 '17 at 15:09











  • The above will give you the block device the root filesystem is on ...

    – Mike Redrobe
    Jun 30 '17 at 11:53



















1














Assuming there's a file at /etc/fstab



sudo cat /etc/fstab | grep 's/s'


will give you an fstab entry to the block device mounted on /.






share|improve this answer
























  • That is not reliable at all. If I was asking about fstab, then this might be a good answer.

    – Melab
    Jun 29 '17 at 15:08











  • Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

    – Lizardx
    Mar 18 '18 at 20:41



















1














Answer from the comments here is very simple. Just call:



findmnt -n -o SOURCE /


Provided that findmnt is present...






share|improve this answer































    0














    You can use stat / and inspect the device major/minor number or with the help of the rdev command get this interpreted automatically.






    share|improve this answer
























    • See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

      – eckes
      May 28 '17 at 21:18











    • Related:   How to determine whether a Linux filesystem belongs to a running system or not.

      – Scott
      Jun 30 '17 at 6:00





















    0














    Kernel logs



    Do a:



    dmesg


    First, it might be explicitly given on the kernel CLI at the very start of boot:



    Command line: root=/dev/vda ...


    Otherwise, at the end of boot, if rootfs is a disk and not initrd / initramfs, the kernel says:



    VFS: Mounted root (ext2 filesystem) on device 254:0.


    so we then find that:



    find /proc /sys -iname '*254:0*'


    and then determine what it actually maps through with:



    ls -l /sys/dev/block/254:0


    output:



    lrwxrwxrwx    1 root     root             0 Jan 30 15:59 /sys/dev/block/254:0 -> ../../devices/pci0000:00/0000:00:09.0/virtio4/block/vda


    Tested with this QEMU + Buildroot setup.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1213770%2fhow-do-you-determine-the-root-device-if-dev-root-is-missing%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      The mount command will show it:



        mount | sed -n 's|^/dev/(.*) on / .*|1|p'





      share|improve this answer
























      • Nope! The output of mount is unreliable and difficult to process with a script.

        – Melab
        Jun 29 '17 at 15:09











      • The above will give you the block device the root filesystem is on ...

        – Mike Redrobe
        Jun 30 '17 at 11:53
















      2














      The mount command will show it:



        mount | sed -n 's|^/dev/(.*) on / .*|1|p'





      share|improve this answer
























      • Nope! The output of mount is unreliable and difficult to process with a script.

        – Melab
        Jun 29 '17 at 15:09











      • The above will give you the block device the root filesystem is on ...

        – Mike Redrobe
        Jun 30 '17 at 11:53














      2












      2








      2







      The mount command will show it:



        mount | sed -n 's|^/dev/(.*) on / .*|1|p'





      share|improve this answer













      The mount command will show it:



        mount | sed -n 's|^/dev/(.*) on / .*|1|p'






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jun 29 '17 at 8:28









      Mike RedrobeMike Redrobe

      1214




      1214













      • Nope! The output of mount is unreliable and difficult to process with a script.

        – Melab
        Jun 29 '17 at 15:09











      • The above will give you the block device the root filesystem is on ...

        – Mike Redrobe
        Jun 30 '17 at 11:53



















      • Nope! The output of mount is unreliable and difficult to process with a script.

        – Melab
        Jun 29 '17 at 15:09











      • The above will give you the block device the root filesystem is on ...

        – Mike Redrobe
        Jun 30 '17 at 11:53

















      Nope! The output of mount is unreliable and difficult to process with a script.

      – Melab
      Jun 29 '17 at 15:09





      Nope! The output of mount is unreliable and difficult to process with a script.

      – Melab
      Jun 29 '17 at 15:09













      The above will give you the block device the root filesystem is on ...

      – Mike Redrobe
      Jun 30 '17 at 11:53





      The above will give you the block device the root filesystem is on ...

      – Mike Redrobe
      Jun 30 '17 at 11:53













      1














      Assuming there's a file at /etc/fstab



      sudo cat /etc/fstab | grep 's/s'


      will give you an fstab entry to the block device mounted on /.






      share|improve this answer
























      • That is not reliable at all. If I was asking about fstab, then this might be a good answer.

        – Melab
        Jun 29 '17 at 15:08











      • Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

        – Lizardx
        Mar 18 '18 at 20:41
















      1














      Assuming there's a file at /etc/fstab



      sudo cat /etc/fstab | grep 's/s'


      will give you an fstab entry to the block device mounted on /.






      share|improve this answer
























      • That is not reliable at all. If I was asking about fstab, then this might be a good answer.

        – Melab
        Jun 29 '17 at 15:08











      • Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

        – Lizardx
        Mar 18 '18 at 20:41














      1












      1








      1







      Assuming there's a file at /etc/fstab



      sudo cat /etc/fstab | grep 's/s'


      will give you an fstab entry to the block device mounted on /.






      share|improve this answer













      Assuming there's a file at /etc/fstab



      sudo cat /etc/fstab | grep 's/s'


      will give you an fstab entry to the block device mounted on /.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered May 28 '17 at 21:25









      Kris MolinariKris Molinari

      1516




      1516













      • That is not reliable at all. If I was asking about fstab, then this might be a good answer.

        – Melab
        Jun 29 '17 at 15:08











      • Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

        – Lizardx
        Mar 18 '18 at 20:41



















      • That is not reliable at all. If I was asking about fstab, then this might be a good answer.

        – Melab
        Jun 29 '17 at 15:08











      • Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

        – Lizardx
        Mar 18 '18 at 20:41

















      That is not reliable at all. If I was asking about fstab, then this might be a good answer.

      – Melab
      Jun 29 '17 at 15:08





      That is not reliable at all. If I was asking about fstab, then this might be a good answer.

      – Melab
      Jun 29 '17 at 15:08













      Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

      – Lizardx
      Mar 18 '18 at 20:41





      Agreed, there is no less reliable source for mounted information than /etc/fstab, I never use it in any of my programs since it has nothing to do with what is actually mounted at this moment on the running system.

      – Lizardx
      Mar 18 '18 at 20:41











      1














      Answer from the comments here is very simple. Just call:



      findmnt -n -o SOURCE /


      Provided that findmnt is present...






      share|improve this answer




























        1














        Answer from the comments here is very simple. Just call:



        findmnt -n -o SOURCE /


        Provided that findmnt is present...






        share|improve this answer


























          1












          1








          1







          Answer from the comments here is very simple. Just call:



          findmnt -n -o SOURCE /


          Provided that findmnt is present...






          share|improve this answer













          Answer from the comments here is very simple. Just call:



          findmnt -n -o SOURCE /


          Provided that findmnt is present...







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 13 '18 at 13:15









          KlausKlaus

          111




          111























              0














              You can use stat / and inspect the device major/minor number or with the help of the rdev command get this interpreted automatically.






              share|improve this answer
























              • See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

                – eckes
                May 28 '17 at 21:18











              • Related:   How to determine whether a Linux filesystem belongs to a running system or not.

                – Scott
                Jun 30 '17 at 6:00


















              0














              You can use stat / and inspect the device major/minor number or with the help of the rdev command get this interpreted automatically.






              share|improve this answer
























              • See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

                – eckes
                May 28 '17 at 21:18











              • Related:   How to determine whether a Linux filesystem belongs to a running system or not.

                – Scott
                Jun 30 '17 at 6:00
















              0












              0








              0







              You can use stat / and inspect the device major/minor number or with the help of the rdev command get this interpreted automatically.






              share|improve this answer













              You can use stat / and inspect the device major/minor number or with the help of the rdev command get this interpreted automatically.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered May 28 '17 at 21:16









              eckeseckes

              826716




              826716













              • See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

                – eckes
                May 28 '17 at 21:18











              • Related:   How to determine whether a Linux filesystem belongs to a running system or not.

                – Scott
                Jun 30 '17 at 6:00





















              • See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

                – eckes
                May 28 '17 at 21:18











              • Related:   How to determine whether a Linux filesystem belongs to a running system or not.

                – Scott
                Jun 30 '17 at 6:00



















              See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

              – eckes
              May 28 '17 at 21:18





              See here for various possible workarounds with problems of that method: free-electrons.com/blog/find-root-device

              – eckes
              May 28 '17 at 21:18













              Related:   How to determine whether a Linux filesystem belongs to a running system or not.

              – Scott
              Jun 30 '17 at 6:00







              Related:   How to determine whether a Linux filesystem belongs to a running system or not.

              – Scott
              Jun 30 '17 at 6:00













              0














              Kernel logs



              Do a:



              dmesg


              First, it might be explicitly given on the kernel CLI at the very start of boot:



              Command line: root=/dev/vda ...


              Otherwise, at the end of boot, if rootfs is a disk and not initrd / initramfs, the kernel says:



              VFS: Mounted root (ext2 filesystem) on device 254:0.


              so we then find that:



              find /proc /sys -iname '*254:0*'


              and then determine what it actually maps through with:



              ls -l /sys/dev/block/254:0


              output:



              lrwxrwxrwx    1 root     root             0 Jan 30 15:59 /sys/dev/block/254:0 -> ../../devices/pci0000:00/0000:00:09.0/virtio4/block/vda


              Tested with this QEMU + Buildroot setup.






              share|improve this answer




























                0














                Kernel logs



                Do a:



                dmesg


                First, it might be explicitly given on the kernel CLI at the very start of boot:



                Command line: root=/dev/vda ...


                Otherwise, at the end of boot, if rootfs is a disk and not initrd / initramfs, the kernel says:



                VFS: Mounted root (ext2 filesystem) on device 254:0.


                so we then find that:



                find /proc /sys -iname '*254:0*'


                and then determine what it actually maps through with:



                ls -l /sys/dev/block/254:0


                output:



                lrwxrwxrwx    1 root     root             0 Jan 30 15:59 /sys/dev/block/254:0 -> ../../devices/pci0000:00/0000:00:09.0/virtio4/block/vda


                Tested with this QEMU + Buildroot setup.






                share|improve this answer


























                  0












                  0








                  0







                  Kernel logs



                  Do a:



                  dmesg


                  First, it might be explicitly given on the kernel CLI at the very start of boot:



                  Command line: root=/dev/vda ...


                  Otherwise, at the end of boot, if rootfs is a disk and not initrd / initramfs, the kernel says:



                  VFS: Mounted root (ext2 filesystem) on device 254:0.


                  so we then find that:



                  find /proc /sys -iname '*254:0*'


                  and then determine what it actually maps through with:



                  ls -l /sys/dev/block/254:0


                  output:



                  lrwxrwxrwx    1 root     root             0 Jan 30 15:59 /sys/dev/block/254:0 -> ../../devices/pci0000:00/0000:00:09.0/virtio4/block/vda


                  Tested with this QEMU + Buildroot setup.






                  share|improve this answer













                  Kernel logs



                  Do a:



                  dmesg


                  First, it might be explicitly given on the kernel CLI at the very start of boot:



                  Command line: root=/dev/vda ...


                  Otherwise, at the end of boot, if rootfs is a disk and not initrd / initramfs, the kernel says:



                  VFS: Mounted root (ext2 filesystem) on device 254:0.


                  so we then find that:



                  find /proc /sys -iname '*254:0*'


                  and then determine what it actually maps through with:



                  ls -l /sys/dev/block/254:0


                  output:



                  lrwxrwxrwx    1 root     root             0 Jan 30 15:59 /sys/dev/block/254:0 -> ../../devices/pci0000:00/0000:00:09.0/virtio4/block/vda


                  Tested with this QEMU + Buildroot setup.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 30 at 16:04









                  Ciro Santilli 新疆改造中心 六四事件 法轮功Ciro Santilli 新疆改造中心 六四事件 法轮功

                  4,13322737




                  4,13322737






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1213770%2fhow-do-you-determine-the-root-device-if-dev-root-is-missing%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Сан-Квентин

                      8-я гвардейская общевойсковая армия

                      Алькесар